diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index ab2d0bb7084..d786f68a239 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -25946,7 +25946,7 @@ static void test_mismatched_sample_types(void) { {"2d_2d", (IDirect3DBaseTexture9 **)&tex_2d, &ps_2d, 0x00707070}, {"3d_3d", (IDirect3DBaseTexture9 **)&volume, &ps_3d, 0x00303030}, - {"2d_3d", (IDirect3DBaseTexture9 **)&tex_2d, &ps_3d, 0x00707070, 0x00b2cce5, TRUE}, + {"2d_3d", (IDirect3DBaseTexture9 **)&tex_2d, &ps_3d, 0x00707070, 0x00b2cce5}, {"3d_2d", (IDirect3DBaseTexture9 **)&volume, &ps_2d, 0x00303030, 0x00b2cce5, TRUE, 0x00202020}, }; diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 93d33a6ab67..d856feabcb4 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -4003,6 +4003,39 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 } } } + else if (shader->reg_maps.shader_version.major <= 3) + { + for (i = 0; i < shader->limits->sampler; ++i) + { + enum wined3d_shader_resource_type resource_type; + enum wined3d_shader_tex_types tex_type; + + if (!(resource_type = shader->reg_maps.resource_info[i].type)) + continue; + + switch (resource_type) + { + case WINED3D_SHADER_RESOURCE_TEXTURE_3D: + tex_type = WINED3D_SHADER_TEX_3D; + break; + case WINED3D_SHADER_RESOURCE_TEXTURE_CUBE: + tex_type = WINED3D_SHADER_TEX_CUBE; + break; + default: + tex_type = WINED3D_SHADER_TEX_2D; + break; + } + + if ((texture = state->textures[i])) + { + if (texture->resource.type == WINED3D_RTYPE_TEXTURE_2D + && resource_type == WINED3D_SHADER_RESOURCE_TEXTURE_3D + && !(texture->resource.usage & WINED3DUSAGE_LEGACY_CUBEMAP)) + tex_type = WINED3D_SHADER_TEX_2D; + } + args->tex_types |= tex_type << i * WINED3D_PSARGS_TEXTYPE_SHIFT; + } + } if (shader->reg_maps.shader_version.major >= 4) { @@ -4201,7 +4234,7 @@ static HRESULT pixel_shader_init(struct wined3d_shader *shader, struct wined3d_d } enum wined3d_shader_resource_type pixelshader_get_resource_type(const struct wined3d_shader_reg_maps *reg_maps, - unsigned int resource_idx, WORD tex_types) + unsigned int resource_idx, DWORD tex_types) { static enum wined3d_shader_resource_type shader_resource_type_from_shader_tex_types[] = { @@ -4212,7 +4245,7 @@ enum wined3d_shader_resource_type pixelshader_get_resource_type(const struct win unsigned int idx; - if (reg_maps->shader_version.major != 1) + if (reg_maps->shader_version.major > 3) return reg_maps->resource_info[resource_idx].type; if (!reg_maps->resource_info[resource_idx].type) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 7cda311201f..b959a280608 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1365,6 +1365,7 @@ enum wined3d_shader_tex_types WINED3D_SHADER_TEX_2D = 0, WINED3D_SHADER_TEX_3D = 1, WINED3D_SHADER_TEX_CUBE = 2, + WINED3D_SHADER_TEX_ERR = 3, }; struct ps_compile_args @@ -1372,8 +1373,8 @@ struct ps_compile_args struct color_fixup_desc color_fixup[WINED3D_MAX_FRAGMENT_SAMPLERS]; enum wined3d_vertex_processing_mode vp_mode; enum wined3d_ffp_ps_fog_mode fog; + DWORD tex_types; /* ps 1 - 3, 16 textures */ WORD tex_transform; /* ps 1.0-1.3, 4 textures */ - WORD tex_types; /* ps 1.0 - 1.4, 6 textures */ WORD srgb_correction; /* Bitmap for NP2 texcoord fixups (16 samplers max currently). D3D9 has a limit of 16 samplers and the fixup is superfluous @@ -1381,6 +1382,7 @@ struct ps_compile_args WORD np2_fixup; WORD shadow; /* WINED3D_MAX_FRAGMENT_SAMPLERS, 16 */ WORD texcoords_initialized; /* WINED3D_MAX_TEXTURES, 8 */ + WORD padding_to_dword; DWORD pointsprite : 1; DWORD flatshading : 1; DWORD alpha_test_func : 3; @@ -4445,7 +4447,7 @@ struct wined3d_shader }; enum wined3d_shader_resource_type pixelshader_get_resource_type(const struct wined3d_shader_reg_maps *reg_maps, - unsigned int resource_idx, WORD tex_types) DECLSPEC_HIDDEN; + unsigned int resource_idx, DWORD tex_types) DECLSPEC_HIDDEN; 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) DECLSPEC_HIDDEN;