Commit 6b32db4f authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Store uniform blocks limits as array.

parent cd2c2843
......@@ -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)
{
GLfloat gl_floatv[2];
unsigned int i;
GLint gl_max;
gl_info->limits.blends = 1;
gl_info->limits.buffers = 1;
gl_info->limits.textures = 1;
gl_info->limits.texture_coords = 1;
gl_info->limits.vertex_uniform_blocks = 0;
gl_info->limits.geometry_uniform_blocks = 0;
gl_info->limits.fragment_uniform_blocks = 0;
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
gl_info->limits.uniform_blocks[i] = 0;
gl_info->limits.fragment_samplers = 1;
gl_info->limits.vertex_samplers = 0;
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])
{
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);
TRACE("Max vertex uniform blocks: %u (%d).\n", gl_info->limits.vertex_uniform_blocks, gl_max);
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.uniform_blocks[WINED3D_SHADER_TYPE_VERTEX], gl_max);
}
}
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->limits.geometry_uniform_blocks = min(gl_max, WINED3D_MAX_CBS);
TRACE("Max geometry uniform blocks: %u (%d).\n", gl_info->limits.geometry_uniform_blocks, gl_max);
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.uniform_blocks[WINED3D_SHADER_TYPE_GEOMETRY], gl_max);
}
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])
{
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);
TRACE("Max fragment uniform blocks: %u (%d).\n", gl_info->limits.fragment_uniform_blocks, gl_max);
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.uniform_blocks[WINED3D_SHADER_TYPE_PIXEL], gl_max);
}
}
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
......
......@@ -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,
enum wined3d_shader_type shader_type, unsigned int *base, unsigned int *count)
{
*base = 0;
*count = gl_limits->vertex_uniform_blocks;
if (shader_type == WINED3D_SHADER_TYPE_VERTEX)
return;
*base += *count;
*count = gl_limits->geometry_uniform_blocks;
if (shader_type == WINED3D_SHADER_TYPE_GEOMETRY)
return;
*base += *count;
*count = gl_limits->fragment_uniform_blocks;
unsigned int i;
if (shader_type == WINED3D_SHADER_TYPE_PIXEL)
return;
*base = 0;
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
{
*count = gl_limits->uniform_blocks[i];
if (i == shader_type)
return;
*base += *count;
}
*base += *count;
ERR("Unrecognized shader type %#x.\n", shader_type);
*count = 0;
ERR("Unhandled shader type %#x.\n", shader_type);
}
......@@ -2146,9 +2146,7 @@ struct wined3d_gl_limits
UINT lights;
UINT textures;
UINT texture_coords;
unsigned int vertex_uniform_blocks;
unsigned int geometry_uniform_blocks;
unsigned int fragment_uniform_blocks;
unsigned int uniform_blocks[WINED3D_SHADER_TYPE_COUNT];
UINT fragment_samplers;
UINT vertex_samplers;
UINT combined_samplers;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment