mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 14:40:56 +00:00
wined3d: The namedArrays code path is dead (always FALSE).
Delete the entire namedArrays code path and all its dependencies (one of which is quite long - storeOrder in drawprim is always FALSE, for example). Delete declaredArrays, and make its code path the default.
This commit is contained in:
parent
3692219db4
commit
f144d58ac2
@ -685,6 +685,12 @@ void generate_base_shader(
|
||||
FIXME("Unrecognized opcode: token=%08lX\n", opcode_token);
|
||||
pToken += shader_skip_unrecognized(iface, pToken);
|
||||
|
||||
/* Nothing to do */
|
||||
} else if (D3DSIO_DCL == curOpcode->opcode ||
|
||||
D3DSIO_NOP == curOpcode->opcode) {
|
||||
|
||||
pToken += shader_skip_opcode(This, curOpcode, opcode_token);
|
||||
|
||||
/* If a generator function is set for current shader target, use it */
|
||||
} else if (hw_fct != NULL) {
|
||||
|
||||
@ -694,12 +700,7 @@ void generate_base_shader(
|
||||
|
||||
DWORD param, addr_token = 0;
|
||||
|
||||
/* DCL instruction has usage dst parameter, not register */
|
||||
if (curOpcode->opcode == D3DSIO_DCL)
|
||||
param = *pToken++;
|
||||
else
|
||||
pToken += shader_get_param(iface, pToken, ¶m, &addr_token);
|
||||
|
||||
pToken += shader_get_param(iface, pToken, ¶m, &addr_token);
|
||||
hw_arg.dst = param;
|
||||
hw_arg.dst_addr = addr_token;
|
||||
|
||||
@ -724,13 +725,11 @@ void generate_base_shader(
|
||||
/* Call appropriate function for output target */
|
||||
hw_fct(&hw_arg);
|
||||
|
||||
/* Unhandled opcode */
|
||||
} else {
|
||||
|
||||
/* Unless we encounter a no-op command, this opcode is unrecognized */
|
||||
if (curOpcode->opcode != D3DSIO_NOP) {
|
||||
FIXME("Can't handle opcode %s in hwShader\n", curOpcode->name);
|
||||
pToken += shader_skip_opcode(This, curOpcode, opcode_token);
|
||||
}
|
||||
FIXME("Can't handle opcode %s in hwShader\n", curOpcode->name);
|
||||
pToken += shader_skip_opcode(This, curOpcode, opcode_token);
|
||||
}
|
||||
}
|
||||
/* TODO: What about result.depth? */
|
||||
@ -763,7 +762,7 @@ void shader_dump_ins_modifiers(const DWORD output) {
|
||||
FIXME("_unrecognized_modifier(%#lx)", mmask >> D3DSP_DSTMOD_SHIFT);
|
||||
}
|
||||
|
||||
/** Process the D3DSIO_DCL opcode into an ARB string - creates a local vec4
|
||||
/** Process the D3DSIO_DEF opcode into an ARB string - creates a local vec4
|
||||
* float constant, and stores it's usage on the regmaps. */
|
||||
void shader_hw_def(SHADER_OPCODE_ARG* arg) {
|
||||
|
||||
|
@ -315,7 +315,13 @@ static BOOL primitiveInitState(IWineD3DDevice *iface, BOOL vtx_transformed, BOOL
|
||||
return isLightingOn;
|
||||
}
|
||||
|
||||
void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVertexShaderFunction, WineDirect3DVertexStridedData *strided, LONG BaseVertexIndex, DWORD *fvf, BOOL storeOrder, INT arrayUsageMap[WINED3DSHADERDECLUSAGE_MAX_USAGE]) {
|
||||
void primitiveDeclarationConvertToStridedData(
|
||||
IWineD3DDevice *iface,
|
||||
BOOL useVertexShaderFunction,
|
||||
WineDirect3DVertexStridedData *strided,
|
||||
LONG BaseVertexIndex,
|
||||
DWORD *fvf) {
|
||||
|
||||
/* We need to deal with frequency data!*/
|
||||
|
||||
int textureNo =0;
|
||||
@ -374,7 +380,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.position.dwType = element->Type;
|
||||
strided->u.s.position.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "position", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_POSITION] = element->Reg;
|
||||
break;
|
||||
case 1: /* tweened see http://www.gamedev.net/reference/articles/article2017.asp */
|
||||
TRACE("Tweened positions\n");
|
||||
@ -382,7 +387,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.position2.dwType = element->Type;
|
||||
strided->u.s.position2.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "position2", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_POSITION2] = element->Reg;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -393,7 +397,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.normal.dwType = element->Type;
|
||||
strided->u.s.normal.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "normal", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_NORMAL] = element->Reg;
|
||||
break;
|
||||
case 1: /* skinning */
|
||||
TRACE("Skinning / tween normals\n");
|
||||
@ -401,7 +404,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.normal2.dwType = element->Type;
|
||||
strided->u.s.normal2.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "normal2", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_NORMAL2] = element->Reg;
|
||||
break;
|
||||
}
|
||||
*fvf |= D3DFVF_NORMAL;
|
||||
@ -414,21 +416,18 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.blendMatrixIndices.dwType = element->Type;
|
||||
strided->u.s.blendMatrixIndices.dwStride= stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "blendMatrixIndices", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_BLENDINDICES] = element->Reg;
|
||||
break;
|
||||
case D3DDECLUSAGE_BLENDWEIGHT:
|
||||
strided->u.s.blendWeights.lpData = data;
|
||||
strided->u.s.blendWeights.dwType = element->Type;
|
||||
strided->u.s.blendWeights.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "blendWeights", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_BLENDWEIGHT] = element->Reg;
|
||||
break;
|
||||
case D3DDECLUSAGE_PSIZE:
|
||||
strided->u.s.pSize.lpData = data;
|
||||
strided->u.s.pSize.dwType = element->Type;
|
||||
strided->u.s.pSize.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "pSize", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_PSIZE] = element->Reg;
|
||||
break;
|
||||
case D3DDECLUSAGE_COLOR:
|
||||
switch (element->UsageIndex) {
|
||||
@ -437,14 +436,12 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.diffuse.dwType = element->Type;
|
||||
strided->u.s.diffuse.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "diffuse", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_DIFFUSE] = element->Reg;
|
||||
break;
|
||||
case 1: /* specular */
|
||||
strided->u.s.specular.lpData = data;
|
||||
strided->u.s.specular.dwType = element->Type;
|
||||
strided->u.s.specular.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "specular", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_SPECULAR] = element->Reg;
|
||||
|
||||
}
|
||||
|
||||
@ -457,7 +454,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.texCoords[textureNo].dwType = element->Type;
|
||||
strided->u.s.texCoords[textureNo].dwStride = stride;
|
||||
TRACE("Set strided %s.%d data %p, type %d. stride %ld\n", "texCoords", textureNo, data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_TEXCOORD0 + textureNo] = element->Reg;
|
||||
|
||||
++textureNo;
|
||||
break;
|
||||
@ -470,7 +466,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.tangent.dwType = element->Type;
|
||||
strided->u.s.tangent.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "tangent", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_TANGENT] = element->Reg;
|
||||
break;
|
||||
case D3DDECLUSAGE_BINORMAL:
|
||||
/* Binormals are really bitangents perpendicular to the normal but s-aligned to the tangent, basically they are the vectors of any two lines on the plain at right angles to the normal and at right angles to each other, like the x,y,z axis.
|
||||
@ -482,7 +477,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.binormal.dwType = element->Type;
|
||||
strided->u.s.binormal.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "binormal", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_BINORMAL] = element->Reg;
|
||||
break;
|
||||
case D3DDECLUSAGE_TESSFACTOR:
|
||||
/* a google for D3DDECLUSAGE_TESSFACTOR turns up a whopping 36 entries, 7 of which are from MSDN.
|
||||
@ -492,7 +486,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.tessFactor.dwType = element->Type;
|
||||
strided->u.s.tessFactor.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "tessFactor", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_TESSFACTOR] = element->Reg;
|
||||
break;
|
||||
case D3DDECLUSAGE_POSITIONT:
|
||||
|
||||
@ -502,7 +495,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.position.dwType = element->Type;
|
||||
strided->u.s.position.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "positionT", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_POSITIONT] = element->Reg;
|
||||
break;
|
||||
case 1: /* skinning */
|
||||
/* see http://rsn.gamedev.net/tutorials/ms3danim.asp
|
||||
@ -513,7 +505,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.position2.dwType = element->Type;
|
||||
strided->u.s.position2.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "position2T", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_POSITIONT2] = element->Reg;
|
||||
break;
|
||||
}
|
||||
/* TODO: change fvf usage to a plain boolean flag */
|
||||
@ -533,7 +524,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.fog.dwType = element->Type;
|
||||
strided->u.s.fog.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "fog", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_FOG] = element->Reg;
|
||||
break;
|
||||
case D3DDECLUSAGE_DEPTH:
|
||||
TRACE("depth\n");
|
||||
@ -541,7 +531,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.depth.dwType = element->Type;
|
||||
strided->u.s.depth.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "depth", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_DEPTH] = element->Reg;
|
||||
break;
|
||||
case D3DDECLUSAGE_SAMPLE: /* VertexShader textures */
|
||||
TRACE("depth\n");
|
||||
@ -549,7 +538,6 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, BOOL useVer
|
||||
strided->u.s.sample.dwType = element->Type;
|
||||
strided->u.s.sample.dwStride = stride;
|
||||
TRACE("Set strided %s. data %p, type %d. stride %ld\n", "sample", data, element->Type, stride);
|
||||
if (storeOrder) arrayUsageMap[WINED3DSHADERDECLUSAGE_SAMPLE] = element->Reg;
|
||||
break;
|
||||
};
|
||||
|
||||
@ -1897,22 +1885,21 @@ UINT numberOfvertices, UINT numberOfIndicies, GLenum glPrimType, const void *idx
|
||||
fixupVertices(This, dataLocations, &transformedDataLocations, 1 + endStride - startStride, startStride);
|
||||
#endif
|
||||
|
||||
/* vertex shaders */
|
||||
|
||||
/* If the only vertex data used by the shader is supported by OpenGL then*/
|
||||
if ((!useVertexShaderFunction && dataLocations->u.s.pSize.lpData == NULL
|
||||
&& dataLocations->u.s.diffuse.lpData == NULL && dataLocations->u.s.specular.lpData == NULL)
|
||||
|| (useVertexShaderFunction && ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->namedArrays && !((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->declaredArrays)) {
|
||||
if (!useVertexShaderFunction &&
|
||||
dataLocations->u.s.pSize.lpData == NULL &&
|
||||
dataLocations->u.s.diffuse.lpData == NULL &&
|
||||
dataLocations->u.s.specular.lpData == NULL) {
|
||||
|
||||
/* Load the vertex data using named arrays */
|
||||
TRACE("(%p) Loading vertex data\n", This);
|
||||
loadVertexData(iface, dataLocations);
|
||||
|
||||
} else /* Otherwise */
|
||||
if(useVertexShaderFunction && ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->declaredArrays) {
|
||||
} else if(useVertexShaderFunction) {
|
||||
|
||||
/* load the array data using ordinal mapping */
|
||||
loadNumberedArrays(iface, dataLocations, ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->arrayUsageMap);
|
||||
loadNumberedArrays(iface, dataLocations,
|
||||
((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->arrayUsageMap);
|
||||
|
||||
} else { /* If this happens we must drawStridedSlow later on */
|
||||
TRACE("Not loading vertex data\n");
|
||||
@ -1992,18 +1979,16 @@ UINT numberOfvertices, UINT numberOfIndicies, GLenum glPrimType, const void *idx
|
||||
/* Cleanup vertex program */
|
||||
if (useVertexShaderFunction) {
|
||||
/* disable any attribs (this is the same for both GLSL and ARB modes) */
|
||||
if(((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->declaredArrays) {
|
||||
GLint maxAttribs;
|
||||
int i;
|
||||
/* Leave all the attribs disabled */
|
||||
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &maxAttribs);
|
||||
/* MESA does not support it right not */
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
maxAttribs = 16;
|
||||
for (i = 0; i < maxAttribs; ++i) {
|
||||
GL_EXTCALL(glDisableVertexAttribArrayARB(i));
|
||||
checkGLcall("glDisableVertexAttribArrayARB(reg);");
|
||||
}
|
||||
GLint maxAttribs;
|
||||
int i;
|
||||
/* Leave all the attribs disabled */
|
||||
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &maxAttribs);
|
||||
/* MESA does not support it right not */
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
maxAttribs = 16;
|
||||
for (i = 0; i < maxAttribs; ++i) {
|
||||
GL_EXTCALL(glDisableVertexAttribArrayARB(i));
|
||||
checkGLcall("glDisableVertexAttribArrayARB(reg);");
|
||||
}
|
||||
|
||||
if (wined3d_settings.shader_mode == SHADER_ARB)
|
||||
@ -2213,7 +2198,6 @@ void drawPrimitive(IWineD3DDevice *iface,
|
||||
dataLocations = DrawPrimStrideData;
|
||||
}
|
||||
else if (This->stateBlock->vertexDecl != NULL || (useVertexShaderFunction && NULL != ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->vertexDeclaration)) {
|
||||
BOOL storeArrays = useVertexShaderFunction && ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->declaredArrays == FALSE && ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->namedArrays == FALSE;
|
||||
|
||||
TRACE("================ Vertex Declaration ===================\n");
|
||||
dataLocations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dataLocations));
|
||||
@ -2221,8 +2205,8 @@ void drawPrimitive(IWineD3DDevice *iface,
|
||||
ERR("Out of memory!\n");
|
||||
return;
|
||||
}
|
||||
primitiveDeclarationConvertToStridedData(iface, useVertexShaderFunction, dataLocations, StartVertexIndex, &fvf, storeArrays,
|
||||
((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->arrayUsageMap);
|
||||
primitiveDeclarationConvertToStridedData(iface, useVertexShaderFunction, dataLocations, StartVertexIndex, &fvf);
|
||||
|
||||
} else {
|
||||
TRACE("================ FVF ===================\n");
|
||||
dataLocations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dataLocations));
|
||||
|
@ -186,13 +186,7 @@ static void shader_glsl_get_register_name(
|
||||
|| reg == vshader->arrayUsageMap[WINED3DSHADERDECLUSAGE_SPECULAR]) {
|
||||
(*is_color) = TRUE;
|
||||
}
|
||||
/* if the attributes come in as named dcl's then use a named vertex (called namedVertexN) */
|
||||
if (vshader->namedArrays) {
|
||||
sprintf(tmpStr, "namedVertex%lu", reg);
|
||||
} else {
|
||||
/* otherwise the input is on a numbered attribute so use opengl numbered attributes */
|
||||
sprintf(tmpStr, "attrib%lu", reg);
|
||||
}
|
||||
sprintf(tmpStr, "attrib%lu", reg);
|
||||
}
|
||||
break;
|
||||
case D3DSPR_CONST:
|
||||
|
@ -475,7 +475,6 @@ static void vshader_texldl(WINED3DSHADERVECTOR* d) {
|
||||
|
||||
/* Prototype */
|
||||
static void vshader_hw_map2gl(SHADER_OPCODE_ARG* arg);
|
||||
static void vshader_hw_dcl(SHADER_OPCODE_ARG* arg);
|
||||
static void vshader_hw_mnxn(SHADER_OPCODE_ARG* arg);
|
||||
|
||||
/**
|
||||
@ -535,7 +534,7 @@ CONST SHADER_OPCODE IWineD3DVertexShaderImpl_shader_ins[] = {
|
||||
{D3DSIO_M3x2, "m3x2", "undefined", 3, vshader_m3x2, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0},
|
||||
|
||||
/* Declare registers */
|
||||
{D3DSIO_DCL, "dcl", NULL, 2, vshader_dcl, vshader_hw_dcl, NULL, 0, 0},
|
||||
{D3DSIO_DCL, "dcl", NULL, 2, vshader_dcl, NULL, NULL, 0, 0},
|
||||
|
||||
/* Constant definitions */
|
||||
{D3DSIO_DEF, "def", NULL, 5, vshader_def, shader_hw_def, shader_glsl_def, 0, 0},
|
||||
@ -654,13 +653,7 @@ inline static void vshader_program_add_param(SHADER_OPCODE_ARG *arg, const DWORD
|
||||
|| reg == This->arrayUsageMap[WINED3DSHADERDECLUSAGE_SPECULAR]) {
|
||||
is_color = TRUE;
|
||||
}
|
||||
/* if the attributes come in as named dcl's then use a named vertex (called namedVertexN) */
|
||||
if (This->namedArrays) {
|
||||
sprintf(tmpReg, "namedVertex%lu", reg);
|
||||
} else {
|
||||
/* otherwise the input is on a numbered attribute so use opengl numbered attributes */
|
||||
sprintf(tmpReg, "vertex.attrib[%lu]", reg);
|
||||
}
|
||||
sprintf(tmpReg, "vertex.attrib[%lu]", reg);
|
||||
strcat(hwLine, tmpReg);
|
||||
break;
|
||||
case D3DSPR_CONST:
|
||||
@ -714,7 +707,6 @@ static void vshader_parse_input_decl_usage(IWineD3DVertexShaderImpl *This, INT u
|
||||
if((usage & 0xF0000) >> 16 == 0) { /* tween data */
|
||||
TRACE("Setting position to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_POSITION] = arrayNo;
|
||||
This->namedArrays = TRUE;
|
||||
} else {
|
||||
/* TODO: position indexes go from 0-8!!*/
|
||||
TRACE("Setting position 2 to %d because usage = %d\n", arrayNo, (usage & 0xF0000) >> 16);
|
||||
@ -723,52 +715,43 @@ static void vshader_parse_input_decl_usage(IWineD3DVertexShaderImpl *This, INT u
|
||||
TRACE("Loaded for position %d (greater than 2)\n", (usage & 0xF0000) >> 16);
|
||||
}
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_POSITION2 + ((usage & 0xF0000) >> 16) -1] = arrayNo;
|
||||
This->declaredArrays = TRUE;
|
||||
}
|
||||
break;
|
||||
case D3DDECLUSAGE_BLENDINDICES:
|
||||
/* not supported by openGL */
|
||||
TRACE("Setting BLENDINDICES to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_BLENDINDICES] = arrayNo;
|
||||
This->declaredArrays = TRUE;
|
||||
if ((usage & 0xF0000) >> 16 != 0) FIXME("Extended BLENDINDICES\n");
|
||||
break;
|
||||
case D3DDECLUSAGE_BLENDWEIGHT:
|
||||
TRACE("Setting BLENDWEIGHT to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_BLENDWEIGHT] = arrayNo;
|
||||
This->namedArrays = TRUE;
|
||||
if ((usage & 0xF0000) >> 16 != 0) FIXME("Extended blend weights\n");
|
||||
break;
|
||||
case D3DDECLUSAGE_NORMAL:
|
||||
if((usage & 0xF0000) >> 16 == 0) { /* tween data */
|
||||
TRACE("Setting normal to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_NORMAL] = arrayNo;
|
||||
This->namedArrays = TRUE;
|
||||
} else {
|
||||
TRACE("Setting normal 2 to %d because usage = %d\n", arrayNo, (usage & 0xF0000) >> 16);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_NORMAL2] = arrayNo;
|
||||
This->declaredArrays = TRUE;
|
||||
}
|
||||
break;
|
||||
case D3DDECLUSAGE_PSIZE:
|
||||
TRACE("Setting PSIZE to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_PSIZE] = arrayNo;
|
||||
This->namedArrays = TRUE;
|
||||
if ((usage & 0xF0000) >> 16 != 0) FIXME("Extended PSIZE\n");
|
||||
break;
|
||||
case D3DDECLUSAGE_COLOR:
|
||||
if((usage & 0xF0000) >> 16 == 0) {
|
||||
TRACE("Setting DIFFUSE to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_DIFFUSE] = arrayNo;
|
||||
This->namedArrays = TRUE;
|
||||
} else {
|
||||
TRACE("Setting SPECULAR to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_SPECULAR] = arrayNo;
|
||||
This->namedArrays = TRUE;
|
||||
}
|
||||
break;
|
||||
case D3DDECLUSAGE_TEXCOORD:
|
||||
This->namedArrays = TRUE;
|
||||
/* only 7 texture coords have been designed for, so run a quick sanity check */
|
||||
if ((usage & 0xF0000) >> 16 > 7) {
|
||||
FIXME("(%p) : Program uses texture coordinate %d but only 0-7 have been implemented\n", This, (usage & 0xF0000) >> 16);
|
||||
@ -783,27 +766,22 @@ static void vshader_parse_input_decl_usage(IWineD3DVertexShaderImpl *This, INT u
|
||||
case D3DDECLUSAGE_TANGENT:
|
||||
TRACE("Setting TANGENT to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_TANGENT] = arrayNo;
|
||||
This->declaredArrays = TRUE;
|
||||
break;
|
||||
case D3DDECLUSAGE_BINORMAL:
|
||||
TRACE("Setting BINORMAL to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_BINORMAL] = arrayNo;
|
||||
This->declaredArrays = TRUE;
|
||||
break;
|
||||
case D3DDECLUSAGE_TESSFACTOR:
|
||||
TRACE("Setting TESSFACTOR to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_TESSFACTOR] = arrayNo;
|
||||
This->declaredArrays = TRUE;
|
||||
break;
|
||||
case D3DDECLUSAGE_POSITIONT:
|
||||
if((usage & 0xF0000) >> 16 == 0) { /* tween data */
|
||||
FIXME("Setting positiont to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_POSITIONT] = arrayNo;
|
||||
This->namedArrays = TRUE;
|
||||
} else {
|
||||
FIXME("Setting positiont 2 to %d because usage = %d\n", arrayNo, (usage & 0xF0000) >> 16);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_POSITIONT2] = arrayNo;
|
||||
This->declaredArrays = TRUE;
|
||||
if ((usage & 0xF0000) >> 16 != 0) FIXME("Extended positiont\n");
|
||||
}
|
||||
break;
|
||||
@ -811,17 +789,14 @@ static void vshader_parse_input_decl_usage(IWineD3DVertexShaderImpl *This, INT u
|
||||
/* supported by OpenGL */
|
||||
TRACE("Setting FOG to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_FOG] = arrayNo;
|
||||
This->namedArrays = TRUE;
|
||||
break;
|
||||
case D3DDECLUSAGE_DEPTH:
|
||||
TRACE("Setting DEPTH to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_DEPTH] = arrayNo;
|
||||
This->declaredArrays = TRUE;
|
||||
break;
|
||||
case D3DDECLUSAGE_SAMPLE:
|
||||
TRACE("Setting SAMPLE to %d\n", arrayNo);
|
||||
This->arrayUsageMap[WINED3DSHADERDECLUSAGE_SAMPLE] = arrayNo;
|
||||
This->declaredArrays = TRUE;
|
||||
break;
|
||||
default:
|
||||
FIXME("Unrecognised dcl %08x", usage & 0xFFFF);
|
||||
@ -901,81 +876,6 @@ static void vshader_hw_map2gl(SHADER_OPCODE_ARG* arg) {
|
||||
shader_addline(buffer, "%s;\n", tmpLine);
|
||||
}
|
||||
|
||||
static void vshader_hw_dcl(SHADER_OPCODE_ARG* arg) {
|
||||
|
||||
DWORD dst = arg->dst;
|
||||
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl*) arg->shader;
|
||||
char tmpLine[256];
|
||||
SHADER_BUFFER* buffer = arg->buffer;
|
||||
|
||||
if (This->namedArrays) {
|
||||
const char* attribName = "undefined";
|
||||
switch(dst & 0xFFFF) {
|
||||
case D3DDECLUSAGE_POSITION:
|
||||
attribName = "vertex.position";
|
||||
break;
|
||||
case D3DDECLUSAGE_BLENDINDICES:
|
||||
/* not supported by openGL */
|
||||
attribName = "vertex.blend";
|
||||
break;
|
||||
case D3DDECLUSAGE_BLENDWEIGHT:
|
||||
attribName = "vertex.weight";
|
||||
break;
|
||||
case D3DDECLUSAGE_NORMAL:
|
||||
attribName = "vertex.normal";
|
||||
break;
|
||||
case D3DDECLUSAGE_PSIZE:
|
||||
attribName = "vertex.psize";
|
||||
break;
|
||||
case D3DDECLUSAGE_COLOR:
|
||||
if((dst & 0xF0000) >> 16 == 0) {
|
||||
attribName = "vertex.color";
|
||||
} else {
|
||||
attribName = "vertex.color.secondary";
|
||||
}
|
||||
break;
|
||||
case D3DDECLUSAGE_TEXCOORD:
|
||||
{
|
||||
char tmpChar[100];
|
||||
tmpChar[0] = 0;
|
||||
sprintf(tmpChar,"vertex.texcoord[%lu]",(dst & 0xF0000) >> 16);
|
||||
attribName = tmpChar;
|
||||
break;
|
||||
}
|
||||
/* The following aren't directly supported by openGL, so shouldn't come up using namedarrays. */
|
||||
case D3DDECLUSAGE_TANGENT:
|
||||
attribName = "vertex.tangent";
|
||||
break;
|
||||
case D3DDECLUSAGE_BINORMAL:
|
||||
attribName = "vertex.binormal";
|
||||
break;
|
||||
case D3DDECLUSAGE_TESSFACTOR:
|
||||
attribName = "vertex.tessfactor";
|
||||
break;
|
||||
case D3DDECLUSAGE_POSITIONT:
|
||||
attribName = "vertex.possitionT";
|
||||
break;
|
||||
case D3DDECLUSAGE_FOG:
|
||||
attribName = "vertex.fogcoord";
|
||||
break;
|
||||
case D3DDECLUSAGE_DEPTH:
|
||||
attribName = "vertex.depth";
|
||||
break;
|
||||
case D3DDECLUSAGE_SAMPLE:
|
||||
attribName = "vertex.sample";
|
||||
break;
|
||||
default:
|
||||
FIXME("Unrecognised dcl %08lx", dst & 0xFFFF);
|
||||
}
|
||||
{
|
||||
sprintf(tmpLine, "ATTRIB ");
|
||||
vshader_program_add_param(arg, dst, FALSE, tmpLine);
|
||||
if (This->namedArrays)
|
||||
shader_addline(buffer, "%s = %s;\n", tmpLine, attribName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Handles transforming all D3DSIO_M?x? opcodes for
|
||||
Vertex shaders to ARB_vertex_program codes */
|
||||
static void vshader_hw_mnxn(SHADER_OPCODE_ARG* arg) {
|
||||
@ -1509,8 +1409,6 @@ static HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader
|
||||
TRACE("(%p) : Parsing programme\n", This);
|
||||
|
||||
/* Initialise vertex input arrays */
|
||||
This->namedArrays = FALSE;
|
||||
This->declaredArrays = FALSE;
|
||||
for (i = 0; i < WINED3DSHADERDECLUSAGE_MAX_USAGE; i++)
|
||||
This->arrayUsageMap[i] = -1;
|
||||
|
||||
@ -1644,22 +1542,9 @@ static HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader
|
||||
This->baseShader.functionLength = 1; /* no Function defined use fixed function vertex processing */
|
||||
}
|
||||
|
||||
/* Handy for debugging using numbered arrays instead of named arrays */
|
||||
#if 1
|
||||
/* TODO: using numbered arrays for software shaders makes things easier */
|
||||
This->declaredArrays = TRUE;
|
||||
#endif
|
||||
|
||||
/* named arrays and declared arrays are mutually exclusive */
|
||||
if (This->declaredArrays)
|
||||
This->namedArrays = FALSE;
|
||||
|
||||
/* Generate HW shader in needed */
|
||||
if (NULL != pFunction && wined3d_settings.vs_mode == VS_HW) {
|
||||
#if 1
|
||||
if (NULL != pFunction && wined3d_settings.vs_mode == VS_HW)
|
||||
IWineD3DVertexShaderImpl_GenerateShader(iface, pFunction);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* copy the function ... because it will certainly be released by application */
|
||||
if (NULL != pFunction) {
|
||||
|
@ -1432,10 +1432,8 @@ typedef struct IWineD3DVertexShaderImpl {
|
||||
DWORD usage;
|
||||
|
||||
/* vertex declaration array mapping */
|
||||
BOOL namedArrays; /* don't map use named functions */
|
||||
BOOL declaredArrays; /* mapping requires */
|
||||
INT arrayUsageMap[WINED3DSHADERDECLUSAGE_MAX_USAGE]; /* lookup table for the maps */
|
||||
|
||||
INT arrayUsageMap[WINED3DSHADERDECLUSAGE_MAX_USAGE];
|
||||
|
||||
/* run time datas... */
|
||||
VSHADERDATA *data;
|
||||
IWineD3DVertexDeclaration *vertexDeclaration;
|
||||
|
Loading…
Reference in New Issue
Block a user