From 18de08ab2090d87ae9a313362fa254c350e5c730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Sat, 12 May 2018 09:29:10 +1000 Subject: [PATCH] wined3d: Implement oMask --- 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 c79fbb5f4fc..e250f34b89a 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -2955,6 +2955,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"); @@ -7268,6 +7272,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. */ @@ -7476,6 +7483,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 624dc55e900..da7b8134add 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 f8f4bd59149..bb2a1068087 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1043,7 +1043,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. */ @@ -4143,13 +4144,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: return TRUE; case WINED3DSPR_MISCTYPE: -- 2.17.0