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

wined3d: Allocate texture binding set for compute pipeline.

It seems that a majority of OpenGL implementations allow to statically partition texture bindings. For other implementations we are going to invalidate graphics pipeline texture bindings when appplying compute pipeline texture bindings, and vice versa. Signed-off-by: 's avatarJózef Kucia <jkucia@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 4c18c1b0
......@@ -1713,7 +1713,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
/* Initialize the texture unit mapping to a 1:1 mapping */
for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s)
{
if (s < gl_info->limits.combined_samplers)
if (s < gl_info->limits.graphics_samplers)
{
ret->tex_unit_map[s] = s;
ret->rev_tex_unit_map[s] = s;
......@@ -2962,7 +2962,7 @@ static void context_map_vsamplers(struct wined3d_context *context, BOOL ps, cons
state->shader[WINED3D_SHADER_TYPE_VERTEX]->reg_maps.resource_info;
const struct wined3d_shader_resource_info *ps_resource_info = NULL;
const struct wined3d_gl_info *gl_info = context->gl_info;
int start = min(MAX_COMBINED_SAMPLERS, gl_info->limits.combined_samplers) - 1;
int start = min(MAX_COMBINED_SAMPLERS, gl_info->limits.graphics_samplers) - 1;
int i;
/* Note that we only care if a resource is used or not, not the
......@@ -3012,7 +3012,7 @@ static void context_update_tex_unit_map(struct wined3d_context *context, const s
* When the mapping of a stage is changed, sampler and ALL texture stage
* states have to be reset. */
if (gl_info->limits.combined_samplers >= MAX_COMBINED_SAMPLERS)
if (gl_info->limits.graphics_samplers >= MAX_COMBINED_SAMPLERS)
return;
if (ps)
......
......@@ -3352,7 +3352,9 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
gl_info->limits.uniform_blocks[i] = 0;
gl_info->limits.fragment_samplers = 1;
gl_info->limits.vertex_samplers = 0;
gl_info->limits.compute_samplers = 0;
gl_info->limits.combined_samplers = gl_info->limits.fragment_samplers + gl_info->limits.vertex_samplers;
gl_info->limits.graphics_samplers = gl_info->limits.combined_samplers;
gl_info->limits.vertex_attribs = 16;
gl_info->limits.texture_buffer_offset_alignment = 1;
gl_info->limits.glsl_vs_float_constants = 0;
......@@ -3471,6 +3473,7 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
TRACE("Max vertex samplers: %u.\n", gl_info->limits.vertex_samplers);
TRACE("Max combined samplers: %u.\n", gl_info->limits.combined_samplers);
TRACE("Max vertex attributes: %u.\n", gl_info->limits.vertex_attribs);
gl_info->limits.graphics_samplers = gl_info->limits.combined_samplers;
}
if (gl_info->supported[ARB_VERTEX_BLEND])
{
......@@ -3570,6 +3573,13 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_COMPUTE] = min(gl_max, WINED3D_MAX_CBS);
TRACE("Max compute uniform blocks: %u (%d).\n",
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_COMPUTE], gl_max);
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS, &gl_max);
gl_info->limits.compute_samplers = gl_max;
TRACE("Max compute samplers: %u.\n", gl_info->limits.compute_samplers);
/* A majority of OpenGL implementations allow to statically partition
* the set of texture bindings into six separate sets. */
if (gl_info->limits.combined_samplers >= MAX_COMBINED_SAMPLERS + gl_info->limits.compute_samplers)
gl_info->limits.graphics_samplers -= gl_info->limits.compute_samplers;
}
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
{
......
......@@ -592,7 +592,7 @@ static void shader_glsl_load_samplers(const struct wined3d_gl_info *gl_info,
continue;
mapped_unit = tex_unit_map[sampler_info[i].base_idx + j];
if (mapped_unit == WINED3D_UNMAPPED_STAGE || mapped_unit >= gl_info->limits.combined_samplers)
if (mapped_unit == WINED3D_UNMAPPED_STAGE || mapped_unit >= gl_info->limits.graphics_samplers)
{
ERR("Trying to load sampler %s on unsupported unit %u.\n", sampler_name->buffer, mapped_unit);
continue;
......
......@@ -3604,10 +3604,8 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state
return;
}
if (mapped_stage >= gl_info->limits.combined_samplers)
{
if (mapped_stage >= gl_info->limits.graphics_samplers)
return;
}
context_active_texture(context, gl_info, mapped_stage);
if (state->textures[sampler_idx])
......
......@@ -2202,9 +2202,11 @@ struct wined3d_gl_limits
UINT textures;
UINT texture_coords;
unsigned int uniform_blocks[WINED3D_SHADER_TYPE_COUNT];
UINT fragment_samplers;
UINT vertex_samplers;
UINT combined_samplers;
unsigned int fragment_samplers;
unsigned int vertex_samplers;
unsigned int compute_samplers;
unsigned int graphics_samplers;
unsigned int combined_samplers;
UINT general_combiners;
UINT user_clip_distances;
UINT texture_size;
......
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