Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/adapter_gl.c | 1 + dlls/wined3d/glsl_shader.c | 6 +++--- dlls/wined3d/shader.c | 5 ++--- dlls/wined3d/wined3d_private.h | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 8787324571a..f6ef04a5fbb 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -5115,6 +5115,7 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_ d3d_info->shader_color_key = !!(fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_COLOR_KEY); d3d_info->shader_double_precision = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION); d3d_info->shader_output_interpolation = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_OUTPUT_INTERPOLATION); + d3d_info->frag_coord_correction = !!gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS]; d3d_info->viewport_array_index_any_shader = !!gl_info->supported[ARB_SHADER_VIEWPORT_LAYER_ARRAY]; d3d_info->texture_npot = !!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]; d3d_info->texture_npot_conditional = gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT] diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 6a3aaabe39b..398d3f5bffa 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -4038,7 +4038,7 @@ static void shader_glsl_map2gl(const struct wined3d_shader_instruction *ins) { const struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data; bool y_correction = ins->ctx->reg_maps->shader_version.type == WINED3D_SHADER_TYPE_PIXEL - ? !priv->cur_ps_args->render_offscreen : false; + ? priv->cur_ps_args->y_correction : false; struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src_param; const char *instruction; @@ -7788,8 +7788,8 @@ static GLuint shader_glsl_generate_fragment_shader(const struct wined3d_context_ { if (context_gl->c.d3d_info->wined3d_creation_flags & WINED3D_PIXEL_CENTER_INTEGER) shader_addline(buffer, "layout(%spixel_center_integer) in vec4 gl_FragCoord;\n", - args->render_offscreen ? "" : "origin_upper_left, "); - else if (!args->render_offscreen) + args->y_correction ? "origin_upper_left, " : ""); + else if (args->y_correction) shader_addline(buffer, "layout(origin_upper_left) in vec4 gl_FragCoord;\n"); } shader_addline(buffer, "vec4 vpos;\n"); diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index ae9b21defa1..4374269b9a1 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -3952,7 +3952,6 @@ void find_gs_compile_args(const struct wined3d_state *state, const struct wined3 void find_ps_compile_args(const struct wined3d_state *state, const struct wined3d_shader *shader, BOOL position_transformed, struct ps_compile_args *args, const struct wined3d_context *context) { - const struct wined3d_gl_info *gl_info = &context->device->adapter->gl_info; const struct wined3d_d3d_info *d3d_info = context->d3d_info; struct wined3d_texture *texture; unsigned int i; @@ -4212,9 +4211,9 @@ 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 = (shader->reg_maps.vpos && gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS]) + args->y_correction = (shader->reg_maps.vpos && d3d_info->frag_coord_correction) || (shader->reg_maps.usesdsy && wined3d_settings.offscreen_rendering_mode != ORM_FBO) - ? context->render_offscreen : 1; + ? !context->render_offscreen : 0;
for (i = 0; i < ARRAY_SIZE(state->fb.render_targets); ++i) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 21f34a5895d..d5bc1e6c6c8 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -222,6 +222,7 @@ struct wined3d_d3d_info uint32_t shader_color_key : 1; uint32_t shader_double_precision : 1; uint32_t shader_output_interpolation : 1; + uint32_t frag_coord_correction : 1; uint32_t viewport_array_index_any_shader : 1; uint32_t texture_npot : 1; uint32_t texture_npot_conditional : 1; @@ -1438,7 +1439,7 @@ struct ps_compile_args DWORD pointsprite : 1; DWORD flatshading : 1; DWORD alpha_test_func : 3; - DWORD render_offscreen : 1; + DWORD y_correction : 1; DWORD rt_alpha_swizzle : 8; /* WINED3D_MAX_RENDER_TARGETS, 8 */ DWORD dual_source_blend : 1; DWORD padding : 17;