wined3d: Account for HLSL FFP shaders in find_ps_compile_args().

In most cases, it is possible to construct a D3D shader which behaves
identically to a given FFP pipeline.

There are two exceptions, related to fog and texture transforms, where the FFP
pipeline has special behaviour that cannot be emulated with shaders, and we
handle those here by checking whether our shader is actually an FFP replacement
shader.
This commit is contained in:
Elizabeth Figura 2024-09-23 19:04:15 -05:00
parent 6a978ed054
commit b38b973efb

View file

@ -2854,6 +2854,7 @@ 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, 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) BOOL position_transformed, struct ps_compile_args *args, const struct wined3d_context *context)
{ {
const struct wined3d_shader *vs = state->shader[WINED3D_SHADER_TYPE_VERTEX];
const struct wined3d_d3d_info *d3d_info = context->d3d_info; const struct wined3d_d3d_info *d3d_info = context->d3d_info;
struct wined3d_shader_resource_view *view; struct wined3d_shader_resource_view *view;
struct wined3d_texture *texture; struct wined3d_texture *texture;
@ -2881,7 +2882,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
{ {
uint32_t tex_transform = flags & ~WINED3D_TTFF_PROJECTED; uint32_t tex_transform = flags & ~WINED3D_TTFF_PROJECTED;
if (!state->shader[WINED3D_SHADER_TYPE_VERTEX]) if (!vs || vs->is_ffp_vs)
{ {
enum wined3d_shader_resource_type resource_type = shader->reg_maps.resource_info[i].type; enum wined3d_shader_resource_type resource_type = shader->reg_maps.resource_info[i].type;
unsigned int j; unsigned int j;
@ -3051,7 +3052,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
switch (state->render_states[WINED3D_RS_FOGTABLEMODE]) switch (state->render_states[WINED3D_RS_FOGTABLEMODE])
{ {
case WINED3D_FOG_NONE: case WINED3D_FOG_NONE:
if (position_transformed || use_vs(state)) if (position_transformed || (vs && !vs->is_ffp_vs))
{ {
args->fog = WINED3D_FFP_PS_FOG_LINEAR; args->fog = WINED3D_FFP_PS_FOG_LINEAR;
break; break;