Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/glsl_shader.c | 10 ++++++++++ dlls/wined3d/shader.c | 4 ++++ dlls/wined3d/wined3d_private.h | 6 ++++-- 3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index da7e70071d19..6f23cf8a4034 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -3242,6 +3242,10 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * sprintf(register_name, "vpc[%u]", reg->idx[0].offset); break;
+ case WINED3DSPR_SAMPLEMASK: + sprintf(register_name, "sample_mask"); + break; + default: FIXME("Unhandled register type %#x.\n", reg->type); sprintf(register_name, "unrecognized_register"); @@ -7627,6 +7631,9 @@ static void shader_glsl_generate_ps_epilogue(const struct wined3d_gl_info *gl_in shader_glsl_generate_fog_code(buffer, gl_info, args->fog);
shader_glsl_generate_alpha_test(buffer, gl_info, args->alpha_test_func + 1); + + if (reg_maps->sample_mask) + shader_addline(buffer, "gl_SampleMask[0] = floatBitsToInt(sample_mask);\n"); }
/* Context activation is done by the caller. */ @@ -7822,6 +7829,9 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
shader_addline(buffer, "void main()\n{\n");
+ if (reg_maps->sample_mask) + shader_addline(buffer, "float sample_mask = uintBitsToFloat(0xffffffffu);\n"); + /* Direct3D applications expect integer vPos values, while OpenGL drivers * add approximately 0.5. This causes off-by-one problems as spotted by * the vPos d3d9 visual test. Unfortunately ATI cards do not add exactly diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 45ae04a9bec9..3a0a3022172f 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -810,6 +810,10 @@ static BOOL shader_record_register_usage(struct wined3d_shader *shader, struct w reg_maps->vocp = 1; break;
+ case WINED3DSPR_SAMPLEMASK: + reg_maps->sample_mask = 1; + break; + default: TRACE("Not recording register of type %#x and [%#x][%#x].\n", reg->type, reg->idx[0].offset, reg->idx[1].offset); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index b2e4372e9ae5..f40d1639496b 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1040,7 +1040,8 @@ struct wined3d_shader_reg_maps DWORD vocp : 1; DWORD input_rel_addressing : 1; DWORD viewport_array : 1; - DWORD padding : 15; + DWORD sample_mask : 1; + DWORD padding : 14;
DWORD rt_mask; /* Used render targets, 32 max. */
@@ -4115,13 +4116,14 @@ static inline BOOL shader_is_scalar(const struct wined3d_shader_register *reg) /* oPos */ return FALSE;
+ case WINED3DSPR_CONSTBOOL: /* b# */ case WINED3DSPR_DEPTHOUT: /* oDepth */ case WINED3DSPR_DEPTHOUTGE: case WINED3DSPR_DEPTHOUTLE: - case WINED3DSPR_CONSTBOOL: /* b# */ case WINED3DSPR_LOOP: /* aL */ case WINED3DSPR_PREDICATE: /* p0 */ case WINED3DSPR_PRIMID: /* primID */ + case WINED3DSPR_SAMPLEMASK: /* oMask */ return TRUE;
case WINED3DSPR_MISCTYPE: