[PATCH 3/5] wined3d: GL_NV_vertex_program2_option supports relative offsets > 63.

Stefan Dösinger stefan at codeweavers.com
Thu Jan 9 06:43:22 CST 2014


The ARR codepath used if ctx->target_version >= NV2 does not account for
the correction offset, but the indirect addressing reads do, which
ultimately results in incorrect offsets. Since the limitation goes away
as soon as we enable GL_NV_vertex_program_2_option ignoring the offset
is the best thing to do. I don't set shader_data->rel_offset to zero in
the pre-compilation analysis because enablding NV_vertex_program2 is in
theory a decision that is taken later during code generation.

GL_NV_vertex_program2_option does not explicitly lift this restriction,
but GL_NV_vertex_program2 defines vp2-progParamPosOff ranged from 0 to
255 and a negative counterpart ranged from 0 to 256. Apple's OpenGL
implementation is the only one that enforces the original ARBvp
restriction and implements NV_vertex_program*_option, and it agrees with
this interpretation of the spec.
---
 dlls/wined3d/arb_program_shader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 23ca809..106cc7d 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -1119,7 +1119,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction
             if (!pshader && reg->idx[0].rel_addr)
             {
                 const struct arb_vshader_private *shader_data = shader->backend_data;
-                UINT rel_offset = shader_data->rel_offset;
+                UINT rel_offset = ctx->target_version == ARB ? shader_data->rel_offset : 0;
                 BOOL aL = FALSE;
                 char rel_reg[50];
                 if (reg_maps->shader_version.major < 2)
@@ -1849,7 +1849,7 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins)
         const struct arb_vshader_private *shader_data = shader->backend_data;
         src0_param[0] = '\0';
 
-        if (shader_data->rel_offset)
+        if (shader_data->rel_offset && ctx->target_version == ARB)
         {
             const char *offset = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_VS_REL_OFFSET);
             shader_arb_get_src_param(ins, &ins->src[0], 0, src0_param);
-- 
1.8.3.2




More information about the wine-patches mailing list