wined3d: Avoid vpos fixups when ARB_fragment_coord_conventions is supported.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d9a9e45a24
commit
a7f846b2ee
|
@ -2418,6 +2418,8 @@ static void context_set_render_offscreen(struct wined3d_context *context, BOOL o
|
|||
context_invalidate_state(context, STATE_VIEWPORT);
|
||||
context_invalidate_state(context, STATE_SCISSORRECT);
|
||||
context_invalidate_state(context, STATE_FRONTFACE);
|
||||
if (context->gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS])
|
||||
context_invalidate_state(context, STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL));
|
||||
context->render_offscreen = offscreen;
|
||||
}
|
||||
|
||||
|
|
|
@ -2193,11 +2193,25 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
|||
shader_addline(buffer, ";\n");
|
||||
}
|
||||
if (reg_maps->vpos || reg_maps->usesdsy)
|
||||
{
|
||||
if (reg_maps->usesdsy || !gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS])
|
||||
{
|
||||
++extra_constants_needed;
|
||||
shader_addline(buffer, "uniform vec4 ycorrection;\n");
|
||||
}
|
||||
if (reg_maps->vpos)
|
||||
{
|
||||
if (gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS])
|
||||
{
|
||||
if (shader->device->wined3d->flags & WINED3D_PIXEL_CENTER_INTEGER)
|
||||
shader_addline(buffer, "layout(%spixel_center_integer) in vec4 gl_FragCoord;\n",
|
||||
ps_args->render_offscreen ? "" : "origin_upper_left, ");
|
||||
else if (!ps_args->render_offscreen)
|
||||
shader_addline(buffer, "layout(origin_upper_left) in vec4 gl_FragCoord;\n");
|
||||
}
|
||||
shader_addline(buffer, "vec4 vpos;\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (ps_args->alpha_test_func + 1 != WINED3D_CMP_ALWAYS)
|
||||
shader_addline(buffer, "uniform float alpha_test_ref;\n");
|
||||
|
@ -5899,6 +5913,8 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
|
|||
shader_glsl_enable_extensions(buffer, gl_info);
|
||||
if (gl_info->supported[ARB_DERIVATIVE_CONTROL])
|
||||
shader_addline(buffer, "#extension GL_ARB_derivative_control : enable\n");
|
||||
if (gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS])
|
||||
shader_addline(buffer, "#extension GL_ARB_fragment_coord_conventions : enable\n");
|
||||
if (gl_info->supported[ARB_SHADER_TEXTURE_LOD])
|
||||
shader_addline(buffer, "#extension GL_ARB_shader_texture_lod : enable\n");
|
||||
/* The spec says that it doesn't have to be explicitly enabled, but the
|
||||
|
@ -5929,7 +5945,9 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
|
|||
* on drivers that returns integer values. */
|
||||
if (reg_maps->vpos)
|
||||
{
|
||||
if (shader->device->wined3d->flags & WINED3D_PIXEL_CENTER_INTEGER)
|
||||
if (gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS])
|
||||
shader_addline(buffer, "vpos = gl_FragCoord;\n");
|
||||
else if (shader->device->wined3d->flags & WINED3D_PIXEL_CENTER_INTEGER)
|
||||
shader_addline(buffer,
|
||||
"vpos = floor(vec4(0, ycorrection[0], 0, 0) + gl_FragCoord * vec4(1, ycorrection[1], 1, 1));\n");
|
||||
else
|
||||
|
|
|
@ -3279,6 +3279,8 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
|
|||
|
||||
if (d3d_info->emulated_flatshading)
|
||||
args->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT;
|
||||
|
||||
args->render_offscreen = gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS] ? context->render_offscreen : 0;
|
||||
}
|
||||
|
||||
static HRESULT pixel_shader_init(struct wined3d_shader *shader, struct wined3d_device *device,
|
||||
|
|
|
@ -1107,7 +1107,8 @@ struct ps_compile_args {
|
|||
DWORD pointsprite : 1;
|
||||
DWORD flatshading : 1;
|
||||
DWORD alpha_test_func : 3;
|
||||
DWORD padding : 27;
|
||||
DWORD render_offscreen : 1;
|
||||
DWORD padding : 26;
|
||||
};
|
||||
|
||||
enum fog_src_type {
|
||||
|
|
Loading…
Reference in New Issue