wined3d: Use d3d_info to determine whether shader outputs need interpolation qualifiers.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1c41aac4a4
commit
4f86e35c53
|
@ -3770,6 +3770,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
|
||||||
d3d_info->limits.ps_uniform_count = shader_caps.ps_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.varying_count = shader_caps.varying_count;
|
||||||
d3d_info->shader_double_precision = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION);
|
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->viewport_array_index_any_shader = !!gl_info->supported[ARB_SHADER_VIEWPORT_LAYER_ARRAY];
|
d3d_info->viewport_array_index_any_shader = !!gl_info->supported[ARB_SHADER_VIEWPORT_LAYER_ARRAY];
|
||||||
|
|
||||||
|
|
|
@ -1979,6 +1979,14 @@ static void shader_glsl_declare_shader_inputs(const struct wined3d_gl_info *gl_i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL needs_interpolation_qualifiers_for_shader_outputs(const struct wined3d_gl_info *gl_info)
|
||||||
|
{
|
||||||
|
/* In GLSL 4.40+ it is fine to specify interpolation qualifiers only in
|
||||||
|
* fragment shaders. In older GLSL versions interpolation qualifiers must
|
||||||
|
* match between shader stages. */
|
||||||
|
return gl_info->glsl_version < MAKEDWORD_VERSION(4, 40);
|
||||||
|
}
|
||||||
|
|
||||||
static void shader_glsl_declare_shader_outputs(const struct wined3d_gl_info *gl_info,
|
static void shader_glsl_declare_shader_outputs(const struct wined3d_gl_info *gl_info,
|
||||||
struct wined3d_string_buffer *buffer, unsigned int element_count, BOOL rasterizer_setup,
|
struct wined3d_string_buffer *buffer, unsigned int element_count, BOOL rasterizer_setup,
|
||||||
const DWORD *interpolation_mode)
|
const DWORD *interpolation_mode)
|
||||||
|
@ -11108,6 +11116,8 @@ static void shader_glsl_get_caps(const struct wined3d_adapter *adapter, struct s
|
||||||
* shader_glsl_alloc(). */
|
* shader_glsl_alloc(). */
|
||||||
caps->wined3d_caps = WINED3D_SHADER_CAP_VS_CLIPPING
|
caps->wined3d_caps = WINED3D_SHADER_CAP_VS_CLIPPING
|
||||||
| WINED3D_SHADER_CAP_SRGB_WRITE;
|
| WINED3D_SHADER_CAP_SRGB_WRITE;
|
||||||
|
if (needs_interpolation_qualifiers_for_shader_outputs(gl_info))
|
||||||
|
caps->wined3d_caps |= WINED3D_SHADER_CAP_OUTPUT_INTERPOLATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL shader_glsl_color_fixup_supported(struct color_fixup_desc fixup)
|
static BOOL shader_glsl_color_fixup_supported(struct color_fixup_desc fixup)
|
||||||
|
|
|
@ -3505,10 +3505,10 @@ HRESULT CDECL wined3d_shader_set_local_constants_float(struct wined3d_shader *sh
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_interpolation_compile_args(DWORD *interpolation_args,
|
static void init_interpolation_compile_args(DWORD *interpolation_args,
|
||||||
const struct wined3d_shader *pixel_shader, const struct wined3d_gl_info *gl_info)
|
const struct wined3d_shader *pixel_shader, const struct wined3d_d3d_info *d3d_info)
|
||||||
{
|
{
|
||||||
if (!needs_interpolation_qualifiers_for_shader_outputs(gl_info)
|
if (!d3d_info->shader_output_interpolation || !pixel_shader
|
||||||
|| !pixel_shader || pixel_shader->reg_maps.shader_version.major < 4)
|
|| pixel_shader->reg_maps.shader_version.major < 4)
|
||||||
{
|
{
|
||||||
memset(interpolation_args, 0, sizeof(pixel_shader->u.ps.interpolation_mode));
|
memset(interpolation_args, 0, sizeof(pixel_shader->u.ps.interpolation_mode));
|
||||||
return;
|
return;
|
||||||
|
@ -3525,7 +3525,6 @@ void find_vs_compile_args(const struct wined3d_state *state, const struct wined3
|
||||||
const struct wined3d_shader *pixel_shader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
|
const struct wined3d_shader *pixel_shader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
|
||||||
const struct wined3d_shader *hull_shader = state->shader[WINED3D_SHADER_TYPE_HULL];
|
const struct wined3d_shader *hull_shader = state->shader[WINED3D_SHADER_TYPE_HULL];
|
||||||
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
|
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
|
||||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
||||||
|
|
||||||
args->fog_src = state->render_states[WINED3D_RS_FOGTABLEMODE]
|
args->fog_src = state->render_states[WINED3D_RS_FOGTABLEMODE]
|
||||||
== WINED3D_FOG_NONE ? VS_FOG_COORD : VS_FOG_Z;
|
== WINED3D_FOG_NONE ? VS_FOG_COORD : VS_FOG_Z;
|
||||||
|
@ -3548,7 +3547,7 @@ void find_vs_compile_args(const struct wined3d_state *state, const struct wined3
|
||||||
args->flatshading = 0;
|
args->flatshading = 0;
|
||||||
|
|
||||||
init_interpolation_compile_args(args->interpolation_mode,
|
init_interpolation_compile_args(args->interpolation_mode,
|
||||||
args->next_shader_type == WINED3D_SHADER_TYPE_PIXEL ? pixel_shader : NULL, gl_info);
|
args->next_shader_type == WINED3D_SHADER_TYPE_PIXEL ? pixel_shader : NULL, d3d_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL match_usage(BYTE usage1, BYTE usage_idx1, BYTE usage2, BYTE usage_idx2)
|
static BOOL match_usage(BYTE usage1, BYTE usage_idx1, BYTE usage2, BYTE usage_idx2)
|
||||||
|
@ -3865,7 +3864,6 @@ void find_ds_compile_args(const struct wined3d_state *state, const struct wined3
|
||||||
const struct wined3d_shader *geometry_shader = state->shader[WINED3D_SHADER_TYPE_GEOMETRY];
|
const struct wined3d_shader *geometry_shader = state->shader[WINED3D_SHADER_TYPE_GEOMETRY];
|
||||||
const struct wined3d_shader *pixel_shader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
|
const struct wined3d_shader *pixel_shader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
|
||||||
const struct wined3d_shader *hull_shader = state->shader[WINED3D_SHADER_TYPE_HULL];
|
const struct wined3d_shader *hull_shader = state->shader[WINED3D_SHADER_TYPE_HULL];
|
||||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
||||||
|
|
||||||
args->tessellator_output_primitive = hull_shader->u.hs.tessellator_output_primitive;
|
args->tessellator_output_primitive = hull_shader->u.hs.tessellator_output_primitive;
|
||||||
args->tessellator_partitioning = hull_shader->u.hs.tessellator_partitioning;
|
args->tessellator_partitioning = hull_shader->u.hs.tessellator_partitioning;
|
||||||
|
@ -3877,7 +3875,7 @@ void find_ds_compile_args(const struct wined3d_state *state, const struct wined3
|
||||||
args->render_offscreen = context->render_offscreen;
|
args->render_offscreen = context->render_offscreen;
|
||||||
|
|
||||||
init_interpolation_compile_args(args->interpolation_mode,
|
init_interpolation_compile_args(args->interpolation_mode,
|
||||||
args->next_shader_type == WINED3D_SHADER_TYPE_PIXEL ? pixel_shader : NULL, gl_info);
|
args->next_shader_type == WINED3D_SHADER_TYPE_PIXEL ? pixel_shader : NULL, context->d3d_info);
|
||||||
|
|
||||||
args->padding = 0;
|
args->padding = 0;
|
||||||
}
|
}
|
||||||
|
@ -3886,14 +3884,13 @@ void find_gs_compile_args(const struct wined3d_state *state, const struct wined3
|
||||||
struct gs_compile_args *args, const struct wined3d_context *context)
|
struct gs_compile_args *args, const struct wined3d_context *context)
|
||||||
{
|
{
|
||||||
const struct wined3d_shader *pixel_shader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
|
const struct wined3d_shader *pixel_shader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
|
||||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
||||||
|
|
||||||
args->output_count = pixel_shader ? pixel_shader->limits->packed_input : shader->limits->packed_output;
|
args->output_count = pixel_shader ? pixel_shader->limits->packed_input : shader->limits->packed_output;
|
||||||
|
|
||||||
if (!(args->primitive_type = shader->u.gs.input_type))
|
if (!(args->primitive_type = shader->u.gs.input_type))
|
||||||
args->primitive_type = d3d_primitive_type_from_gl(state->gl_primitive_type);
|
args->primitive_type = d3d_primitive_type_from_gl(state->gl_primitive_type);
|
||||||
|
|
||||||
init_interpolation_compile_args(args->interpolation_mode, pixel_shader, gl_info);
|
init_interpolation_compile_args(args->interpolation_mode, pixel_shader, context->d3d_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void find_ps_compile_args(const struct wined3d_state *state, const struct wined3d_shader *shader,
|
void find_ps_compile_args(const struct wined3d_state *state, const struct wined3d_shader *shader,
|
||||||
|
|
|
@ -205,6 +205,7 @@ struct wined3d_d3d_info
|
||||||
unsigned int vs_clipping : 1;
|
unsigned int vs_clipping : 1;
|
||||||
unsigned int shader_color_key : 1;
|
unsigned int shader_color_key : 1;
|
||||||
unsigned int shader_double_precision : 1;
|
unsigned int shader_double_precision : 1;
|
||||||
|
unsigned int shader_output_interpolation : 1;
|
||||||
unsigned int viewport_array_index_any_shader : 1;
|
unsigned int viewport_array_index_any_shader : 1;
|
||||||
unsigned int texture_npot : 1;
|
unsigned int texture_npot : 1;
|
||||||
unsigned int texture_npot_conditional : 1;
|
unsigned int texture_npot_conditional : 1;
|
||||||
|
@ -1298,9 +1299,10 @@ BOOL shader_get_stream_output_register_info(const struct wined3d_shader *shader,
|
||||||
|
|
||||||
typedef void (*SHADER_HANDLER)(const struct wined3d_shader_instruction *);
|
typedef void (*SHADER_HANDLER)(const struct wined3d_shader_instruction *);
|
||||||
|
|
||||||
#define WINED3D_SHADER_CAP_VS_CLIPPING 0x00000001
|
#define WINED3D_SHADER_CAP_VS_CLIPPING 0x00000001u
|
||||||
#define WINED3D_SHADER_CAP_SRGB_WRITE 0x00000002
|
#define WINED3D_SHADER_CAP_SRGB_WRITE 0x00000002u
|
||||||
#define WINED3D_SHADER_CAP_DOUBLE_PRECISION 0x00000004
|
#define WINED3D_SHADER_CAP_DOUBLE_PRECISION 0x00000004u
|
||||||
|
#define WINED3D_SHADER_CAP_OUTPUT_INTERPOLATION 0x00000008u
|
||||||
|
|
||||||
struct shader_caps
|
struct shader_caps
|
||||||
{
|
{
|
||||||
|
@ -4842,15 +4844,6 @@ static inline BOOL can_use_texture_swizzle(const struct wined3d_d3d_info *d3d_in
|
||||||
return d3d_info->texture_swizzle && !is_complex_fixup(format->color_fixup) && !is_scaling_fixup(format->color_fixup);
|
return d3d_info->texture_swizzle && !is_complex_fixup(format->color_fixup) && !is_scaling_fixup(format->color_fixup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline BOOL needs_interpolation_qualifiers_for_shader_outputs(const struct wined3d_gl_info *gl_info)
|
|
||||||
{
|
|
||||||
/* In GLSL 4.40+ it is fine to specify interpolation qualifiers only in
|
|
||||||
* fragment shaders. In older GLSL versions interpolation qualifiers must
|
|
||||||
* match between shader stages.
|
|
||||||
*/
|
|
||||||
return gl_info->glsl_version < MAKEDWORD_VERSION(4, 40);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline BOOL is_rasterization_disabled(const struct wined3d_shader *geometry_shader)
|
static inline BOOL is_rasterization_disabled(const struct wined3d_shader *geometry_shader)
|
||||||
{
|
{
|
||||||
return geometry_shader
|
return geometry_shader
|
||||||
|
|
Loading…
Reference in New Issue