On 2 October 2015 at 14:54, Matteo Bruni mbruni@codeweavers.com wrote:
@@ -4998,7 +4996,22 @@ static GLuint generate_param_reorder_function(struct shader_glsl_priv *priv, output->register_idx, reg_mask[1]); } }
shader_addline(buffer, "}\n");
for (i = 0; i < MAX_TEXTURES; ++i)
{
if (ps && !(ps->reg_maps.texcoord & (1u << i)))
continue;
if (texcoords_written_mask[i] != WINED3DSP_WRITEMASK_ALL)
{
if (gl_info->limits.glsl_varyings < wined3d_max_compat_varyings(gl_info)
&& !texcoords_written_mask[i])
continue;
shader_glsl_write_mask_to_str(~texcoords_written_mask[i] & WINED3DSP_WRITEMASK_ALL, reg_mask);
shader_addline(buffer, "gl_TexCoord[%u]%s = vec4(0.0)%s;\n", i, reg_mask, reg_mask);
}
} else {}
Doesn't this end up writing 0.0 to .w instead of 1.0? IIRC unwritten texture coordinates are assumed to be (0, 0, 0, 1) in D3D. May apply to the previous patch in the series as well.
2015-10-05 11:49 GMT+02:00 Henri Verbeet hverbeet@gmail.com:
On 2 October 2015 at 14:54, Matteo Bruni mbruni@codeweavers.com wrote:
@@ -4998,7 +4996,22 @@ static GLuint generate_param_reorder_function(struct shader_glsl_priv *priv, output->register_idx, reg_mask[1]); } }
shader_addline(buffer, "}\n");
for (i = 0; i < MAX_TEXTURES; ++i)
{
if (ps && !(ps->reg_maps.texcoord & (1u << i)))
continue;
if (texcoords_written_mask[i] != WINED3DSP_WRITEMASK_ALL)
{
if (gl_info->limits.glsl_varyings < wined3d_max_compat_varyings(gl_info)
&& !texcoords_written_mask[i])
continue;
shader_glsl_write_mask_to_str(~texcoords_written_mask[i] & WINED3DSP_WRITEMASK_ALL, reg_mask);
shader_addline(buffer, "gl_TexCoord[%u]%s = vec4(0.0)%s;\n", i, reg_mask, reg_mask);
}
} else {}
Doesn't this end up writing 0.0 to .w instead of 1.0? IIRC unwritten texture coordinates are assumed to be (0, 0, 0, 1) in D3D. May apply to the previous patch in the series as well.
My test (which is still a few patches ahead in the series but I can send you somewhere) shows that on Nvidia the texture coordinate defaults to (0, 0, 0, 0), while on AMD it defaults to (0, 0, 0, 1), so the value of the .w component probably doesn't matter much. Assuming the test is correct, of course...
On 5 October 2015 at 12:39, Matteo Bruni matteo.mystral@gmail.com wrote:
My test (which is still a few patches ahead in the series but I can send you somewhere) shows that on Nvidia the texture coordinate defaults to (0, 0, 0, 0), while on AMD it defaults to (0, 0, 0, 1), so the value of the .w component probably doesn't matter much. Assuming the test is correct, of course...
Does that include partially written coordinates? I'm fairly sure there were applications that cared about this. It may have been Half-Life 2 (which is probably totally different today) or some other Source Engine game. Maybe Stefan remembers. I suppose we could also just try if anything breaks if we change it, although in that case we could get rid of WINED3D_QUIRK_SET_TEXCOORD_W as well.
2015-10-05 13:01 GMT+02:00 Henri Verbeet hverbeet@gmail.com:
On 5 October 2015 at 12:39, Matteo Bruni matteo.mystral@gmail.com wrote:
My test (which is still a few patches ahead in the series but I can send you somewhere) shows that on Nvidia the texture coordinate defaults to (0, 0, 0, 0), while on AMD it defaults to (0, 0, 0, 1), so the value of the .w component probably doesn't matter much. Assuming the test is correct, of course...
Does that include partially written coordinates? I'm fairly sure there were applications that cared about this. It may have been Half-Life 2 (which is probably totally different today) or some other Source Engine game. Maybe Stefan remembers. I suppose we could also just try if anything breaks if we change it, although in that case we could get rid of WINED3D_QUIRK_SET_TEXCOORD_W as well.
Yes, same with partially written coordinates. I've kept the quirk around for the time being because it's still used in the ARB backend, although I guess I could update that.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Am 2015-10-05 um 13:01 schrieb Henri Verbeet:
Does that include partially written coordinates? I'm fairly sure there were applications that cared about this. It may have been Half-Life 2 (which is probably totally different today) or some other Source Engine game. Maybe Stefan remembers. I suppose we could also just try if anything breaks if we change it, although in that case we could get rid of WINED3D_QUIRK_SET_TEXCOORD_W as well.
That problem was about the fixed function pipeline. A vertex shader wrote a partial texcoord, and fixed fucntion fragment processing was used. Normally GL always divides by .w, so it caused problems. ARBfp, GLSL and ATIfs can disable the .w divide, so the undefined content in .w doesn't matter.