Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/adapter_gl.c | 2 +- dlls/wined3d/arb_program_shader.c | 1 - dlls/wined3d/glsl_shader.c | 22 ++++++++++------------ dlls/wined3d/shader.c | 2 +- dlls/wined3d/utils.c | 6 +++--- dlls/wined3d/wined3d_private.h | 4 ++-- 6 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 0b7fcf47297..8684a4e07cf 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -3770,7 +3770,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, d3d_info->limits.vs_uniform_count = shader_caps.vs_uniform_count; d3d_info->limits.ps_uniform_count = shader_caps.ps_uniform_count; d3d_info->limits.varying_count = shader_caps.varying_count; - d3d_info->limits.max_compat_varying_count = shader_caps.max_compat_varying_count; + d3d_info->full_ffp_varyings = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_FULL_FFP_VARYINGS); 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);
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index b81898b78e7..9502430ef5a 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -4958,7 +4958,6 @@ static void shader_arb_get_caps(const struct wined3d_adapter *adapter, struct sh }
caps->varying_count = 0; - caps->max_compat_varying_count = 0; caps->wined3d_caps = WINED3D_SHADER_CAP_SRGB_WRITE; if (use_nv_clip(gl_info)) caps->wined3d_caps |= WINED3D_SHADER_CAP_VS_CLIPPING; diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index e5f51925cdc..0f1a319872f 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -420,13 +420,12 @@ static void shader_glsl_add_version_declaration(struct wined3d_string_buffer *bu shader_addline(buffer, "#version %u\n", shader_glsl_get_version(gl_info)); }
-unsigned int shader_glsl_max_compat_varyings(const struct wined3d_gl_info *gl_info) +unsigned int shader_glsl_full_ffp_varyings(const struct wined3d_gl_info *gl_info) { /* On core profile we have to also count diffuse and specular colours and * the fog coordinate. */ - if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT]) - return WINED3D_MAX_TEXTURES * 4; - return (WINED3D_MAX_TEXTURES + 2) * 4 + 1; + return gl_info->limits.glsl_varyings >= (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT] + ? WINED3D_MAX_TEXTURES * 4 : (WINED3D_MAX_TEXTURES + 2) * 4 + 1); }
static void shader_glsl_append_imm_vec(struct wined3d_string_buffer *buffer, @@ -7155,8 +7154,7 @@ static GLuint shader_glsl_generate_vs3_rasterizer_input_setup(struct shader_glsl
if (texcoords_written_mask[i] != WINED3DSP_WRITEMASK_ALL) { - if (gl_info->limits.glsl_varyings < shader_glsl_max_compat_varyings(gl_info) - && !texcoords_written_mask[i]) + if (!shader_glsl_full_ffp_varyings(gl_info) && !texcoords_written_mask[i]) continue;
shader_glsl_write_mask_to_str(~texcoords_written_mask[i] & WINED3DSP_WRITEMASK_ALL, reg_mask); @@ -9066,7 +9064,7 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr if (settings->texcoords & (1u << i)) shader_addline(buffer, "ffp_varying_texcoord[%u] = ffp_texture_matrix[%u] * ffp_attrib_texcoord%u;\n", i, i, i); - else if (gl_info->limits.glsl_varyings >= shader_glsl_max_compat_varyings(gl_info)) + else if (shader_glsl_full_ffp_varyings(gl_info)) shader_addline(buffer, "ffp_varying_texcoord[%u] = vec4(0.0);\n", i); else output_legacy_texcoord = FALSE; @@ -11104,7 +11102,6 @@ static void shader_glsl_get_caps(const struct wined3d_adapter *adapter, struct s caps->vs_uniform_count = min(WINED3D_MAX_VS_CONSTS_F, gl_info->limits.glsl_vs_float_constants); caps->ps_uniform_count = min(WINED3D_MAX_PS_CONSTS_F, gl_info->limits.glsl_ps_float_constants); caps->varying_count = gl_info->limits.glsl_varyings; - caps->max_compat_varying_count = shader_glsl_max_compat_varyings(gl_info);
/* FIXME: The following line is card dependent. -8.0 to 8.0 is the * Direct3D minimum requirement. @@ -11130,6 +11127,8 @@ static void shader_glsl_get_caps(const struct wined3d_adapter *adapter, struct s | WINED3D_SHADER_CAP_SRGB_WRITE; if (needs_interpolation_qualifiers_for_shader_outputs(gl_info)) caps->wined3d_caps |= WINED3D_SHADER_CAP_OUTPUT_INTERPOLATION; + if (shader_glsl_full_ffp_varyings(gl_info)) + caps->wined3d_caps |= WINED3D_SHADER_CAP_FULL_FFP_VARYINGS; }
static BOOL shader_glsl_color_fixup_supported(struct color_fixup_desc fixup) @@ -11555,8 +11554,7 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context, * Likewise, we have to invalidate the shader when using per-vertex * colours and diffuse/specular attribute presence changes, or when * normal presence changes. */ - if (gl_info->limits.glsl_varyings < shader_glsl_max_compat_varyings(gl_info) - || (state->render_states[WINED3D_RS_COLORVERTEX] + if (!shader_glsl_full_ffp_varyings(gl_info) || (state->render_states[WINED3D_RS_COLORVERTEX] && (diffuse != context->last_was_diffuse || specular != context->last_was_specular)) || normal != context->last_was_normal) context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX; @@ -12071,7 +12069,7 @@ static void glsl_fragment_pipe_vdecl(struct wined3d_context *context, const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
/* Because of settings->texcoords_initialized and args->texcoords_initialized. */ - if (gl_info->limits.glsl_varyings < shader_glsl_max_compat_varyings(gl_info)) + if (!shader_glsl_full_ffp_varyings(gl_info)) context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_FOGENABLE))) @@ -12084,7 +12082,7 @@ static void glsl_fragment_pipe_vs(struct wined3d_context *context, const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
/* Because of settings->texcoords_initialized and args->texcoords_initialized. */ - if (gl_info->limits.glsl_varyings < shader_glsl_max_compat_varyings(gl_info)) + if (!shader_glsl_full_ffp_varyings(gl_info)) context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL; }
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 87089950235..4961dca1ce0 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -4114,7 +4114,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 } }
- if (d3d_info->limits.varying_count < d3d_info->limits.max_compat_varying_count) + if (!d3d_info->full_ffp_varyings) { const struct wined3d_shader *vs = state->shader[WINED3D_SHADER_TYPE_VERTEX];
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index b9cad2a56b4..cf7c177f76e 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6188,7 +6188,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d * Reading uninitialized varyings on core profile contexts results in an * error while with builtin varyings on legacy contexts you get undefined * behavior. */ - if (d3d_info->limits.varying_count && d3d_info->limits.varying_count < d3d_info->limits.max_compat_varying_count) + if (d3d_info->limits.varying_count && !d3d_info->full_ffp_varyings) { settings->texcoords_initialized = 0; for (i = 0; i < WINED3D_MAX_TEXTURES; ++i) @@ -6395,7 +6395,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context, settings->texcoords |= 1u << i; settings->texgen[i] = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX]; } - if (d3d_info->limits.varying_count >= d3d_info->limits.max_compat_varying_count) + if (d3d_info->full_ffp_varyings) settings->texcoords = (1u << WINED3D_MAX_TEXTURES) - 1;
if (d3d_info->emulated_flatshading) @@ -6444,7 +6444,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context, settings->texcoords |= 1u << i; settings->texgen[i] = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX]; } - if (d3d_info->limits.varying_count >= d3d_info->limits.max_compat_varying_count) + if (d3d_info->full_ffp_varyings) settings->texcoords = (1u << WINED3D_MAX_TEXTURES) - 1;
for (i = 0; i < WINED3D_MAX_ACTIVE_LIGHTS; ++i) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 80ed41bb845..229974d0c83 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -176,7 +176,6 @@ struct wined3d_d3d_limits
unsigned int max_rt_count; unsigned int max_clip_distances; - unsigned int max_compat_varying_count; unsigned int texture_size; float pointsize_max; }; @@ -218,6 +217,7 @@ struct wined3d_d3d_info uint32_t srgb_read_control : 1; uint32_t srgb_write_control : 1; uint32_t clip_control : 1; + uint32_t full_ffp_varyings : 1; enum wined3d_feature_level feature_level;
DWORD multisample_draw_location; @@ -1309,6 +1309,7 @@ typedef void (*SHADER_HANDLER)(const struct wined3d_shader_instruction *); #define WINED3D_SHADER_CAP_SRGB_WRITE 0x00000002u #define WINED3D_SHADER_CAP_DOUBLE_PRECISION 0x00000004u #define WINED3D_SHADER_CAP_OUTPUT_INTERPOLATION 0x00000008u +#define WINED3D_SHADER_CAP_FULL_FFP_VARYINGS 0x00000010u
struct shader_caps { @@ -1323,7 +1324,6 @@ struct shader_caps unsigned int ps_uniform_count; float ps_1x_max_value; unsigned int varying_count; - unsigned int max_compat_varying_count;
DWORD wined3d_caps; };