I'm not Henri but I can mention a number of issues (which might or
might not match with Henri's).

+    for (stage = 0; stage < MAX_TEXTURES && settings->op[stage].cop
!= WINED3D_TOP_DISABLE; ++stage)

You probably want to generate this code only for texture stages
actually using constants.
Yes. I was thinking about that first but chose the easiest way. Will fix.

+    {
+        float constant[4];
+
+        constant[0] = ((settings->op[stage].constant >> 16) & 0xff) / 255.0f;
+        constant[1] = ((settings->op[stage].constant >> 8)  & 0xff) / 255.0f;
+        constant[2] = ( settings->op[stage].constant        & 0xff) / 255.0f;
+        constant[3] = ((settings->op[stage].constant >> 24) & 0xff) / 255.0f;

No need to open code it, the macro D3DCOLORTOGLFLOAT4 does just that.
Ok. I will sue it.

+
+        shader_addline(buffer, "const vec4 const%d = ", stage);
+        shader_glsl_append_imm_vec4(
buffer, constant);
+        shader_addline(buffer, ";\n");

I assume it would be better to make these proper uniforms and update
their value in shader_glsl_load_constants() instead.
I was wondering when the shader was regenerated and how changing constant would affect it.
Indeed this seems more correct.
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 5b7fb3c..083a0d7 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -3312,6 +3312,8 @@ void gen_ffp_frag_op(const struct
wined3d_context *context, const struct wined3d
          settings->op[i].aarg1 = aarg1;
          settings->op[i].aarg2 = aarg2;

+        settings->op[i].constant = state->texture_states[i][
WINED3D_TSS_CONSTANT];
+
          if (state->texture_states[i][WINED3D_TSS_RESULT_ARG] == 
WINED3DTA_TEMP)
              settings->op[i].dst = tempreg;
          else
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index dca0d61..c1d6c91 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1673,6 +1673,8 @@ struct texture_stage_op
      unsigned                aarg2 : 8;
      unsigned                aarg0 : 8;

+    DWORD                   constant;
+
      struct color_fixup_desc color_fixup;
      unsigned                tex_type : 3;
      unsigned                dst : 1;

You don't need this if you use uniforms.
Yes indeed.
Also adding a test would be nice probably.
I will try to do so if it's not too hard altough I guess there're probably some template I can reuse in the existing tests.
That said, maybe Henri already has a patch for it.

If Henri or Stefan have already a patch for it or plan to fix it once Wine 1.6 is released I can drop my patch otherwise I don't mind fix it to do things the right way.

Thanks for you feedback
Christian


Reply via email to