diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 8dc97b99112..f08cc0227ea 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1734,8 +1734,8 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont for (i = 0; i < reg_maps->sampler_map.count; ++i) { struct wined3d_shader_sampler_map_entry *entry; + const char *sampler_type_prefix, *sampler_type; BOOL shadow_sampler, tex_rect; - const char *sampler_type; entry = ®_maps->sampler_map.entries[i]; @@ -1745,6 +1745,28 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont continue; } + switch (reg_maps->resource_info[entry->resource_idx].data_type) + { + case WINED3D_DATA_FLOAT: + case WINED3D_DATA_UNORM: + case WINED3D_DATA_SNORM: + sampler_type_prefix = ""; + break; + + case WINED3D_DATA_INT: + sampler_type_prefix = "i"; + break; + + case WINED3D_DATA_UINT: + sampler_type_prefix = "u"; + break; + + default: + sampler_type_prefix = ""; + ERR("Unhandled resource data type %#x.\n", reg_maps->resource_info[i].data_type); + break; + } + shadow_sampler = version->type == WINED3D_SHADER_TYPE_PIXEL && (ps_args->shadow & (1u << entry->sampler_idx)); switch (reg_maps->resource_info[entry->resource_idx].type) { @@ -1792,7 +1814,8 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont FIXME("Unhandled resource type %#x.\n", reg_maps->resource_info[i].type); break; } - shader_addline(buffer, "uniform %s %s_sampler%u;\n", sampler_type, prefix, entry->bind_idx); + shader_addline(buffer, "uniform %s%s %s_sampler%u;\n", + sampler_type_prefix, sampler_type, prefix, entry->bind_idx); } /* Declare uniforms for NP2 texcoord fixup: