wined3d: Do not rely on num_params to skip unhandled tokens in shaders 2.0.
This commit is contained in:
parent
d4dd9869b8
commit
53d240a3e0
|
@ -85,6 +85,20 @@ const SHADER_OPCODE* shader_get_opcode(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return the number of parameters to skip for an opcode */
|
||||||
|
static inline int shader_skip_opcode(
|
||||||
|
IWineD3DBaseShaderImpl* This,
|
||||||
|
const SHADER_OPCODE* curOpcode,
|
||||||
|
DWORD opcode_token) {
|
||||||
|
|
||||||
|
/* Shaders >= 2.0 may contain address tokens, but fortunately they
|
||||||
|
* have a useful legnth mask - use it here. Shaders 1.0 contain no such tokens */
|
||||||
|
|
||||||
|
return (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2)?
|
||||||
|
((opcode_token & D3DSI_INSTLENGTH_MASK) >> D3DSI_INSTLENGTH_SHIFT):
|
||||||
|
curOpcode->num_params;
|
||||||
|
}
|
||||||
|
|
||||||
/* Note: For vertex shaders,
|
/* Note: For vertex shaders,
|
||||||
* texUsed = addrUsed, and
|
* texUsed = addrUsed, and
|
||||||
* D3DSPR_TEXTURE = D3DSPR_ADDR.
|
* D3DSPR_TEXTURE = D3DSPR_ADDR.
|
||||||
|
@ -424,6 +438,7 @@ void generate_base_shader(
|
||||||
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
||||||
const DWORD *pToken = pFunction;
|
const DWORD *pToken = pFunction;
|
||||||
const SHADER_OPCODE *curOpcode = NULL;
|
const SHADER_OPCODE *curOpcode = NULL;
|
||||||
|
DWORD opcode_token;
|
||||||
DWORD i;
|
DWORD i;
|
||||||
|
|
||||||
/* Initialize current parsing state */
|
/* Initialize current parsing state */
|
||||||
|
@ -465,8 +480,8 @@ void generate_base_shader(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read opcode */
|
/* Read opcode */
|
||||||
curOpcode = shader_get_opcode(iface, *pToken);
|
opcode_token = *pToken++;
|
||||||
++pToken;
|
curOpcode = shader_get_opcode(iface, opcode_token);
|
||||||
|
|
||||||
/* Unknown opcode and its parameters */
|
/* Unknown opcode and its parameters */
|
||||||
if (NULL == curOpcode) {
|
if (NULL == curOpcode) {
|
||||||
|
@ -479,14 +494,14 @@ void generate_base_shader(
|
||||||
} else if (USING_GLSL && curOpcode->hw_glsl_fct == NULL) {
|
} else if (USING_GLSL && curOpcode->hw_glsl_fct == NULL) {
|
||||||
|
|
||||||
FIXME("Token %s is not yet implemented with GLSL\n", curOpcode->name);
|
FIXME("Token %s is not yet implemented with GLSL\n", curOpcode->name);
|
||||||
pToken += curOpcode->num_params;
|
pToken += shader_skip_opcode(This, curOpcode, opcode_token);
|
||||||
|
|
||||||
/* Unhandled opcode in ARB */
|
/* Unhandled opcode in ARB */
|
||||||
} else if ( !USING_GLSL && GLNAME_REQUIRE_GLSL == curOpcode->glname) {
|
} else if ( !USING_GLSL && GLNAME_REQUIRE_GLSL == curOpcode->glname) {
|
||||||
|
|
||||||
FIXME("Token %s requires greater functionality than "
|
FIXME("Token %s requires greater functionality than "
|
||||||
"Vertex or Fragment_Program_ARB supports\n", curOpcode->name);
|
"Vertex or Fragment_Program_ARB supports\n", curOpcode->name);
|
||||||
pToken += curOpcode->num_params;
|
pToken += shader_skip_opcode(This, curOpcode, opcode_token);
|
||||||
|
|
||||||
/* If a generator function is set for current shader target, use it */
|
/* If a generator function is set for current shader target, use it */
|
||||||
} else if ((!USING_GLSL && curOpcode->hw_fct != NULL) ||
|
} else if ((!USING_GLSL && curOpcode->hw_fct != NULL) ||
|
||||||
|
@ -515,13 +530,10 @@ void generate_base_shader(
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
TRACE("Found opcode D3D:%s GL:%s, PARAMS:%d,\n",
|
|
||||||
curOpcode->name, curOpcode->glname, curOpcode->num_params);
|
|
||||||
|
|
||||||
/* Unless we encounter a no-op command, this opcode is unrecognized */
|
/* Unless we encounter a no-op command, this opcode is unrecognized */
|
||||||
if (curOpcode->opcode != D3DSIO_NOP) {
|
if (curOpcode->opcode != D3DSIO_NOP) {
|
||||||
FIXME("Can't handle opcode %s in hwShader\n", curOpcode->name);
|
FIXME("Can't handle opcode %s in hwShader\n", curOpcode->name);
|
||||||
pToken += curOpcode->num_params;
|
pToken += shader_skip_opcode(This, curOpcode, opcode_token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue