wined3d: Use the FFP HLSL pipeline for pretransformed draws as well.

This commit is contained in:
Elizabeth Figura 2024-08-07 20:25:24 -05:00 committed by Alexandre Julliard
parent ff43072059
commit eaef138dce
Notes: Alexandre Julliard 2024-11-19 23:22:29 +01:00
Approved-by: Jan Sikorski (@jsikorski)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6813
4 changed files with 27 additions and 5 deletions

View file

@ -161,8 +161,8 @@ void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_inf
const struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info) const struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info)
{ {
/* We need to deal with frequency data! */ /* We need to deal with frequency data! */
BOOL use_vshader = use_vs(state) || (d3d_info->ffp_hlsl && state->shader[WINED3D_SHADER_TYPE_VERTEX]);
struct wined3d_vertex_declaration *declaration = state->vertex_declaration; struct wined3d_vertex_declaration *declaration = state->vertex_declaration;
BOOL use_vshader = use_vs(state);
unsigned int i; unsigned int i;
stream_info->use_map = 0; stream_info->use_map = 0;

View file

@ -10425,10 +10425,10 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl,
vs_id = ctx_data->glsl_program->vs.id; vs_id = ctx_data->glsl_program->vs.id;
vs_list = &ctx_data->glsl_program->vs.shader_entry; vs_list = &ctx_data->glsl_program->vs.shader_entry;
if (use_vs(state)) if (use_vs(state) || d3d_info->ffp_hlsl)
vshader = state->shader[WINED3D_SHADER_TYPE_VERTEX]; vshader = state->shader[WINED3D_SHADER_TYPE_VERTEX];
} }
else if (use_vs(state)) else if (use_vs(state) || d3d_info->ffp_hlsl)
{ {
struct vs_compile_args vs_compile_args; struct vs_compile_args vs_compile_args;

View file

@ -2701,9 +2701,27 @@ void find_vs_compile_args(const struct wined3d_state *state, const struct wined3
&& state->transforms[WINED3D_TS_PROJECTION]._24 == 0.0f && state->transforms[WINED3D_TS_PROJECTION]._24 == 0.0f
&& state->transforms[WINED3D_TS_PROJECTION]._34 == 0.0f && state->transforms[WINED3D_TS_PROJECTION]._34 == 0.0f
&& state->transforms[WINED3D_TS_PROJECTION]._44 == 1.0f) && state->transforms[WINED3D_TS_PROJECTION]._44 == 1.0f)
args->fog_src = VS_FOG_Z; {
/* Fog source is vertex output Z.
*
* However, if drawing RHW (which means we are using an HLSL
* replacement shader, since we got here), and depth testing is
* disabled, primitives are not supposed to be clipped by the
* viewport. We handle this in the vertex shader by essentially
* flushing output Z to zero.
*
* Fog needs to still read from the original Z, however. In this
* case we read from oFog, which contains the original Z. */
if (state->vertex_declaration->position_transformed)
args->fog_src = VS_FOG_COORD;
else
args->fog_src = VS_FOG_Z;
}
else else
{
args->fog_src = VS_FOG_W; args->fog_src = VS_FOG_W;
}
} }
else else
{ {

View file

@ -1575,6 +1575,9 @@ void CDECL wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock *
|| declaration->normal != prev->normal || declaration->point_size != prev->point_size) || declaration->normal != prev->normal || declaration->point_size != prev->point_size)
stateblock->changed.ffp_vs_settings = 1; stateblock->changed.ffp_vs_settings = 1;
} }
if (declaration->position_transformed != prev->position_transformed)
stateblock->changed.ffp_vs_settings = 1;
} }
else else
{ {
@ -3814,7 +3817,8 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
* FFP pipeline cares about. The rest should eventually be removed from * FFP pipeline cares about. The rest should eventually be removed from
* those structs and left only in vs_compile_args / ps_compile_args. */ * those structs and left only in vs_compile_args / ps_compile_args. */
if (changed->ffp_vs_settings && !state->vs) if (changed->ffp_vs_settings
&& (!state->vs || !state->vertex_declaration || state->vertex_declaration->position_transformed))
{ {
if (device->adapter->d3d_info.ffp_hlsl) if (device->adapter->d3d_info.ffp_hlsl)
{ {