wined3d: Implement shader stencil export for GL.
This commit is contained in:
parent
0ef730529a
commit
5efd4b64f6
6 changed files with 24 additions and 1 deletions
|
@ -115,6 +115,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
|
|||
{"GL_ARB_shader_bit_encoding", ARB_SHADER_BIT_ENCODING },
|
||||
{"GL_ARB_shader_image_load_store", ARB_SHADER_IMAGE_LOAD_STORE },
|
||||
{"GL_ARB_shader_image_size", ARB_SHADER_IMAGE_SIZE },
|
||||
{"GL_ARB_shader_stencil_export", ARB_SHADER_STENCIL_EXPORT },
|
||||
{"GL_ARB_shader_storage_buffer_object", ARB_SHADER_STORAGE_BUFFER_OBJECT},
|
||||
{"GL_ARB_shader_texture_image_samples", ARB_SHADER_TEXTURE_IMAGE_SAMPLES},
|
||||
{"GL_ARB_shader_texture_lod", ARB_SHADER_TEXTURE_LOD },
|
||||
|
|
|
@ -3052,6 +3052,10 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
|
|||
string_buffer_sprintf(register_name, "sample_mask");
|
||||
break;
|
||||
|
||||
case WINED3DSPR_STENCILREF:
|
||||
string_buffer_sprintf(register_name, "stencil_ref");
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unhandled register type %#x.\n", reg->type);
|
||||
string_buffer_sprintf(register_name, "unrecognised_register");
|
||||
|
@ -7554,6 +7558,8 @@ static void shader_glsl_enable_extensions(struct wined3d_string_buffer *buffer,
|
|||
shader_addline(buffer, "#extension GL_ARB_shader_image_load_store : enable\n");
|
||||
if (gl_info->supported[ARB_SHADER_IMAGE_SIZE])
|
||||
shader_addline(buffer, "#extension GL_ARB_shader_image_size : enable\n");
|
||||
if (gl_info->supported[ARB_SHADER_STENCIL_EXPORT])
|
||||
shader_addline(buffer, "#extension GL_ARB_shader_stencil_export : enable\n");
|
||||
if (gl_info->supported[ARB_SHADER_STORAGE_BUFFER_OBJECT])
|
||||
shader_addline(buffer, "#extension GL_ARB_shader_storage_buffer_object : enable\n");
|
||||
if (gl_info->supported[ARB_SHADER_TEXTURE_IMAGE_SAMPLES])
|
||||
|
@ -7653,6 +7659,9 @@ static void shader_glsl_generate_ps_epilogue(const struct wined3d_gl_info *gl_in
|
|||
if (reg_maps->sample_mask)
|
||||
shader_addline(buffer, "gl_SampleMask[0] = floatBitsToInt(sample_mask);\n");
|
||||
|
||||
if (reg_maps->stencil_ref)
|
||||
shader_addline(buffer, "gl_FragStencilRefARB = floatBitsToInt(stencil_ref);\n");
|
||||
|
||||
if (!use_legacy_fragment_output(gl_info))
|
||||
shader_glsl_generate_color_output(buffer, gl_info, shader, args, string_buffers);
|
||||
}
|
||||
|
@ -7899,6 +7908,9 @@ static GLuint shader_glsl_generate_fragment_shader(const struct wined3d_context_
|
|||
if (reg_maps->sample_mask)
|
||||
shader_addline(buffer, "float sample_mask = uintBitsToFloat(0xffffffffu);\n");
|
||||
|
||||
if (reg_maps->stencil_ref)
|
||||
shader_addline(buffer, "float stencil_ref = 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
|
||||
|
|
|
@ -758,6 +758,10 @@ static BOOL shader_record_register_usage(struct wined3d_shader *shader, struct w
|
|||
reg_maps->sample_mask = 1;
|
||||
break;
|
||||
|
||||
case WINED3DSPR_STENCILREF:
|
||||
reg_maps->stencil_ref = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
TRACE("Not recording register of type %#x and [%#x][%#x].\n",
|
||||
reg->type, reg->idx[0].offset, reg->idx[1].offset);
|
||||
|
|
|
@ -357,6 +357,7 @@ enum wined3d_sm4_register_type
|
|||
WINED3D_SM5_RT_GS_INSTANCE_ID = 0x25,
|
||||
WINED3D_SM5_RT_DEPTHOUT_GREATER_EQUAL = 0x26,
|
||||
WINED3D_SM5_RT_DEPTHOUT_LESS_EQUAL = 0x27,
|
||||
WINED3D_SM5_RT_OUTPUT_STENCIL_REF = 0x29,
|
||||
};
|
||||
|
||||
enum wined3d_sm4_output_primitive_type
|
||||
|
@ -1184,6 +1185,8 @@ static const enum wined3d_shader_register_type register_type_table[] =
|
|||
/* WINED3D_SM5_RT_GS_INSTANCE_ID */ WINED3DSPR_GSINSTID,
|
||||
/* WINED3D_SM5_RT_DEPTHOUT_GREATER_EQUAL */ WINED3DSPR_DEPTHOUTGE,
|
||||
/* WINED3D_SM5_RT_DEPTHOUT_LESS_EQUAL */ WINED3DSPR_DEPTHOUTLE,
|
||||
/* UNKNOWN */ ~0u,
|
||||
/* WINED3D_SM5_RT_OUTPUT_STENCIL_REF */ WINED3DSPR_STENCILREF,
|
||||
};
|
||||
|
||||
static const struct wined3d_sm4_opcode_info *get_opcode_info(enum wined3d_sm4_opcode opcode)
|
||||
|
|
|
@ -110,6 +110,7 @@ enum wined3d_gl_extension
|
|||
ARB_SHADER_BIT_ENCODING,
|
||||
ARB_SHADER_IMAGE_LOAD_STORE,
|
||||
ARB_SHADER_IMAGE_SIZE,
|
||||
ARB_SHADER_STENCIL_EXPORT,
|
||||
ARB_SHADER_STORAGE_BUFFER_OBJECT,
|
||||
ARB_SHADER_TEXTURE_IMAGE_SAMPLES,
|
||||
ARB_SHADER_TEXTURE_LOD,
|
||||
|
|
|
@ -582,6 +582,7 @@ enum wined3d_shader_register_type
|
|||
WINED3DSPR_DEPTHOUTGE,
|
||||
WINED3DSPR_DEPTHOUTLE,
|
||||
WINED3DSPR_RASTERIZER,
|
||||
WINED3DSPR_STENCILREF,
|
||||
};
|
||||
|
||||
enum wined3d_data_type
|
||||
|
@ -1156,7 +1157,7 @@ struct wined3d_shader_reg_maps
|
|||
DWORD input_rel_addressing : 1;
|
||||
DWORD viewport_array : 1;
|
||||
DWORD sample_mask : 1;
|
||||
DWORD padding : 14;
|
||||
DWORD stencil_ref : 1;
|
||||
|
||||
DWORD rt_mask; /* Used render targets, 32 max. */
|
||||
|
||||
|
@ -4336,6 +4337,7 @@ static inline BOOL shader_is_scalar(const struct wined3d_shader_register *reg)
|
|||
case WINED3DSPR_PRIMID: /* primID */
|
||||
case WINED3DSPR_COVERAGE: /* vCoverage */
|
||||
case WINED3DSPR_SAMPLEMASK: /* oMask */
|
||||
case WINED3DSPR_STENCILREF: /* oStencilRef */
|
||||
return TRUE;
|
||||
|
||||
case WINED3DSPR_MISCTYPE:
|
||||
|
|
Loading…
Add table
Reference in a new issue