vertexshader.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"
{
switch (shader_version)
{
case WINED3D_SHADER_VERSION(1,0):
/* TODO: vs_1_1 has a minimum of 96 constants. What happens if a vs_1_1 shader is used
* on a vs_3_0 capable card that has 256 constants? */
break;
case WINED3D_SHADER_VERSION(2,0):
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):
/* DX10 cards on Windows advertise a d3d9 constant limit of 256 even though they are capable
* of supporting much more(GL drivers advertise 1024). d3d9.dll and d3d8.dll clamp the
* wined3d-advertised maximum. Clamp the constant limit for <= 3.0 shaders to 256.s
* use constant buffers */
break;
default:
FIXME("Unrecognized vertex shader version %u.%u\n",
}
}
return FALSE;
}
BOOL vshader_get_input(IWineD3DVertexShader* iface, BYTE usage_req, BYTE usage_idx_req, unsigned int *regnum)
{
unsigned int i;
{
if (!(map & 1)) continue;
{
*regnum = i;
return TRUE;
}
}
return FALSE;
}
/* *******************************************
IWineD3DVertexShader IUnknown parts follow
******************************************* */
static HRESULT WINAPI IWineD3DVertexShaderImpl_QueryInterface(IWineD3DVertexShader *iface, REFIID riid, LPVOID *ppobj) {
{
return S_OK;
}
return E_NOINTERFACE;
}
return refcount;
}
if (!refcount)
{
}
return refcount;
}
/* *******************************************
IWineD3DVertexShader IWineD3DVertexShader parts follow
******************************************* */
static HRESULT WINAPI IWineD3DVertexShaderImpl_GetParent(IWineD3DVertexShader *iface, IUnknown** parent){
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DVertexShaderImpl_GetDevice(IWineD3DVertexShader* iface, IWineD3DDevice **pDevice){
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DVertexShaderImpl_GetFunction(IWineD3DVertexShader* 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;
}
/* Note that for vertex shaders CompileShader isn't called until the
* shader is first used. The reason for this is that we need the vertex
* declaration the shader will be used with in order to determine if
* the data in a register is of type D3DCOLOR, and needs swizzling. */
{
const struct wined3d_shader_frontend *fe;
unsigned int i;
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 registers used, semantics, etc.. */
This->max_rel_offset = 0;
if (output_signature)
{
for (i = 0; i < output_signature->element_count; ++i)
{
}
}
FIXME("The difference between the minimum and maximum relative offset is > 127\n");
FIXME("Which this OpenGL implementation does not support. Try using GLSL\n");
} else {
This->rel_offset = 0;
}
}
This->baseShader.load_local_constsF = This->baseShader.reg_maps.usesrelconstF && !list_empty(&This->baseShader.constantsF);
/* copy the function ... because it will certainly be released by application */
return WINED3D_OK;
}
/* Set local constants for d3d8 shaders */
}
if (!lconst) return E_OUTOFMEMORY;
}
return WINED3D_OK;
}
{
/*** IUnknown methods ***/
/*** IWineD3DBase methods ***/
/*** IWineD3DBaseShader methods ***/
/*** IWineD3DVertexShader methods ***/
};
void find_vs_compile_args(IWineD3DVertexShaderImpl *shader, IWineD3DStateBlockImpl *stateblock, struct vs_compile_args *args) {
args->fog_src = stateblock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE ? VS_FOG_COORD : VS_FOG_Z;
}