wined3d: Introduce wined3d_gl_limits_get_uniform_block_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:
parent
e2384387e0
commit
f6bd191385
|
@ -7518,13 +7518,14 @@ static void shader_glsl_init_ps_uniform_locations(const struct wined3d_gl_info *
|
|||
|
||||
static void shader_glsl_init_uniform_block_bindings(const struct wined3d_gl_info *gl_info,
|
||||
struct shader_glsl_priv *priv, GLuint program_id,
|
||||
const struct wined3d_shader_reg_maps *reg_maps, unsigned int base, unsigned int count)
|
||||
const struct wined3d_shader_reg_maps *reg_maps)
|
||||
{
|
||||
const char *prefix = shader_glsl_get_prefix(reg_maps->shader_version.type);
|
||||
GLuint block_idx;
|
||||
unsigned int i;
|
||||
struct wined3d_string_buffer *name = string_buffer_get(&priv->string_buffers);
|
||||
const char *prefix = shader_glsl_get_prefix(reg_maps->shader_version.type);
|
||||
unsigned int i, base, count;
|
||||
GLuint block_idx;
|
||||
|
||||
wined3d_gl_limits_get_uniform_block_range(&gl_info->limits, reg_maps->shader_version.type, &base, &count);
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
if (!reg_maps->cb_sizes[i])
|
||||
|
@ -7819,8 +7820,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
|
|||
if (entry->vs.pos_fixup_location != -1)
|
||||
entry->constant_update_mask |= WINED3D_SHADER_CONST_POS_FIXUP;
|
||||
|
||||
shader_glsl_init_uniform_block_bindings(gl_info, priv, program_id, &vshader->reg_maps,
|
||||
0, gl_info->limits.vertex_uniform_blocks);
|
||||
shader_glsl_init_uniform_block_bindings(gl_info, priv, program_id, &vshader->reg_maps);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7860,8 +7860,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
|
|||
if (gshader)
|
||||
{
|
||||
entry->constant_update_mask |= WINED3D_SHADER_CONST_POS_FIXUP;
|
||||
shader_glsl_init_uniform_block_bindings(gl_info, priv, program_id, &gshader->reg_maps,
|
||||
gl_info->limits.vertex_uniform_blocks, gl_info->limits.geometry_uniform_blocks);
|
||||
shader_glsl_init_uniform_block_bindings(gl_info, priv, program_id, &gshader->reg_maps);
|
||||
}
|
||||
|
||||
if (ps_id)
|
||||
|
@ -7876,9 +7875,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
|
|||
if (entry->ps.ycorrection_location != -1)
|
||||
entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_Y_CORR;
|
||||
|
||||
shader_glsl_init_uniform_block_bindings(gl_info, priv, program_id, &pshader->reg_maps,
|
||||
gl_info->limits.vertex_uniform_blocks + gl_info->limits.geometry_uniform_blocks,
|
||||
gl_info->limits.fragment_uniform_blocks);
|
||||
shader_glsl_init_uniform_block_bindings(gl_info, priv, program_id, &pshader->reg_maps);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -4849,30 +4849,34 @@ static void state_cb(const struct wined3d_gl_info *gl_info, const struct wined3d
|
|||
static void state_cb_vs(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
||||
{
|
||||
const struct wined3d_gl_limits *limits = &context->gl_info->limits;
|
||||
unsigned int base, count;
|
||||
|
||||
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
|
||||
|
||||
state_cb(context->gl_info, state, WINED3D_SHADER_TYPE_VERTEX, 0, limits->vertex_uniform_blocks);
|
||||
wined3d_gl_limits_get_uniform_block_range(limits, WINED3D_SHADER_TYPE_VERTEX, &base, &count);
|
||||
state_cb(context->gl_info, state, WINED3D_SHADER_TYPE_VERTEX, base, count);
|
||||
}
|
||||
|
||||
static void state_cb_gs(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
||||
{
|
||||
const struct wined3d_gl_limits *limits = &context->gl_info->limits;
|
||||
unsigned int base, count;
|
||||
|
||||
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
|
||||
|
||||
state_cb(context->gl_info, state, WINED3D_SHADER_TYPE_GEOMETRY,
|
||||
limits->vertex_uniform_blocks, limits->geometry_uniform_blocks);
|
||||
wined3d_gl_limits_get_uniform_block_range(limits, WINED3D_SHADER_TYPE_GEOMETRY, &base, &count);
|
||||
state_cb(context->gl_info, state, WINED3D_SHADER_TYPE_GEOMETRY, base, count);
|
||||
}
|
||||
|
||||
static void state_cb_ps(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
||||
{
|
||||
const struct wined3d_gl_limits *limits = &context->gl_info->limits;
|
||||
unsigned int base, count;
|
||||
|
||||
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
|
||||
|
||||
state_cb(context->gl_info, state, WINED3D_SHADER_TYPE_PIXEL,
|
||||
limits->vertex_uniform_blocks + limits->geometry_uniform_blocks, limits->fragment_uniform_blocks);
|
||||
wined3d_gl_limits_get_uniform_block_range(limits, WINED3D_SHADER_TYPE_PIXEL, &base, &count);
|
||||
state_cb(context->gl_info, state, WINED3D_SHADER_TYPE_PIXEL, base, count);
|
||||
}
|
||||
|
||||
static void state_cb_warn(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
||||
|
|
|
@ -5748,3 +5748,30 @@ BOOL wined3d_clip_blit(const RECT *clip_rect, RECT *clipped, RECT *other)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (shader_type == WINED3D_SHADER_TYPE_PIXEL)
|
||||
return;
|
||||
|
||||
*base += *count;
|
||||
*count = 0;
|
||||
|
||||
ERR("Unhandled shader type %#x.\n", shader_type);
|
||||
}
|
||||
|
|
|
@ -1971,9 +1971,9 @@ struct wined3d_gl_limits
|
|||
UINT lights;
|
||||
UINT textures;
|
||||
UINT texture_coords;
|
||||
UINT vertex_uniform_blocks;
|
||||
UINT geometry_uniform_blocks;
|
||||
UINT fragment_uniform_blocks;
|
||||
unsigned int vertex_uniform_blocks;
|
||||
unsigned int geometry_uniform_blocks;
|
||||
unsigned int fragment_uniform_blocks;
|
||||
UINT fragment_samplers;
|
||||
UINT vertex_samplers;
|
||||
UINT combined_samplers;
|
||||
|
@ -2004,6 +2004,9 @@ struct wined3d_gl_limits
|
|||
UINT arb_ps_temps;
|
||||
};
|
||||
|
||||
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) DECLSPEC_HIDDEN;
|
||||
|
||||
struct wined3d_gl_info
|
||||
{
|
||||
DWORD selected_gl_version;
|
||||
|
|
Loading…
Reference in New Issue