wined3d: Implement forceEarlyDepthStencil shader global flag.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-07-24 00:15:55 +02:00 committed by Alexandre Julliard
parent e7f30014c3
commit a6d26527c6
3 changed files with 29 additions and 0 deletions

View File

@ -7393,6 +7393,9 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
if (shader->limits->constant_float + extra_constants_needed >= gl_info->limits.glsl_ps_float_constants)
FIXME("Insufficient uniforms to run this shader.\n");
if (shader->u.ps.force_early_depth_stencil)
shader_addline(buffer, "layout(early_fragment_tests) in;\n");
shader_addline(buffer, "void main()\n{\n");
/* Direct3D applications expect integer vPos values, while OpenGL drivers

View File

@ -1085,6 +1085,21 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
else
reg_maps->cb_sizes[reg->idx[0].offset] = reg->idx[1].offset;
}
else if (ins.handler_idx == WINED3DSIH_DCL_GLOBAL_FLAGS)
{
if (ins.flags & WINED3DSGF_FORCE_EARLY_DEPTH_STENCIL)
{
if (shader_version.type == WINED3D_SHADER_TYPE_PIXEL)
shader->u.ps.force_early_depth_stencil = TRUE;
else
FIXME("Invalid instruction %#x for shader type %#x.\n",
ins.handler_idx, shader_version.type);
}
else
{
WARN("Ignoring global flags %#x.\n", ins.flags);
}
}
else if (ins.handler_idx == WINED3DSIH_DCL_GS_INSTANCES)
{
if (shader_version.type == WINED3D_SHADER_TYPE_GEOMETRY)
@ -1760,6 +1775,14 @@ static void shader_dump_global_flags(struct wined3d_string_buffer *buffer, DWORD
shader_addline(buffer, " | ");
}
if (global_flags & WINED3DSGF_FORCE_EARLY_DEPTH_STENCIL)
{
shader_addline(buffer, "forceEarlyDepthStencil");
global_flags &= ~WINED3DSGF_FORCE_EARLY_DEPTH_STENCIL;
if (global_flags)
shader_addline(buffer, " | ");
}
if (global_flags & WINED3DSGF_ENABLE_RAW_AND_STRUCTURED_BUFFERS)
{
shader_addline(buffer, "enableRawAndStructuredBuffers");

View File

@ -559,6 +559,7 @@ enum wined3d_shader_interpolation_mode
enum wined3d_shader_global_flags
{
WINED3DSGF_REFACTORING_ALLOWED = 0x1,
WINED3DSGF_FORCE_EARLY_DEPTH_STENCIL = 0x4,
WINED3DSGF_ENABLE_RAW_AND_STRUCTURED_BUFFERS = 0x8,
};
@ -3866,6 +3867,8 @@ struct wined3d_pixel_shader
/* Some information about the shader behavior */
BOOL color0_mov;
DWORD color0_reg;
BOOL force_early_depth_stencil;
};
struct wined3d_compute_shader