wined3d: simplify GLSL checking in baseshader.c
Jason Green
jave27 at gmail.com
Wed May 17 23:51:59 CDT 2006
Reduce some of the redundant GLSL checks in baseshader.c.
This will make it easier to switch to the registry check method
if/when Phil Costin & Brian Hill's patches get applied. If they are
rejected for some reason, this will still simplify the function a bit.
-------------- next part --------------
diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c
index 1af6a71..10def6a 100644
--- a/dlls/wined3d/baseshader.c
+++ b/dlls/wined3d/baseshader.c
@@ -522,6 +522,7 @@ void generate_base_shader(
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
const DWORD *pToken = pFunction;
const SHADER_OPCODE *curOpcode = NULL;
+ SHADER_HANDLER hw_fct = NULL;
DWORD opcode_token;
DWORD i;
@@ -539,10 +540,12 @@ void generate_base_shader(
*/
/* Pre-declare registers */
- if (USING_GLSL)
+ if (USING_GLSL) {
generate_glsl_declarations(iface, buffer);
- else
+ shader_addline(buffer, "void main() {\n");
+ } else {
generate_arb_declarations(iface, buffer);
+ }
/* Second pass, process opcodes */
if (NULL != pToken) {
@@ -566,28 +569,15 @@ void generate_base_shader(
/* Read opcode */
opcode_token = *pToken++;
curOpcode = shader_get_opcode(iface, opcode_token);
+ hw_fct = USING_GLSL ? curOpcode->hw_glsl_fct : curOpcode->hw_fct;
/* Unknown opcode and its parameters */
if (NULL == curOpcode) {
FIXME("Unrecognized opcode: token=%08lX\n", opcode_token);
pToken += shader_skip_unrecognized(iface, pToken);
- /* Using GLSL & no generator function exists */
- } else if (USING_GLSL && curOpcode->hw_glsl_fct == NULL) {
-
- FIXME("Token %s is not yet implemented with GLSL\n", curOpcode->name);
- pToken += shader_skip_opcode(This, curOpcode, opcode_token);
-
- /* Unhandled opcode in ARB */
- } else if ( !USING_GLSL && GLNAME_REQUIRE_GLSL == curOpcode->glname) {
-
- FIXME("Token %s requires greater functionality than "
- "Vertex or Fragment_Program_ARB supports\n", curOpcode->name);
- pToken += shader_skip_opcode(This, curOpcode, opcode_token);
-
/* If a generator function is set for current shader target, use it */
- } else if ((!USING_GLSL && curOpcode->hw_fct != NULL) ||
- (USING_GLSL && curOpcode->hw_glsl_fct != NULL)) {
+ } else if (hw_fct != NULL) {
SHADER_OPCODE_ARG hw_arg;
@@ -624,10 +614,7 @@ void generate_base_shader(
}
/* Call appropriate function for output target */
- if (USING_GLSL)
- curOpcode->hw_glsl_fct(&hw_arg);
- else
- curOpcode->hw_fct(&hw_arg);
+ hw_fct(&hw_arg);
} else {
More information about the wine-patches
mailing list