pixelshader.c revision 554f00fe75489f3f3ce7fbb6d126ce1d2c5c922c
/*
* shaders implementation
*
* Copyright 2002-2003 Jason Edmeades
* Copyright 2002-2003 Raphael Junqueira
* Copyright 2004 Christian Costa
* Copyright 2005 Oliver Stieber
* Copyright 2006 Ivan Gyurdiev
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Sun elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include "wined3d_private.h"
static HRESULT WINAPI IWineD3DPixelShaderImpl_QueryInterface(IWineD3DPixelShader *iface, REFIID riid, LPVOID *ppobj) {
{
return S_OK;
}
return E_NOINTERFACE;
}
return refcount;
}
if (!refcount)
{
}
return refcount;
}
/* *******************************************
IWineD3DPixelShader IWineD3DPixelShader parts follow
******************************************* */
static HRESULT WINAPI IWineD3DPixelShaderImpl_GetParent(IWineD3DPixelShader *iface, IUnknown** parent){
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DPixelShaderImpl_GetDevice(IWineD3DPixelShader* iface, IWineD3DDevice **pDevice){
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DPixelShaderImpl_GetFunction(IWineD3DPixelShader* impl, VOID* pData, UINT* pSizeOfData) {
return WINED3D_OK;
}
/* MSDN claims (for d3d8 at least) that if *pSizeOfData is smaller
* than the required size we should write the required size and
* return D3DERR_MOREDATA. That's not actually true. */
return WINED3DERR_INVALIDCALL;
}
return WINED3D_OK;
}
{
switch (shader_version)
{
case WINED3D_SHADER_VERSION(1,0):
break;
break;
/* FIXME: temporaries must match D3DPSHADERCAPS2_0.NumTemps */
case WINED3D_SHADER_VERSION(2,0):
break;
case WINED3D_SHADER_VERSION(4,0):
FIXME("Using 3.0 limits for 4.0 shader\n");
/* Fall through */
break;
case WINED3D_SHADER_VERSION(3,0):
break;
default:
FIXME("Unrecognized pixel shader version %u.%u\n",
}
}
{
unsigned int i, highest_reg_used = 0, num_regs_used = 0;
const struct wined3d_shader_frontend *fe;
if (!fe)
{
FIXME("Unable to find frontend for shader.\n");
return WINED3DERR_INVALIDCALL;
}
{
FIXME("Failed to initialize frontend.\n");
return WINED3DERR_INVALIDCALL;
}
/* First pass: trace shader */
/* Initialize immediate constant lists */
/* Second pass: figure out which registers are used, what the semantics are, etc.. */
for (i = 0; i < MAX_REG_INPUT; ++i)
{
if (This->input_reg_used[i])
{
highest_reg_used = i;
}
}
/* Don't do any register mapping magic if it is not needed, or if we can't
* achieve anything anyway */
{
{
/* This happens with relative addressing. The input mapper function
* warns about this if the higher registers are declared too, so
* don't write a FIXME here */
WARN("More varying registers used than supported\n");
}
for (i = 0; i < MAX_REG_INPUT; ++i)
{
This->input_reg_map[i] = i;
}
}
else
{
This->declared_in_count = 0;
for (i = 0; i < MAX_REG_INPUT; ++i)
{
else This->input_reg_map[i] = ~0U;
}
}
return WINED3D_OK;
}
void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD3DBaseTexture * const *textures)
{
unsigned int i;
{
/* We don't sample from this sampler */
if (!sampler_type[i]) continue;
if (!textures[i])
{
ERR("No texture bound to sampler %u, using 2D\n", i);
sampler_type[i] = WINED3DSTT_2D;
continue;
}
switch (IWineD3DBaseTexture_GetTextureDimensions(textures[i]))
{
case GL_TEXTURE_RECTANGLE_ARB:
case GL_TEXTURE_2D:
/* We have to select between texture rectangles and 2D textures later because 2.0 and
* 3.0 shaders only have WINED3DSTT_2D as well */
sampler_type[i] = WINED3DSTT_2D;
break;
case GL_TEXTURE_3D:
break;
case GL_TEXTURE_CUBE_MAP_ARB:
sampler_type[i] = WINED3DSTT_CUBE;
break;
default:
FIXME("Unrecognized texture type %#x, using 2D\n",
sampler_type[i] = WINED3DSTT_2D;
}
}
}
{
/*** IUnknown methods ***/
/*** IWineD3DBase methods ***/
/*** IWineD3DBaseShader methods ***/
/*** IWineD3DPixelShader methods ***/
};
void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImpl *stateblock, struct ps_compile_args *args) {
UINT i;
for(i = 0; i < MAX_FRAGMENT_SAMPLERS; i++) {
if(!tex) {
continue;
}
/* Flag samplers that need NP2 texcoord fixup. */
}
}
{
{
}
else if (use_vs(stateblock))
{
} else {
}
} else {
case WINED3DFOG_NONE:
|| use_vs(stateblock))
{
break;
}
case WINED3DFOG_NONE: /* Drop through */
}
break;
}
} else {
}
}
}