wined3d: Move legacy texture image unit range allocation to wined3d_gl_limits_get_texture_unit_range().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-03-13 11:57:21 +01:00 committed by Alexandre Julliard
parent 806479e432
commit d89ee7aaaa
3 changed files with 32 additions and 33 deletions

View File

@ -3385,23 +3385,13 @@ static void context_bind_shader_resources(struct wined3d_context *context,
static void context_bind_graphics_shader_resources(struct wined3d_context *context,
const struct wined3d_state *state)
{
unsigned int i;
unsigned int i, base_idx, count;
static const struct
for (i = 0; i < WINED3D_SHADER_TYPE_GRAPHICS_COUNT; ++i)
{
enum wined3d_shader_type type;
unsigned int base_idx;
unsigned int count;
wined3d_gl_limits_get_texture_unit_range(&context->gl_info->limits, i, &base_idx, &count);
context_bind_shader_resources(context, state, i, base_idx, count);
}
shader_types[] =
{
{WINED3D_SHADER_TYPE_PIXEL, 0, MAX_FRAGMENT_SAMPLERS},
{WINED3D_SHADER_TYPE_VERTEX, MAX_FRAGMENT_SAMPLERS, MAX_VERTEX_SAMPLERS},
};
for (i = 0; i < ARRAY_SIZE(shader_types); ++i)
context_bind_shader_resources(context, state, shader_types[i].type,
shader_types[i].base_idx, shader_types[i].count);
}
static void context_load_unordered_access_resources(struct wined3d_context *context,

View File

@ -592,26 +592,13 @@ static void shader_glsl_load_samplers(const struct wined3d_gl_info *gl_info,
static void shader_glsl_load_graphics_samplers(const struct wined3d_gl_info *gl_info,
struct shader_glsl_priv *priv, const DWORD *tex_unit_map, GLuint program_id)
{
const char *prefix;
unsigned int i;
unsigned int i, base_idx, count;
static const struct
for (i = 0; i < WINED3D_SHADER_TYPE_GRAPHICS_COUNT; ++i)
{
enum wined3d_shader_type type;
unsigned int base_idx;
unsigned int count;
}
sampler_info[] =
{
{WINED3D_SHADER_TYPE_PIXEL, 0, MAX_FRAGMENT_SAMPLERS},
{WINED3D_SHADER_TYPE_VERTEX, MAX_FRAGMENT_SAMPLERS, MAX_VERTEX_SAMPLERS},
};
for (i = 0; i < ARRAY_SIZE(sampler_info); ++i)
{
prefix = shader_glsl_get_prefix(sampler_info[i].type);
shader_glsl_load_samplers(gl_info, priv, prefix,
sampler_info[i].base_idx, sampler_info[i].count, tex_unit_map, program_id);
wined3d_gl_limits_get_texture_unit_range(&gl_info->limits, i, &base_idx, &count);
shader_glsl_load_samplers(gl_info, priv, shader_glsl_get_prefix(i),
base_idx, count, tex_unit_map, program_id);
}
}

View File

@ -5994,10 +5994,32 @@ void wined3d_gl_limits_get_uniform_block_range(const struct wined3d_gl_limits *g
void wined3d_gl_limits_get_texture_unit_range(const struct wined3d_gl_limits *gl_limits,
enum wined3d_shader_type shader_type, unsigned int *base, unsigned int *count)
{
static const struct
{
enum wined3d_shader_type type;
unsigned int base_idx;
unsigned int count;
}
legacy_sampler_info[] =
{
{WINED3D_SHADER_TYPE_PIXEL, 0, MAX_FRAGMENT_SAMPLERS},
{WINED3D_SHADER_TYPE_VERTEX, MAX_FRAGMENT_SAMPLERS, MAX_VERTEX_SAMPLERS},
};
unsigned int i;
for (i = 0; i < ARRAY_SIZE(legacy_sampler_info); ++i)
{
if (legacy_sampler_info[i].type == shader_type)
{
*base = legacy_sampler_info[i].base_idx;
*count = legacy_sampler_info[i].count;
return;
}
}
if (shader_type != WINED3D_SHADER_TYPE_COMPUTE)
{
*base = *count = 0;
ERR("Unhandled shader type %#x.\n", shader_type);
return;
}