wined3d: Store uniform blocks limits as array.

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-02-01 11:26:17 +01:00 committed by Alexandre Julliard
parent cd2c28433b
commit 6b32db4f0b
3 changed files with 23 additions and 31 deletions

View File

@ -3333,15 +3333,15 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info) static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
{ {
GLfloat gl_floatv[2]; GLfloat gl_floatv[2];
unsigned int i;
GLint gl_max; GLint gl_max;
gl_info->limits.blends = 1; gl_info->limits.blends = 1;
gl_info->limits.buffers = 1; gl_info->limits.buffers = 1;
gl_info->limits.textures = 1; gl_info->limits.textures = 1;
gl_info->limits.texture_coords = 1; gl_info->limits.texture_coords = 1;
gl_info->limits.vertex_uniform_blocks = 0; for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
gl_info->limits.geometry_uniform_blocks = 0; gl_info->limits.uniform_blocks[i] = 0;
gl_info->limits.fragment_uniform_blocks = 0;
gl_info->limits.fragment_samplers = 1; gl_info->limits.fragment_samplers = 1;
gl_info->limits.vertex_samplers = 0; gl_info->limits.vertex_samplers = 0;
gl_info->limits.combined_samplers = gl_info->limits.fragment_samplers + gl_info->limits.vertex_samplers; gl_info->limits.combined_samplers = gl_info->limits.fragment_samplers + gl_info->limits.vertex_samplers;
@ -3522,15 +3522,17 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT]) if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
{ {
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_VERTEX_UNIFORM_BLOCKS, &gl_max); gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_VERTEX_UNIFORM_BLOCKS, &gl_max);
gl_info->limits.vertex_uniform_blocks = min(gl_max, WINED3D_MAX_CBS); gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_VERTEX] = min(gl_max, WINED3D_MAX_CBS);
TRACE("Max vertex uniform blocks: %u (%d).\n", gl_info->limits.vertex_uniform_blocks, gl_max); TRACE("Max vertex uniform blocks: %u (%d).\n",
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_VERTEX], gl_max);
} }
} }
if (gl_info->supported[ARB_GEOMETRY_SHADER4] && gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT]) if (gl_info->supported[ARB_GEOMETRY_SHADER4] && gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
{ {
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_BLOCKS, &gl_max); gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_BLOCKS, &gl_max);
gl_info->limits.geometry_uniform_blocks = min(gl_max, WINED3D_MAX_CBS); gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_GEOMETRY] = min(gl_max, WINED3D_MAX_CBS);
TRACE("Max geometry uniform blocks: %u (%d).\n", gl_info->limits.geometry_uniform_blocks, gl_max); TRACE("Max geometry uniform blocks: %u (%d).\n",
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_GEOMETRY], gl_max);
} }
if (gl_info->supported[ARB_FRAGMENT_SHADER]) if (gl_info->supported[ARB_FRAGMENT_SHADER])
{ {
@ -3544,8 +3546,9 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT]) if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
{ {
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, &gl_max); gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, &gl_max);
gl_info->limits.fragment_uniform_blocks = min(gl_max, WINED3D_MAX_CBS); gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_PIXEL] = min(gl_max, WINED3D_MAX_CBS);
TRACE("Max fragment uniform blocks: %u (%d).\n", gl_info->limits.fragment_uniform_blocks, gl_max); TRACE("Max fragment uniform blocks: %u (%d).\n",
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_PIXEL], gl_max);
} }
} }
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT]) if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])

View File

@ -5904,26 +5904,17 @@ BOOL wined3d_clip_blit(const RECT *clip_rect, RECT *clipped, RECT *other)
void wined3d_gl_limits_get_uniform_block_range(const struct wined3d_gl_limits *gl_limits, void wined3d_gl_limits_get_uniform_block_range(const struct wined3d_gl_limits *gl_limits,
enum wined3d_shader_type shader_type, unsigned int *base, unsigned int *count) enum wined3d_shader_type shader_type, unsigned int *base, unsigned int *count)
{ {
unsigned int i;
*base = 0; *base = 0;
*count = gl_limits->vertex_uniform_blocks; for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
{
if (shader_type == WINED3D_SHADER_TYPE_VERTEX) *count = gl_limits->uniform_blocks[i];
if (i == shader_type)
return; return;
*base += *count; *base += *count;
*count = gl_limits->geometry_uniform_blocks; }
if (shader_type == WINED3D_SHADER_TYPE_GEOMETRY) ERR("Unrecognized shader type %#x.\n", shader_type);
return; *count = 0;
*base += *count;
*count = gl_limits->fragment_uniform_blocks;
if (shader_type == WINED3D_SHADER_TYPE_PIXEL)
return;
*base += *count;
*count = 0;
ERR("Unhandled shader type %#x.\n", shader_type);
} }

View File

@ -2146,9 +2146,7 @@ struct wined3d_gl_limits
UINT lights; UINT lights;
UINT textures; UINT textures;
UINT texture_coords; UINT texture_coords;
unsigned int vertex_uniform_blocks; unsigned int uniform_blocks[WINED3D_SHADER_TYPE_COUNT];
unsigned int geometry_uniform_blocks;
unsigned int fragment_uniform_blocks;
UINT fragment_samplers; UINT fragment_samplers;
UINT vertex_samplers; UINT vertex_samplers;
UINT combined_samplers; UINT combined_samplers;