wined3d: Add conservative depth output information to GLSL pixel shaders.

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>
oldstable
Michael Müller 2017-09-10 14:25:40 +02:00 committed by Alexandre Julliard
parent c95e0ef092
commit 76783293cf
5 changed files with 27 additions and 0 deletions

View File

@ -115,6 +115,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
{"GL_ARB_clip_control", ARB_CLIP_CONTROL },
{"GL_ARB_color_buffer_float", ARB_COLOR_BUFFER_FLOAT },
{"GL_ARB_compute_shader", ARB_COMPUTE_SHADER },
{"GL_ARB_conservative_depth", ARB_CONSERVATIVE_DEPTH },
{"GL_ARB_copy_buffer", ARB_COPY_BUFFER },
{"GL_ARB_debug_output", ARB_DEBUG_OUTPUT },
{"GL_ARB_depth_buffer_float", ARB_DEPTH_BUFFER_FLOAT },
@ -3874,6 +3875,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
{ARB_ES2_COMPATIBILITY, MAKEDWORD_VERSION(4, 1)},
{ARB_VIEWPORT_ARRAY, MAKEDWORD_VERSION(4, 1)},
{ARB_CONSERVATIVE_DEPTH, MAKEDWORD_VERSION(4, 2)},
{ARB_INTERNALFORMAT_QUERY, MAKEDWORD_VERSION(4, 2)},
{ARB_MAP_BUFFER_ALIGNMENT, MAKEDWORD_VERSION(4, 2)},
{ARB_SHADER_ATOMIC_COUNTERS, MAKEDWORD_VERSION(4, 2)},

View File

@ -7244,6 +7244,8 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
shader_glsl_add_version_declaration(buffer, gl_info);
shader_glsl_enable_extensions(buffer, gl_info);
if (gl_info->supported[ARB_CONSERVATIVE_DEPTH])
shader_addline(buffer, "#extension GL_ARB_conservative_depth : enable\n");
if (gl_info->supported[ARB_DERIVATIVE_CONTROL])
shader_addline(buffer, "#extension GL_ARB_derivative_control : enable\n");
if (shader_glsl_use_explicit_attrib_location(gl_info))
@ -7262,6 +7264,14 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
/* Base Declarations */
shader_generate_glsl_declarations(context, buffer, shader, reg_maps, &priv_ctx);
if (gl_info->supported[ARB_CONSERVATIVE_DEPTH])
{
if (shader->u.ps.depth_output == WINED3DSPR_DEPTHOUTGE)
shader_addline(buffer, "layout (depth_greater) out float gl_FragDepth;\n");
else if (shader->u.ps.depth_output == WINED3DSPR_DEPTHOUTLE)
shader_addline(buffer, "layout (depth_less) out float gl_FragDepth;\n");
}
/* Declare uniforms for NP2 texcoord fixup:
* This is NOT done inside the loop that declares the texture samplers
* since the NP2 fixup code is currently only used for the GeforceFX

View File

@ -1148,6 +1148,19 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
FIXME("Invalid instruction %#x for shader type %#x.\n",
ins.handler_idx, shader_version.type);
}
else if (ins.handler_idx == WINED3DSIH_DCL_OUTPUT)
{
if (ins.declaration.dst.reg.type == WINED3DSPR_DEPTHOUT
|| ins.declaration.dst.reg.type == WINED3DSPR_DEPTHOUTGE
|| ins.declaration.dst.reg.type == WINED3DSPR_DEPTHOUTLE)
{
if (shader_version.type == WINED3D_SHADER_TYPE_PIXEL)
shader->u.ps.depth_output = ins.declaration.dst.reg.type;
else
FIXME("Invalid instruction %#x for shader type %#x.\n",
ins.handler_idx, shader_version.type);
}
}
else if (ins.handler_idx == WINED3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT)
{
if (shader_version.type == WINED3D_SHADER_TYPE_HULL)

View File

@ -49,6 +49,7 @@ enum wined3d_gl_extension
ARB_CLIP_CONTROL,
ARB_COLOR_BUFFER_FLOAT,
ARB_COMPUTE_SHADER,
ARB_CONSERVATIVE_DEPTH,
ARB_COPY_BUFFER,
ARB_DEBUG_OUTPUT,
ARB_DEPTH_BUFFER_FLOAT,

View File

@ -3907,6 +3907,7 @@ struct wined3d_pixel_shader
DWORD color0_reg;
BOOL force_early_depth_stencil;
enum wined3d_shader_register_type depth_output;
};
struct wined3d_compute_shader