Commit 806aaa12 authored by Jason Green's avatar Jason Green Committed by Alexandre Julliard

wined3d: Added more declarations to GLSL.

- Declare more variable names for GLSL programs. - Some of these won't need to be declared eventually, but it doesn't hurt to do it for now. - Correct output name for pixel shaders (gl_FragColor instead of glFragColor).
parent ca70d13a
...@@ -575,16 +575,21 @@ void generate_glsl_declarations( ...@@ -575,16 +575,21 @@ void generate_glsl_declarations(
/* Declare the constants (aka uniforms) */ /* Declare the constants (aka uniforms) */
shader_addline(buffer, "uniform vec4 C[%u];\n", This->baseShader.limits.constant_float); shader_addline(buffer, "uniform vec4 C[%u];\n", This->baseShader.limits.constant_float);
/* Declare texture samplers
* TODO: Make this work for textures other than 2D */
for (i = 0; i < This->baseShader.limits.texture; i++) {
shader_addline(buffer, "uniform sampler2D mytex%lu;\n", i);
}
/* Declare address variables */ /* Declare address variables */
for (i = 0; i < This->baseShader.limits.address; i++) { for (i = 0; i < This->baseShader.limits.address; i++) {
if (reg_maps->address & (1 << i)) if (reg_maps->address & (1 << i))
shader_addline(buffer, "ivec4 A%ld;\n", i); shader_addline(buffer, "ivec4 A%ld;\n", i);
} }
/* Declare all named attributes (TODO: Add this to the reg_maps /* Declare texture temporaries */
* and only declare those that are needed) */ for (i = 0; i < This->baseShader.limits.texture; i++) {
for (i = 0; i < This->baseShader.limits.attributes; i++) { shader_addline(buffer, "vec4 T%lu = gl_TexCoord[%lu];\n", i, i);
shader_addline(buffer, "attribute vec4 attrib%i;\n", i);
} }
/* Declare temporary variables */ /* Declare temporary variables */
...@@ -593,6 +598,16 @@ void generate_glsl_declarations( ...@@ -593,6 +598,16 @@ void generate_glsl_declarations(
shader_addline(buffer, "vec4 R%lu;\n", i); shader_addline(buffer, "vec4 R%lu;\n", i);
} }
/* Declare all named attributes (TODO: Add this to the reg_maps
* and only declare those that are needed) */
for (i = 0; i < This->baseShader.limits.attributes; i++) {
shader_addline(buffer, "attribute vec4 attrib%i;\n", i);
}
/* Temporary variables for matrix operations */
shader_addline(buffer, "vec4 tmp0;\n");
shader_addline(buffer, "vec4 tmp1;\n");
/* Start the main program */ /* Start the main program */
shader_addline(buffer, "void main() {\n"); shader_addline(buffer, "void main() {\n");
} }
......
...@@ -1290,7 +1290,7 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateShader( ...@@ -1290,7 +1290,7 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateShader(
/* Pixel shaders < 2.0 place the resulting color in R0 implicitly */ /* Pixel shaders < 2.0 place the resulting color in R0 implicitly */
if (This->baseShader.hex_version < D3DPS_VERSION(2,0)) if (This->baseShader.hex_version < D3DPS_VERSION(2,0))
shader_addline(&buffer, "glFragColor = R0;\n"); shader_addline(&buffer, "gl_FragColor = R0;\n");
shader_addline(&buffer, "}\n\0"); shader_addline(&buffer, "}\n\0");
TRACE("Compiling shader object %u\n", shader_obj); TRACE("Compiling shader object %u\n", shader_obj);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment