gallium: add unbind_num_trailing_slots to set_sampler_views
Instead of calling this functions again to unbind trailing slots, extend it to do it when binding. This reduces CPU overhead. A lot of drivers ignore "start" and always unbind all slots after "count". Such drivers don't need any changes here. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8298>
This commit is contained in:
parent
72ff66c3d7
commit
b688ea31fc
|
@ -337,7 +337,7 @@ void cso_destroy_context( struct cso_context *ctx )
|
||||||
ctx->pipe->bind_sampler_states(ctx->pipe, sh, 0, maxsam, zeros);
|
ctx->pipe->bind_sampler_states(ctx->pipe, sh, 0, maxsam, zeros);
|
||||||
}
|
}
|
||||||
if (maxview > 0) {
|
if (maxview > 0) {
|
||||||
ctx->pipe->set_sampler_views(ctx->pipe, sh, 0, maxview, views);
|
ctx->pipe->set_sampler_views(ctx->pipe, sh, 0, maxview, 0, views);
|
||||||
}
|
}
|
||||||
if (maxssbo > 0) {
|
if (maxssbo > 0) {
|
||||||
ctx->pipe->set_shader_buffers(ctx->pipe, sh, 0, maxssbo, ssbos, 0);
|
ctx->pipe->set_shader_buffers(ctx->pipe, sh, 0, maxssbo, ssbos, 0);
|
||||||
|
|
|
@ -108,6 +108,7 @@ struct pstip_stage
|
||||||
void (*driver_set_sampler_views)(struct pipe_context *,
|
void (*driver_set_sampler_views)(struct pipe_context *,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned count,
|
unsigned start, unsigned count,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **);
|
struct pipe_sampler_view **);
|
||||||
|
|
||||||
void (*driver_set_polygon_stipple)(struct pipe_context *,
|
void (*driver_set_polygon_stipple)(struct pipe_context *,
|
||||||
|
@ -225,7 +226,7 @@ pstip_first_tri(struct draw_stage *stage, struct prim_header *header)
|
||||||
num_samplers, pstip->state.samplers);
|
num_samplers, pstip->state.samplers);
|
||||||
|
|
||||||
pstip->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
|
pstip->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
|
||||||
num_sampler_views, pstip->state.sampler_views);
|
num_sampler_views, 0, pstip->state.sampler_views);
|
||||||
|
|
||||||
draw->suspend_flushing = FALSE;
|
draw->suspend_flushing = FALSE;
|
||||||
|
|
||||||
|
@ -254,7 +255,7 @@ pstip_flush(struct draw_stage *stage, unsigned flags)
|
||||||
pstip->state.samplers);
|
pstip->state.samplers);
|
||||||
|
|
||||||
pstip->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
|
pstip->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
|
||||||
pstip->num_sampler_views,
|
pstip->num_sampler_views, 0,
|
||||||
pstip->state.sampler_views);
|
pstip->state.sampler_views);
|
||||||
|
|
||||||
draw->suspend_flushing = FALSE;
|
draw->suspend_flushing = FALSE;
|
||||||
|
@ -418,6 +419,7 @@ static void
|
||||||
pstip_set_sampler_views(struct pipe_context *pipe,
|
pstip_set_sampler_views(struct pipe_context *pipe,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned num,
|
unsigned start, unsigned num,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct pstip_stage *pstip = pstip_stage_from_pipe(pipe);
|
struct pstip_stage *pstip = pstip_stage_from_pipe(pipe);
|
||||||
|
@ -429,11 +431,16 @@ pstip_set_sampler_views(struct pipe_context *pipe,
|
||||||
pipe_sampler_view_reference(&pstip->state.sampler_views[start + i],
|
pipe_sampler_view_reference(&pstip->state.sampler_views[start + i],
|
||||||
views[i]);
|
views[i]);
|
||||||
}
|
}
|
||||||
|
for (; i < num + unbind_num_trailing_slots; i++) {
|
||||||
|
pipe_sampler_view_reference(&pstip->state.sampler_views[start + i],
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
pstip->num_sampler_views = num;
|
pstip->num_sampler_views = num;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pass-through */
|
/* pass-through */
|
||||||
pstip->driver_set_sampler_views(pstip->pipe, shader, start, num, views);
|
pstip->driver_set_sampler_views(pstip->pipe, shader, start, num,
|
||||||
|
unbind_num_trailing_slots, views);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -510,6 +510,7 @@ static void
|
||||||
dd_context_set_sampler_views(struct pipe_context *_pipe,
|
dd_context_set_sampler_views(struct pipe_context *_pipe,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned num,
|
unsigned start, unsigned num,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct dd_context *dctx = dd_context(_pipe);
|
struct dd_context *dctx = dd_context(_pipe);
|
||||||
|
@ -517,7 +518,10 @@ dd_context_set_sampler_views(struct pipe_context *_pipe,
|
||||||
|
|
||||||
safe_memcpy(&dctx->draw_state.sampler_views[shader][start], views,
|
safe_memcpy(&dctx->draw_state.sampler_views[shader][start], views,
|
||||||
sizeof(views[0]) * num);
|
sizeof(views[0]) * num);
|
||||||
pipe->set_sampler_views(pipe, shader, start, num, views);
|
safe_memcpy(&dctx->draw_state.sampler_views[shader][start + num], views,
|
||||||
|
sizeof(views[0]) * unbind_num_trailing_slots);
|
||||||
|
pipe->set_sampler_views(pipe, shader, start, num,
|
||||||
|
unbind_num_trailing_slots, views);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -114,6 +114,7 @@ static struct pipe_surface *noop_create_surface(struct pipe_context *ctx,
|
||||||
static void noop_set_sampler_views(struct pipe_context *ctx,
|
static void noop_set_sampler_views(struct pipe_context *ctx,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned count,
|
unsigned start, unsigned count,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -738,6 +738,7 @@ rbug_set_sampler_views(struct pipe_context *_pipe,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start,
|
unsigned start,
|
||||||
unsigned num,
|
unsigned num,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **_views)
|
struct pipe_sampler_view **_views)
|
||||||
{
|
{
|
||||||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||||
|
@ -766,7 +767,8 @@ rbug_set_sampler_views(struct pipe_context *_pipe,
|
||||||
views = unwrapped_views;
|
views = unwrapped_views;
|
||||||
}
|
}
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, shader, start, num, views);
|
pipe->set_sampler_views(pipe, shader, start, num,
|
||||||
|
unbind_num_trailing_slots, views);
|
||||||
|
|
||||||
mtx_unlock(&rb_pipe->call_mutex);
|
mtx_unlock(&rb_pipe->call_mutex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -987,6 +987,7 @@ trace_context_set_sampler_views(struct pipe_context *_pipe,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start,
|
unsigned start,
|
||||||
unsigned num,
|
unsigned num,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct trace_context *tr_ctx = trace_context(_pipe);
|
struct trace_context *tr_ctx = trace_context(_pipe);
|
||||||
|
@ -1010,9 +1011,11 @@ trace_context_set_sampler_views(struct pipe_context *_pipe,
|
||||||
trace_dump_arg(uint, shader);
|
trace_dump_arg(uint, shader);
|
||||||
trace_dump_arg(uint, start);
|
trace_dump_arg(uint, start);
|
||||||
trace_dump_arg(uint, num);
|
trace_dump_arg(uint, num);
|
||||||
|
trace_dump_arg(uint, unbind_num_trailing_slots);
|
||||||
trace_dump_arg_array(ptr, views, num);
|
trace_dump_arg_array(ptr, views, num);
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, shader, start, num, views);
|
pipe->set_sampler_views(pipe, shader, start, num,
|
||||||
|
unbind_num_trailing_slots, views);
|
||||||
|
|
||||||
trace_dump_call_end();
|
trace_dump_call_end();
|
||||||
}
|
}
|
||||||
|
|
|
@ -537,7 +537,7 @@ hud_draw_results(struct hud_context *hud, struct pipe_resource *tex)
|
||||||
cso_set_vertex_shader_handle(cso, hud->vs);
|
cso_set_vertex_shader_handle(cso, hud->vs);
|
||||||
cso_set_vertex_elements(cso, &hud->velems);
|
cso_set_vertex_elements(cso, &hud->velems);
|
||||||
cso_set_render_condition(cso, NULL, FALSE, 0);
|
cso_set_render_condition(cso, NULL, FALSE, 0);
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1,
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0,
|
||||||
&hud->font_sampler_view);
|
&hud->font_sampler_view);
|
||||||
cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, 1, sampler_states);
|
cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, 1, sampler_states);
|
||||||
pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, false, &hud->constbuf);
|
pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, false, &hud->constbuf);
|
||||||
|
@ -608,7 +608,7 @@ done:
|
||||||
/* Unbind resources that we have bound. */
|
/* Unbind resources that we have bound. */
|
||||||
pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, false, NULL);
|
pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, false, NULL);
|
||||||
pipe->set_vertex_buffers(pipe, 0, 0, 1, NULL);
|
pipe->set_vertex_buffers(pipe, 0, 0, 1, NULL);
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, NULL);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0, 1, NULL);
|
||||||
|
|
||||||
/* restore states not restored by cso */
|
/* restore states not restored by cso */
|
||||||
if (hud->st) {
|
if (hud->st) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ pp_nocolor(struct pp_queue_t *ppq, struct pipe_resource *in,
|
||||||
pp_filter_misc_state(p);
|
pp_filter_misc_state(p);
|
||||||
|
|
||||||
cso_set_samplers(p->cso, PIPE_SHADER_FRAGMENT, 1, samplers);
|
cso_set_samplers(p->cso, PIPE_SHADER_FRAGMENT, 1, samplers);
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &p->view);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &p->view);
|
||||||
|
|
||||||
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][0]);
|
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][0]);
|
||||||
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][1]);
|
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][1]);
|
||||||
|
|
|
@ -134,7 +134,7 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in,
|
||||||
const struct pipe_sampler_state *samplers[] = {&p->sampler_point};
|
const struct pipe_sampler_state *samplers[] = {&p->sampler_point};
|
||||||
cso_set_samplers(p->cso, PIPE_SHADER_FRAGMENT, 1, samplers);
|
cso_set_samplers(p->cso, PIPE_SHADER_FRAGMENT, 1, samplers);
|
||||||
}
|
}
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &p->view);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &p->view);
|
||||||
|
|
||||||
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][1]); /* offsetvs */
|
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][1]); /* offsetvs */
|
||||||
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][2]);
|
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][2]);
|
||||||
|
@ -166,7 +166,7 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in,
|
||||||
}
|
}
|
||||||
|
|
||||||
arr[0] = p->view;
|
arr[0] = p->view;
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 3, arr);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 3, 0, arr);
|
||||||
|
|
||||||
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][0]); /* passvs */
|
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][0]); /* passvs */
|
||||||
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][3]);
|
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][3]);
|
||||||
|
@ -198,7 +198,7 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in,
|
||||||
}
|
}
|
||||||
|
|
||||||
arr[1] = p->view;
|
arr[1] = p->view;
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 2, arr);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 2, 0, arr);
|
||||||
|
|
||||||
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][1]); /* offsetvs */
|
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][1]); /* offsetvs */
|
||||||
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][4]);
|
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][4]);
|
||||||
|
|
|
@ -191,7 +191,7 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
|
||||||
pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, false, NULL);
|
pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, false, NULL);
|
||||||
pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, false, NULL);
|
pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, false, NULL);
|
||||||
pipe->set_vertex_buffers(pipe, 0, 0, 1, NULL);
|
pipe->set_vertex_buffers(pipe, 0, 0, 1, NULL);
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 3, NULL);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0, 3, NULL);
|
||||||
|
|
||||||
/* restore states not restored by cso */
|
/* restore states not restored by cso */
|
||||||
if (ppq->p->st) {
|
if (ppq->p->st) {
|
||||||
|
|
|
@ -784,7 +784,7 @@ void util_blitter_restore_textures(struct blitter_context *blitter)
|
||||||
|
|
||||||
/* Fragment sampler views. */
|
/* Fragment sampler views. */
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
|
||||||
ctx->base.saved_num_sampler_views,
|
ctx->base.saved_num_sampler_views, 0,
|
||||||
ctx->base.saved_sampler_views);
|
ctx->base.saved_sampler_views);
|
||||||
|
|
||||||
for (i = 0; i < ctx->base.saved_num_sampler_views; i++)
|
for (i = 0; i < ctx->base.saved_num_sampler_views; i++)
|
||||||
|
@ -2082,7 +2082,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
|
||||||
views[0] = src;
|
views[0] = src;
|
||||||
views[1] = pipe->create_sampler_view(pipe, src->texture, &templ);
|
views[1] = pipe->create_sampler_view(pipe, src->texture, &templ);
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 2, views);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 2, 0, views);
|
||||||
pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0, 2, samplers);
|
pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0, 2, samplers);
|
||||||
|
|
||||||
pipe_sampler_view_reference(&views[1], NULL);
|
pipe_sampler_view_reference(&views[1], NULL);
|
||||||
|
@ -2097,13 +2097,13 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
|
||||||
|
|
||||||
view = pipe->create_sampler_view(pipe, src->texture, &templ);
|
view = pipe->create_sampler_view(pipe, src->texture, &templ);
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &view);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &view);
|
||||||
pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT,
|
pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 1, &sampler_state);
|
0, 1, &sampler_state);
|
||||||
|
|
||||||
pipe_sampler_view_reference(&view, NULL);
|
pipe_sampler_view_reference(&view, NULL);
|
||||||
} else {
|
} else {
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &src);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &src);
|
||||||
pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT,
|
pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 1, &sampler_state);
|
0, 1, &sampler_state);
|
||||||
}
|
}
|
||||||
|
@ -2250,7 +2250,7 @@ void util_blitter_generate_mipmap(struct blitter_context *blitter,
|
||||||
src_templ.format = format;
|
src_templ.format = format;
|
||||||
src_view = pipe->create_sampler_view(pipe, tex, &src_templ);
|
src_view = pipe->create_sampler_view(pipe, tex, &src_templ);
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &src_view);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &src_view);
|
||||||
|
|
||||||
do_blits(ctx, dst_view, &dstbox, src_view, tex->width0, tex->height0,
|
do_blits(ctx, dst_view, &dstbox, src_view, tex->width0, tex->height0,
|
||||||
&srcbox, is_depth, false);
|
&srcbox, is_depth, false);
|
||||||
|
@ -2884,7 +2884,7 @@ util_blitter_stencil_fallback(struct blitter_context *blitter,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &src_view);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &src_view);
|
||||||
pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &ctx->sampler_state);
|
pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &ctx->sampler_state);
|
||||||
|
|
||||||
unsigned stencil_bits =
|
unsigned stencil_bits =
|
||||||
|
|
|
@ -138,7 +138,7 @@ void util_compute_blit(struct pipe_context *ctx, struct pipe_blit_info *blit_inf
|
||||||
u_sampler_view_default_template(&src_templ, src, src->format);
|
u_sampler_view_default_template(&src_templ, src, src->format);
|
||||||
src_templ.format = util_format_linear(blit_info->src.format);
|
src_templ.format = util_format_linear(blit_info->src.format);
|
||||||
src_view = ctx->create_sampler_view(ctx, src, &src_templ);
|
src_view = ctx->create_sampler_view(ctx, src, &src_templ);
|
||||||
ctx->set_sampler_views(ctx, PIPE_SHADER_COMPUTE, 0, 1, &src_view);
|
ctx->set_sampler_views(ctx, PIPE_SHADER_COMPUTE, 0, 1, 0, &src_view);
|
||||||
|
|
||||||
if (!*compute_state)
|
if (!*compute_state)
|
||||||
*compute_state = blit_compute_shader(ctx);
|
*compute_state = blit_compute_shader(ctx);
|
||||||
|
@ -159,7 +159,7 @@ void util_compute_blit(struct pipe_context *ctx, struct pipe_blit_info *blit_inf
|
||||||
|
|
||||||
ctx->set_shader_images(ctx, PIPE_SHADER_COMPUTE, 0, 0, 1, NULL);
|
ctx->set_shader_images(ctx, PIPE_SHADER_COMPUTE, 0, 0, 1, NULL);
|
||||||
ctx->set_constant_buffer(ctx, PIPE_SHADER_COMPUTE, 0, false, NULL);
|
ctx->set_constant_buffer(ctx, PIPE_SHADER_COMPUTE, 0, false, NULL);
|
||||||
ctx->set_sampler_views(ctx, PIPE_SHADER_COMPUTE, 0, 1, NULL);
|
ctx->set_sampler_views(ctx, PIPE_SHADER_COMPUTE, 0, 0, 1, NULL);
|
||||||
pipe_sampler_view_reference(&src_view, NULL);
|
pipe_sampler_view_reference(&src_view, NULL);
|
||||||
ctx->delete_sampler_state(ctx, sampler_state_p);
|
ctx->delete_sampler_state(ctx, sampler_state_p);
|
||||||
ctx->bind_compute_state(ctx, NULL);
|
ctx->bind_compute_state(ctx, NULL);
|
||||||
|
|
|
@ -388,7 +388,7 @@ null_sampler_view(struct pipe_context *ctx, unsigned tgsi_tex_target)
|
||||||
PIPE_FORMAT_R8G8B8A8_UNORM, 0);
|
PIPE_FORMAT_R8G8B8A8_UNORM, 0);
|
||||||
util_set_common_states_and_clear(cso, ctx, cb);
|
util_set_common_states_and_clear(cso, ctx, cb);
|
||||||
|
|
||||||
ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, NULL);
|
ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 0, 1, NULL);
|
||||||
|
|
||||||
/* Fragment shader. */
|
/* Fragment shader. */
|
||||||
fs = util_make_fragment_tex_shader(ctx, tgsi_tex_target,
|
fs = util_make_fragment_tex_shader(ctx, tgsi_tex_target,
|
||||||
|
@ -698,7 +698,7 @@ test_texture_barrier(struct pipe_context *ctx, bool use_fbfetch,
|
||||||
templ.swizzle_b = PIPE_SWIZZLE_Z;
|
templ.swizzle_b = PIPE_SWIZZLE_Z;
|
||||||
templ.swizzle_a = PIPE_SWIZZLE_W;
|
templ.swizzle_a = PIPE_SWIZZLE_W;
|
||||||
view = ctx->create_sampler_view(ctx, cb, &templ);
|
view = ctx->create_sampler_view(ctx, cb, &templ);
|
||||||
ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &view);
|
ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &view);
|
||||||
|
|
||||||
/* Fragment shader. */
|
/* Fragment shader. */
|
||||||
if (num_samples > 1) {
|
if (num_samples > 1) {
|
||||||
|
|
|
@ -941,7 +941,7 @@ tc_set_window_rectangles(struct pipe_context *_pipe, bool include,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tc_sampler_views {
|
struct tc_sampler_views {
|
||||||
ubyte shader, start, count;
|
ubyte shader, start, count, unbind_num_trailing_slots;
|
||||||
struct pipe_sampler_view *slot[0]; /* more will be allocated if needed */
|
struct pipe_sampler_view *slot[0]; /* more will be allocated if needed */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -951,7 +951,8 @@ tc_call_set_sampler_views(struct pipe_context *pipe, union tc_payload *payload)
|
||||||
struct tc_sampler_views *p = (struct tc_sampler_views *)payload;
|
struct tc_sampler_views *p = (struct tc_sampler_views *)payload;
|
||||||
unsigned count = p->count;
|
unsigned count = p->count;
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, p->shader, p->start, p->count, p->slot);
|
pipe->set_sampler_views(pipe, p->shader, p->start, p->count,
|
||||||
|
p->unbind_num_trailing_slots, p->slot);
|
||||||
for (unsigned i = 0; i < count; i++)
|
for (unsigned i = 0; i < count; i++)
|
||||||
pipe_sampler_view_reference(&p->slot[i], NULL);
|
pipe_sampler_view_reference(&p->slot[i], NULL);
|
||||||
}
|
}
|
||||||
|
@ -960,9 +961,10 @@ static void
|
||||||
tc_set_sampler_views(struct pipe_context *_pipe,
|
tc_set_sampler_views(struct pipe_context *_pipe,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned count,
|
unsigned start, unsigned count,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
if (!count)
|
if (!count && !unbind_num_trailing_slots)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
struct threaded_context *tc = threaded_context(_pipe);
|
struct threaded_context *tc = threaded_context(_pipe);
|
||||||
|
@ -972,6 +974,7 @@ tc_set_sampler_views(struct pipe_context *_pipe,
|
||||||
p->shader = shader;
|
p->shader = shader;
|
||||||
p->start = start;
|
p->start = start;
|
||||||
p->count = count;
|
p->count = count;
|
||||||
|
p->unbind_num_trailing_slots = unbind_num_trailing_slots;
|
||||||
|
|
||||||
if (views) {
|
if (views) {
|
||||||
for (unsigned i = 0; i < count; i++) {
|
for (unsigned i = 0; i < count; i++) {
|
||||||
|
|
|
@ -452,7 +452,7 @@ vl_bicubic_filter_render(struct vl_bicubic_filter *filter,
|
||||||
filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
|
filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 1, &filter->sampler);
|
0, 1, &filter->sampler);
|
||||||
filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
|
filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 1, &src);
|
0, 1, 0, &src);
|
||||||
filter->pipe->bind_vs_state(filter->pipe, filter->vs);
|
filter->pipe->bind_vs_state(filter->pipe, filter->vs);
|
||||||
filter->pipe->bind_fs_state(filter->pipe, filter->fs);
|
filter->pipe->bind_fs_state(filter->pipe, filter->fs);
|
||||||
filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
|
filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
|
||||||
|
|
|
@ -727,14 +727,14 @@ draw_layers(struct vl_compositor *c,
|
||||||
c->pipe->bind_sampler_states(c->pipe, PIPE_SHADER_COMPUTE, 0,
|
c->pipe->bind_sampler_states(c->pipe, PIPE_SHADER_COMPUTE, 0,
|
||||||
num_sampler_views, layer->samplers);
|
num_sampler_views, layer->samplers);
|
||||||
c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_COMPUTE, 0,
|
c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_COMPUTE, 0,
|
||||||
num_sampler_views, samplers);
|
num_sampler_views, 0, samplers);
|
||||||
|
|
||||||
cs_launch(c, layer->cs, &(drawn.area));
|
cs_launch(c, layer->cs, &(drawn.area));
|
||||||
|
|
||||||
/* Unbind. */
|
/* Unbind. */
|
||||||
c->pipe->set_shader_images(c->pipe, PIPE_SHADER_COMPUTE, 0, 0, 1, NULL);
|
c->pipe->set_shader_images(c->pipe, PIPE_SHADER_COMPUTE, 0, 0, 1, NULL);
|
||||||
c->pipe->set_constant_buffer(c->pipe, PIPE_SHADER_COMPUTE, 0, false, NULL);
|
c->pipe->set_constant_buffer(c->pipe, PIPE_SHADER_COMPUTE, 0, false, NULL);
|
||||||
c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_FRAGMENT, 0,
|
c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_FRAGMENT, 0, 0,
|
||||||
num_sampler_views, NULL);
|
num_sampler_views, NULL);
|
||||||
c->pipe->bind_compute_state(c->pipe, NULL);
|
c->pipe->bind_compute_state(c->pipe, NULL);
|
||||||
c->pipe->bind_sampler_states(c->pipe, PIPE_SHADER_COMPUTE, 0,
|
c->pipe->bind_sampler_states(c->pipe, PIPE_SHADER_COMPUTE, 0,
|
||||||
|
|
|
@ -665,7 +665,7 @@ draw_layers(struct vl_compositor *c, struct vl_compositor_state *s, struct u_rec
|
||||||
c->pipe->bind_sampler_states(c->pipe, PIPE_SHADER_FRAGMENT, 0,
|
c->pipe->bind_sampler_states(c->pipe, PIPE_SHADER_FRAGMENT, 0,
|
||||||
num_sampler_views, layer->samplers);
|
num_sampler_views, layer->samplers);
|
||||||
c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_FRAGMENT, 0,
|
c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_FRAGMENT, 0,
|
||||||
num_sampler_views, samplers);
|
num_sampler_views, 0, samplers);
|
||||||
|
|
||||||
util_draw_arrays(c->pipe, PIPE_PRIM_QUADS, vb_index * 4, 4);
|
util_draw_arrays(c->pipe, PIPE_PRIM_QUADS, vb_index * 4, 4);
|
||||||
vb_index++;
|
vb_index++;
|
||||||
|
|
|
@ -497,7 +497,7 @@ vl_deint_filter_render(struct vl_deint_filter *filter,
|
||||||
sampler_views[1] = prev_sv[k];
|
sampler_views[1] = prev_sv[k];
|
||||||
sampler_views[2] = cur_sv[k];
|
sampler_views[2] = cur_sv[k];
|
||||||
sampler_views[3] = next_sv[k];
|
sampler_views[3] = next_sv[k];
|
||||||
filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT, 0, 4, sampler_views);
|
filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT, 0, 4, 0, sampler_views);
|
||||||
|
|
||||||
/* blit current field */
|
/* blit current field */
|
||||||
fb_state.cbufs[0] = blit_surf;
|
fb_state.cbufs[0] = blit_surf;
|
||||||
|
|
|
@ -827,7 +827,7 @@ vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_
|
||||||
idct->pipe->bind_sampler_states(idct->pipe, PIPE_SHADER_FRAGMENT,
|
idct->pipe->bind_sampler_states(idct->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 2, idct->samplers);
|
0, 2, idct->samplers);
|
||||||
|
|
||||||
idct->pipe->set_sampler_views(idct->pipe, PIPE_SHADER_FRAGMENT, 0, 2,
|
idct->pipe->set_sampler_views(idct->pipe, PIPE_SHADER_FRAGMENT, 0, 2, 0,
|
||||||
buffer->sampler_views.stage[0]);
|
buffer->sampler_views.stage[0]);
|
||||||
|
|
||||||
/* mismatch control */
|
/* mismatch control */
|
||||||
|
@ -855,6 +855,6 @@ vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer)
|
||||||
idct->pipe->bind_sampler_states(idct->pipe, PIPE_SHADER_FRAGMENT,
|
idct->pipe->bind_sampler_states(idct->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 2, idct->samplers);
|
0, 2, idct->samplers);
|
||||||
idct->pipe->set_sampler_views(idct->pipe, PIPE_SHADER_FRAGMENT,
|
idct->pipe->set_sampler_views(idct->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 2, buffer->sampler_views.stage[1]);
|
0, 2, 0, buffer->sampler_views.stage[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,7 +291,7 @@ vl_matrix_filter_render(struct vl_matrix_filter *filter,
|
||||||
filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
|
filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 1, &filter->sampler);
|
0, 1, &filter->sampler);
|
||||||
filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
|
filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 1, &src);
|
0, 1, 0, &src);
|
||||||
filter->pipe->bind_vs_state(filter->pipe, filter->vs);
|
filter->pipe->bind_vs_state(filter->pipe, filter->vs);
|
||||||
filter->pipe->bind_fs_state(filter->pipe, filter->fs);
|
filter->pipe->bind_fs_state(filter->pipe, filter->fs);
|
||||||
filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
|
filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
|
||||||
|
|
|
@ -618,7 +618,7 @@ vl_mc_render_ref(struct vl_mc *renderer, struct vl_mc_buffer *buffer, struct pip
|
||||||
renderer->pipe->bind_fs_state(renderer->pipe, renderer->fs_ref);
|
renderer->pipe->bind_fs_state(renderer->pipe, renderer->fs_ref);
|
||||||
|
|
||||||
renderer->pipe->set_sampler_views(renderer->pipe, PIPE_SHADER_FRAGMENT,
|
renderer->pipe->set_sampler_views(renderer->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 1, &ref);
|
0, 1, 0, &ref);
|
||||||
renderer->pipe->bind_sampler_states(renderer->pipe, PIPE_SHADER_FRAGMENT,
|
renderer->pipe->bind_sampler_states(renderer->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 1, &renderer->sampler_ref);
|
0, 1, &renderer->sampler_ref);
|
||||||
|
|
||||||
|
|
|
@ -395,7 +395,7 @@ vl_median_filter_render(struct vl_median_filter *filter,
|
||||||
filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
|
filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 1, &filter->sampler);
|
0, 1, &filter->sampler);
|
||||||
filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
|
filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 1, &src);
|
0, 1, 0, &src);
|
||||||
filter->pipe->bind_vs_state(filter->pipe, filter->vs);
|
filter->pipe->bind_vs_state(filter->pipe, filter->vs);
|
||||||
filter->pipe->bind_fs_state(filter->pipe, filter->fs);
|
filter->pipe->bind_fs_state(filter->pipe, filter->fs);
|
||||||
filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
|
filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
|
||||||
|
|
|
@ -830,7 +830,7 @@ vl_mpeg12_end_frame(struct pipe_video_codec *decoder,
|
||||||
vl_idct_prepare_stage2(i ? &dec->idct_c : &dec->idct_y, &buf->idct[plane]);
|
vl_idct_prepare_stage2(i ? &dec->idct_c : &dec->idct_y, &buf->idct[plane]);
|
||||||
else {
|
else {
|
||||||
dec->context->set_sampler_views(dec->context,
|
dec->context->set_sampler_views(dec->context,
|
||||||
PIPE_SHADER_FRAGMENT, 0, 1,
|
PIPE_SHADER_FRAGMENT, 0, 1, 0,
|
||||||
&mc_source_sv[plane]);
|
&mc_source_sv[plane]);
|
||||||
dec->context->bind_sampler_states(dec->context,
|
dec->context->bind_sampler_states(dec->context,
|
||||||
PIPE_SHADER_FRAGMENT,
|
PIPE_SHADER_FRAGMENT,
|
||||||
|
|
|
@ -604,7 +604,7 @@ vl_zscan_render(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, unsigned
|
||||||
zscan->pipe->set_framebuffer_state(zscan->pipe, &buffer->fb_state);
|
zscan->pipe->set_framebuffer_state(zscan->pipe, &buffer->fb_state);
|
||||||
zscan->pipe->set_viewport_states(zscan->pipe, 0, 1, &buffer->viewport);
|
zscan->pipe->set_viewport_states(zscan->pipe, 0, 1, &buffer->viewport);
|
||||||
zscan->pipe->set_sampler_views(zscan->pipe, PIPE_SHADER_FRAGMENT,
|
zscan->pipe->set_sampler_views(zscan->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
0, 3, &buffer->src);
|
0, 3, 0, &buffer->src);
|
||||||
zscan->pipe->bind_vs_state(zscan->pipe, zscan->vs);
|
zscan->pipe->bind_vs_state(zscan->pipe, zscan->vs);
|
||||||
zscan->pipe->bind_fs_state(zscan->pipe, zscan->fs);
|
zscan->pipe->bind_fs_state(zscan->pipe, zscan->fs);
|
||||||
util_draw_arrays_instanced(zscan->pipe, PIPE_PRIM_QUADS, 0, 4, 0, num_instances);
|
util_draw_arrays_instanced(zscan->pipe, PIPE_PRIM_QUADS, 0, 4, 0, num_instances);
|
||||||
|
|
|
@ -739,7 +739,7 @@ resolve_stencil_to_temp(struct d3d12_context *ctx,
|
||||||
void *sampler_state = get_sampler_state(ctx);
|
void *sampler_state = get_sampler_state(ctx);
|
||||||
|
|
||||||
util_blit_save_state(ctx);
|
util_blit_save_state(ctx);
|
||||||
pctx->set_sampler_views(pctx, PIPE_SHADER_FRAGMENT, 0, 1, &src_view);
|
pctx->set_sampler_views(pctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &src_view);
|
||||||
pctx->bind_sampler_states(pctx, PIPE_SHADER_FRAGMENT, 0, 1, &sampler_state);
|
pctx->bind_sampler_states(pctx, PIPE_SHADER_FRAGMENT, 0, 1, &sampler_state);
|
||||||
util_blitter_custom_shader(ctx->blitter, dst_surf,
|
util_blitter_custom_shader(ctx->blitter, dst_surf,
|
||||||
get_stencil_resolve_vs(ctx),
|
get_stencil_resolve_vs(ctx),
|
||||||
|
|
|
@ -924,10 +924,10 @@ d3d12_set_sampler_views(struct pipe_context *pctx,
|
||||||
enum pipe_shader_type shader_type,
|
enum pipe_shader_type shader_type,
|
||||||
unsigned start_slot,
|
unsigned start_slot,
|
||||||
unsigned num_views,
|
unsigned num_views,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct d3d12_context *ctx = d3d12_context(pctx);
|
struct d3d12_context *ctx = d3d12_context(pctx);
|
||||||
assert(views);
|
|
||||||
unsigned shader_bit = (1 << shader_type);
|
unsigned shader_bit = (1 << shader_type);
|
||||||
ctx->has_int_samplers &= ~shader_bit;
|
ctx->has_int_samplers &= ~shader_bit;
|
||||||
|
|
||||||
|
@ -964,6 +964,11 @@ d3d12_set_sampler_views(struct pipe_context *pctx,
|
||||||
swizzle_state.swizzle_a = ss->swizzle_override_a;
|
swizzle_state.swizzle_a = ss->swizzle_override_a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < unbind_num_trailing_slots; i++)
|
||||||
|
pipe_sampler_view_reference(
|
||||||
|
&ctx->sampler_views[shader_type][start_slot + num_views + i], NULL);
|
||||||
|
|
||||||
ctx->num_sampler_views[shader_type] = start_slot + num_views;
|
ctx->num_sampler_views[shader_type] = start_slot + num_views;
|
||||||
ctx->shader_dirty[shader_type] |= D3D12_SHADER_DIRTY_SAMPLER_VIEWS;
|
ctx->shader_dirty[shader_type] |= D3D12_SHADER_DIRTY_SAMPLER_VIEWS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,6 +293,7 @@ etna_vertex_set_sampler_views(struct etna_context *ctx, unsigned nr,
|
||||||
static void
|
static void
|
||||||
etna_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
etna_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
||||||
unsigned start_slot, unsigned num_views,
|
unsigned start_slot, unsigned num_views,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct etna_context *ctx = etna_context(pctx);
|
struct etna_context *ctx = etna_context(pctx);
|
||||||
|
|
|
@ -212,7 +212,7 @@ fd2_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fd2_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
fd2_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned nr,
|
unsigned start, unsigned nr, unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
if (shader == PIPE_SHADER_FRAGMENT) {
|
if (shader == PIPE_SHADER_FRAGMENT) {
|
||||||
|
@ -226,7 +226,7 @@ fd2_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
||||||
ctx->dirty |= FD_DIRTY_TEXSTATE;
|
ctx->dirty |= FD_DIRTY_TEXSTATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd_set_sampler_views(pctx, shader, start, nr, views);
|
fd_set_sampler_views(pctx, shader, start, nr, unbind_num_trailing_slots, views);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* map gallium sampler-id to hw const-idx.. adreno uses a flat address
|
/* map gallium sampler-id to hw const-idx.. adreno uses a flat address
|
||||||
|
|
|
@ -320,7 +320,7 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fd4_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
fd4_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned nr,
|
unsigned start, unsigned nr, unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct fd_context *ctx = fd_context(pctx);
|
struct fd_context *ctx = fd_context(pctx);
|
||||||
|
@ -337,7 +337,7 @@ fd4_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fd_set_sampler_views(pctx, shader, start, nr, views);
|
fd_set_sampler_views(pctx, shader, start, nr, unbind_num_trailing_slots, views);
|
||||||
|
|
||||||
if (shader == PIPE_SHADER_FRAGMENT) {
|
if (shader == PIPE_SHADER_FRAGMENT) {
|
||||||
fd4_ctx->fastc_srgb = astc_srgb;
|
fd4_ctx->fastc_srgb = astc_srgb;
|
||||||
|
|
|
@ -319,7 +319,7 @@ fd5_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fd5_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
fd5_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned nr,
|
unsigned start, unsigned nr, unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct fd_context *ctx = fd_context(pctx);
|
struct fd_context *ctx = fd_context(pctx);
|
||||||
|
@ -336,7 +336,7 @@ fd5_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fd_set_sampler_views(pctx, shader, start, nr, views);
|
fd_set_sampler_views(pctx, shader, start, nr, unbind_num_trailing_slots, views);
|
||||||
|
|
||||||
if (shader == PIPE_SHADER_FRAGMENT) {
|
if (shader == PIPE_SHADER_FRAGMENT) {
|
||||||
fd5_ctx->fastc_srgb = astc_srgb;
|
fd5_ctx->fastc_srgb = astc_srgb;
|
||||||
|
|
|
@ -66,7 +66,9 @@ static void bind_sampler_states(struct fd_texture_stateobj *tex,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_sampler_views(struct fd_texture_stateobj *tex,
|
static void set_sampler_views(struct fd_texture_stateobj *tex,
|
||||||
unsigned start, unsigned nr, struct pipe_sampler_view **views)
|
unsigned start, unsigned nr,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned samplers = 0;
|
unsigned samplers = 0;
|
||||||
|
@ -82,6 +84,11 @@ static void set_sampler_views(struct fd_texture_stateobj *tex,
|
||||||
tex->valid_textures &= ~(1 << p);
|
tex->valid_textures &= ~(1 << p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (; i < nr + unbind_num_trailing_slots; i++) {
|
||||||
|
unsigned p = i + start;
|
||||||
|
pipe_sampler_view_reference(&tex->textures[p], NULL);
|
||||||
|
tex->valid_textures &= ~(1 << p);
|
||||||
|
}
|
||||||
|
|
||||||
tex->num_textures = util_last_bit(tex->valid_textures);
|
tex->num_textures = util_last_bit(tex->valid_textures);
|
||||||
|
|
||||||
|
@ -107,12 +114,12 @@ fd_sampler_states_bind(struct pipe_context *pctx,
|
||||||
|
|
||||||
void
|
void
|
||||||
fd_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
fd_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned nr,
|
unsigned start, unsigned nr, unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct fd_context *ctx = fd_context(pctx);
|
struct fd_context *ctx = fd_context(pctx);
|
||||||
|
|
||||||
set_sampler_views(&ctx->tex[shader], start, nr, views);
|
set_sampler_views(&ctx->tex[shader], start, nr, unbind_num_trailing_slots, views);
|
||||||
ctx->dirty_shader[shader] |= FD_DIRTY_SHADER_TEX;
|
ctx->dirty_shader[shader] |= FD_DIRTY_SHADER_TEX;
|
||||||
ctx->dirty |= FD_DIRTY_TEX;
|
ctx->dirty |= FD_DIRTY_TEX;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ void fd_sampler_states_bind(struct pipe_context *pctx,
|
||||||
void fd_set_sampler_views(struct pipe_context *pctx,
|
void fd_set_sampler_views(struct pipe_context *pctx,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned nr,
|
unsigned start, unsigned nr,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views);
|
struct pipe_sampler_view **views);
|
||||||
|
|
||||||
void fd_texture_init(struct pipe_context *pctx);
|
void fd_texture_init(struct pipe_context *pctx);
|
||||||
|
|
|
@ -746,7 +746,7 @@ static void i915_set_fragment_sampler_views(struct pipe_context *pipe,
|
||||||
assert(num <= PIPE_MAX_SAMPLERS);
|
assert(num <= PIPE_MAX_SAMPLERS);
|
||||||
|
|
||||||
/* Check for no-op */
|
/* Check for no-op */
|
||||||
if (num == i915->num_fragment_sampler_views &&
|
if (views && num == i915->num_fragment_sampler_views &&
|
||||||
!memcmp(i915->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *)))
|
!memcmp(i915->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -773,7 +773,7 @@ i915_set_vertex_sampler_views(struct pipe_context *pipe,
|
||||||
assert(num <= ARRAY_SIZE(i915->vertex_sampler_views));
|
assert(num <= ARRAY_SIZE(i915->vertex_sampler_views));
|
||||||
|
|
||||||
/* Check for no-op */
|
/* Check for no-op */
|
||||||
if (num == i915->num_vertex_sampler_views &&
|
if (views && num == i915->num_vertex_sampler_views &&
|
||||||
!memcmp(i915->vertex_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) {
|
!memcmp(i915->vertex_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -795,7 +795,7 @@ i915_set_vertex_sampler_views(struct pipe_context *pipe,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
i915_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
|
i915_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned num,
|
unsigned start, unsigned num, unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
assert(start == 0);
|
assert(start == 0);
|
||||||
|
|
|
@ -2856,15 +2856,17 @@ static void
|
||||||
iris_set_sampler_views(struct pipe_context *ctx,
|
iris_set_sampler_views(struct pipe_context *ctx,
|
||||||
enum pipe_shader_type p_stage,
|
enum pipe_shader_type p_stage,
|
||||||
unsigned start, unsigned count,
|
unsigned start, unsigned count,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct iris_context *ice = (struct iris_context *) ctx;
|
struct iris_context *ice = (struct iris_context *) ctx;
|
||||||
gl_shader_stage stage = stage_from_pipe(p_stage);
|
gl_shader_stage stage = stage_from_pipe(p_stage);
|
||||||
struct iris_shader_state *shs = &ice->state.shaders[stage];
|
struct iris_shader_state *shs = &ice->state.shaders[stage];
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
shs->bound_sampler_views &= ~u_bit_consecutive(start, count);
|
shs->bound_sampler_views &= ~u_bit_consecutive(start, count);
|
||||||
|
|
||||||
for (unsigned i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
struct pipe_sampler_view *pview = views ? views[i] : NULL;
|
struct pipe_sampler_view *pview = views ? views[i] : NULL;
|
||||||
pipe_sampler_view_reference((struct pipe_sampler_view **)
|
pipe_sampler_view_reference((struct pipe_sampler_view **)
|
||||||
&shs->textures[start + i], pview);
|
&shs->textures[start + i], pview);
|
||||||
|
@ -2879,6 +2881,10 @@ iris_set_sampler_views(struct pipe_context *ctx,
|
||||||
&view->surface_state, view->res->bo);
|
&view->surface_state, view->res->bo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (; i < count + unbind_num_trailing_slots; i++) {
|
||||||
|
pipe_sampler_view_reference((struct pipe_sampler_view **)
|
||||||
|
&shs->textures[start + i], NULL);
|
||||||
|
}
|
||||||
|
|
||||||
ice->state.stage_dirty |= (IRIS_STAGE_DIRTY_BINDINGS_VS << stage);
|
ice->state.stage_dirty |= (IRIS_STAGE_DIRTY_BINDINGS_VS << stage);
|
||||||
ice->state.dirty |=
|
ice->state.dirty |=
|
||||||
|
|
|
@ -371,6 +371,7 @@ static void
|
||||||
lima_set_sampler_views(struct pipe_context *pctx,
|
lima_set_sampler_views(struct pipe_context *pctx,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned nr,
|
unsigned start, unsigned nr,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct lima_context *ctx = lima_context(pctx);
|
struct lima_context *ctx = lima_context(pctx);
|
||||||
|
|
|
@ -119,6 +119,7 @@ llvmpipe_set_sampler_views(struct pipe_context *pipe,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start,
|
unsigned start,
|
||||||
unsigned num,
|
unsigned num,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
|
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
|
||||||
|
@ -153,6 +154,11 @@ llvmpipe_set_sampler_views(struct pipe_context *pipe,
|
||||||
view);
|
view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (; i < num + unbind_num_trailing_slots; i++) {
|
||||||
|
pipe_sampler_view_reference(&llvmpipe->sampler_views[shader][start + i],
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* find highest non-null sampler_views[] entry */
|
/* find highest non-null sampler_views[] entry */
|
||||||
{
|
{
|
||||||
unsigned j = MAX2(llvmpipe->num_sampler_views[shader], start + num);
|
unsigned j = MAX2(llvmpipe->num_sampler_views[shader], start + num);
|
||||||
|
|
|
@ -198,6 +198,7 @@ nv30_fragtex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
|
||||||
static void
|
static void
|
||||||
nv30_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
|
nv30_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned nr,
|
unsigned start, unsigned nr,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
assert(start == 0);
|
assert(start == 0);
|
||||||
|
|
|
@ -725,6 +725,7 @@ nv50_stage_set_sampler_views(struct nv50_context *nv50, int s,
|
||||||
static void
|
static void
|
||||||
nv50_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
|
nv50_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned nr,
|
unsigned start, unsigned nr,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
assert(start == 0);
|
assert(start == 0);
|
||||||
|
|
|
@ -569,6 +569,7 @@ nvc0_stage_set_sampler_views(struct nvc0_context *nvc0, int s,
|
||||||
static void
|
static void
|
||||||
nvc0_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
|
nvc0_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned nr,
|
unsigned start, unsigned nr,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
const unsigned s = nvc0_shader_stage(shader);
|
const unsigned s = nvc0_shader_stage(shader);
|
||||||
|
|
|
@ -1185,6 +1185,7 @@ panfrost_set_sampler_views(
|
||||||
struct pipe_context *pctx,
|
struct pipe_context *pctx,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start_slot, unsigned num_views,
|
unsigned start_slot, unsigned num_views,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct panfrost_context *ctx = pan_context(pctx);
|
struct panfrost_context *ctx = pan_context(pctx);
|
||||||
|
|
|
@ -1518,6 +1518,7 @@ static uint32_t r300_assign_texture_cache_region(unsigned index, unsigned num)
|
||||||
static void r300_set_sampler_views(struct pipe_context* pipe,
|
static void r300_set_sampler_views(struct pipe_context* pipe,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned count,
|
unsigned start, unsigned count,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view** views)
|
struct pipe_sampler_view** views)
|
||||||
{
|
{
|
||||||
struct r300_context* r300 = r300_context(pipe);
|
struct r300_context* r300 = r300_context(pipe);
|
||||||
|
|
|
@ -632,6 +632,7 @@ void r600_sampler_views_dirty(struct r600_context *rctx,
|
||||||
static void r600_set_sampler_views(struct pipe_context *pipe,
|
static void r600_set_sampler_views(struct pipe_context *pipe,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned count,
|
unsigned start, unsigned count,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct r600_context *rctx = (struct r600_context *) pipe;
|
struct r600_context *rctx = (struct r600_context *) pipe;
|
||||||
|
|
|
@ -573,12 +573,14 @@ static void si_update_shader_needs_decompress_mask(struct si_context *sctx, unsi
|
||||||
}
|
}
|
||||||
|
|
||||||
static void si_set_sampler_views(struct pipe_context *ctx, enum pipe_shader_type shader,
|
static void si_set_sampler_views(struct pipe_context *ctx, enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned count, struct pipe_sampler_view **views)
|
unsigned start, unsigned count,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct si_context *sctx = (struct si_context *)ctx;
|
struct si_context *sctx = (struct si_context *)ctx;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!count || shader >= SI_NUM_SHADERS)
|
if ((!count && !unbind_num_trailing_slots) || shader >= SI_NUM_SHADERS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (views) {
|
if (views) {
|
||||||
|
@ -589,6 +591,9 @@ static void si_set_sampler_views(struct pipe_context *ctx, enum pipe_shader_type
|
||||||
si_set_sampler_view(sctx, shader, start + i, NULL, false);
|
si_set_sampler_view(sctx, shader, start + i, NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (; i < count + unbind_num_trailing_slots; i++)
|
||||||
|
si_set_sampler_view(sctx, shader, start + i, NULL, false);
|
||||||
|
|
||||||
si_update_shader_needs_decompress_mask(sctx, shader);
|
si_update_shader_needs_decompress_mask(sctx, shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,7 @@ softpipe_set_sampler_views(struct pipe_context *pipe,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start,
|
unsigned start,
|
||||||
unsigned num,
|
unsigned num,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views);
|
struct pipe_sampler_view **views);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -420,7 +420,7 @@ update_polygon_stipple_enable(struct softpipe_context *softpipe, unsigned prim)
|
||||||
|
|
||||||
/* sampler view state */
|
/* sampler view state */
|
||||||
softpipe_set_sampler_views(&softpipe->pipe, PIPE_SHADER_FRAGMENT,
|
softpipe_set_sampler_views(&softpipe->pipe, PIPE_SHADER_FRAGMENT,
|
||||||
unit, 1, &softpipe->pstipple.sampler_view);
|
unit, 1, 0, &softpipe->pstipple.sampler_view);
|
||||||
|
|
||||||
softpipe->dirty |= SP_NEW_SAMPLER;
|
softpipe->dirty |= SP_NEW_SAMPLER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,7 @@ softpipe_set_sampler_views(struct pipe_context *pipe,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start,
|
unsigned start,
|
||||||
unsigned num,
|
unsigned num,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct softpipe_context *softpipe = softpipe_context(pipe);
|
struct softpipe_context *softpipe = softpipe_context(pipe);
|
||||||
|
@ -134,6 +135,12 @@ softpipe_set_sampler_views(struct pipe_context *pipe,
|
||||||
memset(sp_sviewdst, 0, sizeof(*sp_sviewsrc));
|
memset(sp_sviewdst, 0, sizeof(*sp_sviewsrc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (; i < num + unbind_num_trailing_slots; i++) {
|
||||||
|
struct pipe_sampler_view **pview = &softpipe->sampler_views[shader][start + i];
|
||||||
|
pipe_sampler_view_reference(pview, NULL);
|
||||||
|
sp_tex_tile_cache_set_sampler_view(softpipe->tex_cache[shader][start + i],
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* find highest non-null sampler_views[] entry */
|
/* find highest non-null sampler_views[] entry */
|
||||||
|
|
|
@ -414,6 +414,7 @@ svga_set_sampler_views(struct pipe_context *pipe,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start,
|
unsigned start,
|
||||||
unsigned num,
|
unsigned num,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct svga_context *svga = svga_context(pipe);
|
struct svga_context *svga = svga_context(pipe);
|
||||||
|
@ -475,6 +476,14 @@ svga_set_sampler_views(struct pipe_context *pipe,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (; i < num + unbind_num_trailing_slots; i++) {
|
||||||
|
if (svga->curr.sampler_views[shader][start + i]) {
|
||||||
|
pipe_sampler_view_reference(&svga->curr.sampler_views[shader][start + i],
|
||||||
|
NULL);
|
||||||
|
any_change = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!any_change) {
|
if (!any_change) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,6 +300,7 @@ swr_set_sampler_views(struct pipe_context *pipe,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start,
|
unsigned start,
|
||||||
unsigned num,
|
unsigned num,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct swr_context *ctx = swr_context(pipe);
|
struct swr_context *ctx = swr_context(pipe);
|
||||||
|
@ -316,6 +317,10 @@ swr_set_sampler_views(struct pipe_context *pipe,
|
||||||
pipe_sampler_view_reference(&ctx->sampler_views[shader][start + i],
|
pipe_sampler_view_reference(&ctx->sampler_views[shader][start + i],
|
||||||
views[i]);
|
views[i]);
|
||||||
}
|
}
|
||||||
|
for (; i < num + unbind_num_trailing_slots; i++) {
|
||||||
|
pipe_sampler_view_reference(&ctx->sampler_views[shader][start + i],
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
ctx->dirty |= SWR_NEW_SAMPLER_VIEW;
|
ctx->dirty |= SWR_NEW_SAMPLER_VIEW;
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,6 +564,7 @@ tegra_set_viewport_states(struct pipe_context *pcontext, unsigned start_slot,
|
||||||
static void
|
static void
|
||||||
tegra_set_sampler_views(struct pipe_context *pcontext, unsigned shader,
|
tegra_set_sampler_views(struct pipe_context *pcontext, unsigned shader,
|
||||||
unsigned start_slot, unsigned num_views,
|
unsigned start_slot, unsigned num_views,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **pviews)
|
struct pipe_sampler_view **pviews)
|
||||||
{
|
{
|
||||||
struct pipe_sampler_view *views[PIPE_MAX_SHADER_SAMPLER_VIEWS];
|
struct pipe_sampler_view *views[PIPE_MAX_SHADER_SAMPLER_VIEWS];
|
||||||
|
@ -574,7 +575,8 @@ tegra_set_sampler_views(struct pipe_context *pcontext, unsigned shader,
|
||||||
views[i] = tegra_sampler_view_unwrap(pviews[i]);
|
views[i] = tegra_sampler_view_unwrap(pviews[i]);
|
||||||
|
|
||||||
context->gpu->set_sampler_views(context->gpu, shader, start_slot,
|
context->gpu->set_sampler_views(context->gpu, shader, start_slot,
|
||||||
num_views, views);
|
num_views, unbind_num_trailing_slots,
|
||||||
|
views);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1156,6 +1156,7 @@ static void
|
||||||
v3d_set_sampler_views(struct pipe_context *pctx,
|
v3d_set_sampler_views(struct pipe_context *pctx,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned nr,
|
unsigned start, unsigned nr,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct v3d_context *v3d = v3d_context(pctx);
|
struct v3d_context *v3d = v3d_context(pctx);
|
||||||
|
|
|
@ -381,7 +381,7 @@ vc4_yuv_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
|
||||||
/* Unbind the textures, to make sure we don't try to recurse into the
|
/* Unbind the textures, to make sure we don't try to recurse into the
|
||||||
* shadow blit.
|
* shadow blit.
|
||||||
*/
|
*/
|
||||||
pctx->set_sampler_views(pctx, PIPE_SHADER_FRAGMENT, 0, 0, NULL);
|
pctx->set_sampler_views(pctx, PIPE_SHADER_FRAGMENT, 0, 0, 0, NULL);
|
||||||
pctx->bind_sampler_states(pctx, PIPE_SHADER_FRAGMENT, 0, 0, NULL);
|
pctx->bind_sampler_states(pctx, PIPE_SHADER_FRAGMENT, 0, 0, NULL);
|
||||||
|
|
||||||
util_blitter_custom_shader(vc4->blitter, dst_surf,
|
util_blitter_custom_shader(vc4->blitter, dst_surf,
|
||||||
|
|
|
@ -649,6 +649,7 @@ static void
|
||||||
vc4_set_sampler_views(struct pipe_context *pctx,
|
vc4_set_sampler_views(struct pipe_context *pctx,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start, unsigned nr,
|
unsigned start, unsigned nr,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct vc4_context *vc4 = vc4_context(pctx);
|
struct vc4_context *vc4 = vc4_context(pctx);
|
||||||
|
|
|
@ -1015,6 +1015,7 @@ static void virgl_set_sampler_views(struct pipe_context *ctx,
|
||||||
enum pipe_shader_type shader_type,
|
enum pipe_shader_type shader_type,
|
||||||
unsigned start_slot,
|
unsigned start_slot,
|
||||||
unsigned num_views,
|
unsigned num_views,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct virgl_context *vctx = virgl_context(ctx);
|
struct virgl_context *vctx = virgl_context(ctx);
|
||||||
|
@ -1038,6 +1039,11 @@ static void virgl_set_sampler_views(struct pipe_context *ctx,
|
||||||
virgl_encode_set_sampler_views(vctx, shader_type,
|
virgl_encode_set_sampler_views(vctx, shader_type,
|
||||||
start_slot, num_views, (struct virgl_sampler_view **)binding->views);
|
start_slot, num_views, (struct virgl_sampler_view **)binding->views);
|
||||||
virgl_attach_res_sampler_views(vctx, shader_type);
|
virgl_attach_res_sampler_views(vctx, shader_type);
|
||||||
|
|
||||||
|
if (unbind_num_trailing_slots) {
|
||||||
|
virgl_set_sampler_views(ctx, shader_type, start_slot + num_views,
|
||||||
|
unbind_num_trailing_slots, 0, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -674,15 +674,23 @@ zink_set_sampler_views(struct pipe_context *pctx,
|
||||||
enum pipe_shader_type shader_type,
|
enum pipe_shader_type shader_type,
|
||||||
unsigned start_slot,
|
unsigned start_slot,
|
||||||
unsigned num_views,
|
unsigned num_views,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views)
|
struct pipe_sampler_view **views)
|
||||||
{
|
{
|
||||||
struct zink_context *ctx = zink_context(pctx);
|
struct zink_context *ctx = zink_context(pctx);
|
||||||
for (unsigned i = 0; i < num_views; ++i) {
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < num_views; ++i) {
|
||||||
struct pipe_sampler_view *pview = views ? views[i] : NULL;
|
struct pipe_sampler_view *pview = views ? views[i] : NULL;
|
||||||
pipe_sampler_view_reference(
|
pipe_sampler_view_reference(
|
||||||
&ctx->sampler_views[shader_type][start_slot + i],
|
&ctx->sampler_views[shader_type][start_slot + i],
|
||||||
pview);
|
pview);
|
||||||
}
|
}
|
||||||
|
for (; i < num_views + unbind_num_trailing_slots; ++i) {
|
||||||
|
pipe_sampler_view_reference(
|
||||||
|
&ctx->sampler_views[shader_type][start_slot + i],
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
ctx->num_sampler_views[shader_type] = start_slot + num_views;
|
ctx->num_sampler_views[shader_type] = start_slot + num_views;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ kernel::launch(command_queue &q,
|
||||||
exec.samplers.data());
|
exec.samplers.data());
|
||||||
|
|
||||||
q.pipe->set_sampler_views(q.pipe, PIPE_SHADER_COMPUTE, 0,
|
q.pipe->set_sampler_views(q.pipe, PIPE_SHADER_COMPUTE, 0,
|
||||||
exec.sviews.size(), exec.sviews.data());
|
exec.sviews.size(), 0, exec.sviews.data());
|
||||||
q.pipe->set_shader_images(q.pipe, PIPE_SHADER_COMPUTE, 0,
|
q.pipe->set_shader_images(q.pipe, PIPE_SHADER_COMPUTE, 0,
|
||||||
exec.iviews.size(), 0, exec.iviews.data());
|
exec.iviews.size(), 0, exec.iviews.data());
|
||||||
q.pipe->set_compute_resources(q.pipe, 0, exec.resources.size(),
|
q.pipe->set_compute_resources(q.pipe, 0, exec.resources.size(),
|
||||||
|
@ -104,7 +104,7 @@ kernel::launch(command_queue &q,
|
||||||
q.pipe->set_shader_images(q.pipe, PIPE_SHADER_COMPUTE, 0,
|
q.pipe->set_shader_images(q.pipe, PIPE_SHADER_COMPUTE, 0,
|
||||||
0, exec.iviews.size(), NULL);
|
0, exec.iviews.size(), NULL);
|
||||||
q.pipe->set_sampler_views(q.pipe, PIPE_SHADER_COMPUTE, 0,
|
q.pipe->set_sampler_views(q.pipe, PIPE_SHADER_COMPUTE, 0,
|
||||||
exec.sviews.size(), NULL);
|
0, exec.sviews.size(), NULL);
|
||||||
q.pipe->bind_sampler_states(q.pipe, PIPE_SHADER_COMPUTE, 0,
|
q.pipe->bind_sampler_states(q.pipe, PIPE_SHADER_COMPUTE, 0,
|
||||||
exec.samplers.size(), NULL);
|
exec.samplers.size(), NULL);
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ static void emit_compute_state(struct rendering_state *state)
|
||||||
|
|
||||||
if (state->sv_dirty[PIPE_SHADER_COMPUTE]) {
|
if (state->sv_dirty[PIPE_SHADER_COMPUTE]) {
|
||||||
state->pctx->set_sampler_views(state->pctx, PIPE_SHADER_COMPUTE, 0, state->num_sampler_views[PIPE_SHADER_COMPUTE],
|
state->pctx->set_sampler_views(state->pctx, PIPE_SHADER_COMPUTE, 0, state->num_sampler_views[PIPE_SHADER_COMPUTE],
|
||||||
state->sv[PIPE_SHADER_COMPUTE]);
|
0, state->sv[PIPE_SHADER_COMPUTE]);
|
||||||
state->sv_dirty[PIPE_SHADER_COMPUTE] = false;
|
state->sv_dirty[PIPE_SHADER_COMPUTE] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ static void emit_state(struct rendering_state *state)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
state->pctx->set_sampler_views(state->pctx, sh, 0, state->num_sampler_views[sh],
|
state->pctx->set_sampler_views(state->pctx, sh, 0, state->num_sampler_views[sh],
|
||||||
state->sv[sh]);
|
0, state->sv[sh]);
|
||||||
state->sv_dirty[sh] = false;
|
state->sv_dirty[sh] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1013,7 +1013,7 @@ update_textures_and_samplers(struct NineDevice9 *device)
|
||||||
context->bound_samplers_mask_ps |= (1 << s);
|
context->bound_samplers_mask_ps |= (1 << s);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_textures, view);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_textures, 0, view);
|
||||||
|
|
||||||
if (commit_samplers)
|
if (commit_samplers)
|
||||||
cso_single_sampler_done(context->cso, PIPE_SHADER_FRAGMENT);
|
cso_single_sampler_done(context->cso, PIPE_SHADER_FRAGMENT);
|
||||||
|
@ -1061,7 +1061,7 @@ update_textures_and_samplers(struct NineDevice9 *device)
|
||||||
context->bound_samplers_mask_vs |= (1 << i);
|
context->bound_samplers_mask_vs |= (1 << i);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, num_textures, view);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, num_textures, 0, view);
|
||||||
|
|
||||||
if (commit_samplers)
|
if (commit_samplers)
|
||||||
cso_single_sampler_done(context->cso, PIPE_SHADER_VERTEX);
|
cso_single_sampler_done(context->cso, PIPE_SHADER_VERTEX);
|
||||||
|
@ -2913,8 +2913,8 @@ nine_context_clear(struct NineDevice9 *device)
|
||||||
cso_set_samplers(cso, PIPE_SHADER_VERTEX, 0, NULL);
|
cso_set_samplers(cso, PIPE_SHADER_VERTEX, 0, NULL);
|
||||||
cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, 0, NULL);
|
cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, 0, NULL);
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, NINE_MAX_SAMPLERS_VS, NULL);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, 0, NINE_MAX_SAMPLERS_VS, NULL);
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, NINE_MAX_SAMPLERS_PS, NULL);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0, NINE_MAX_SAMPLERS_PS, NULL);
|
||||||
|
|
||||||
pipe->set_vertex_buffers(pipe, 0, 0, device->caps.MaxStreams, NULL);
|
pipe->set_vertex_buffers(pipe, 0, 0, device->caps.MaxStreams, NULL);
|
||||||
|
|
||||||
|
|
|
@ -504,7 +504,7 @@ bind_samplers(struct xa_context *ctx,
|
||||||
|
|
||||||
cso_set_samplers(ctx->cso, PIPE_SHADER_FRAGMENT, num_samplers,
|
cso_set_samplers(ctx->cso, PIPE_SHADER_FRAGMENT, num_samplers,
|
||||||
(const struct pipe_sampler_state **)samplers);
|
(const struct pipe_sampler_state **)samplers);
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_samplers,
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_samplers, 0,
|
||||||
ctx->bound_sampler_views);
|
ctx->bound_sampler_views);
|
||||||
ctx->num_bound_samplers = num_samplers;
|
ctx->num_bound_samplers = num_samplers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,7 +327,7 @@ xa_solid_prepare(struct xa_context *ctx, struct xa_surface *dst,
|
||||||
renderer_bind_destination(ctx, ctx->srf);
|
renderer_bind_destination(ctx, ctx->srf);
|
||||||
bind_solid_blend_state(ctx);
|
bind_solid_blend_state(ctx);
|
||||||
cso_set_samplers(ctx->cso, PIPE_SHADER_FRAGMENT, 0, NULL);
|
cso_set_samplers(ctx->cso, PIPE_SHADER_FRAGMENT, 0, NULL);
|
||||||
ctx->pipe->set_sampler_views(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, XA_MAX_SAMPLERS, NULL);
|
ctx->pipe->set_sampler_views(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, 0, XA_MAX_SAMPLERS, NULL);
|
||||||
|
|
||||||
shader = xa_shaders_get(ctx->shaders, vs_traits, fs_traits);
|
shader = xa_shaders_get(ctx->shaders, vs_traits, fs_traits);
|
||||||
cso_set_vertex_shader_handle(ctx->cso, shader.vs);
|
cso_set_vertex_shader_handle(ctx->cso, shader.vs);
|
||||||
|
|
|
@ -442,7 +442,7 @@ renderer_copy_prepare(struct xa_context *r,
|
||||||
u_sampler_view_default_template(&templ,
|
u_sampler_view_default_template(&templ,
|
||||||
src_texture, src_texture->format);
|
src_texture, src_texture->format);
|
||||||
src_view = pipe->create_sampler_view(pipe, src_texture, &templ);
|
src_view = pipe->create_sampler_view(pipe, src_texture, &templ);
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &src_view);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &src_view);
|
||||||
pipe_sampler_view_reference(&src_view, NULL);
|
pipe_sampler_view_reference(&src_view, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ xa_yuv_bind_samplers(struct xa_context *r, struct xa_surface *yuv[])
|
||||||
}
|
}
|
||||||
r->num_bound_samplers = 3;
|
r->num_bound_samplers = 3;
|
||||||
cso_set_samplers(r->cso, PIPE_SHADER_FRAGMENT, 3, (const struct pipe_sampler_state **)samplers);
|
cso_set_samplers(r->cso, PIPE_SHADER_FRAGMENT, 3, (const struct pipe_sampler_state **)samplers);
|
||||||
r->pipe->set_sampler_views(r->pipe, PIPE_SHADER_FRAGMENT, 0, 3, r->bound_sampler_views);
|
r->pipe->set_sampler_views(r->pipe, PIPE_SHADER_FRAGMENT, 0, 3, 0, r->bound_sampler_views);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -443,6 +443,7 @@ struct pipe_context {
|
||||||
void (*set_sampler_views)(struct pipe_context *,
|
void (*set_sampler_views)(struct pipe_context *,
|
||||||
enum pipe_shader_type shader,
|
enum pipe_shader_type shader,
|
||||||
unsigned start_slot, unsigned num_views,
|
unsigned start_slot, unsigned num_views,
|
||||||
|
unsigned unbind_num_trailing_slots,
|
||||||
struct pipe_sampler_view **views);
|
struct pipe_sampler_view **views);
|
||||||
|
|
||||||
void (*set_tess_state)(struct pipe_context *,
|
void (*set_tess_state)(struct pipe_context *,
|
||||||
|
|
|
@ -350,7 +350,7 @@ static void init_tex( void )
|
||||||
if (sv == NULL)
|
if (sv == NULL)
|
||||||
exit(5);
|
exit(5);
|
||||||
|
|
||||||
ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
|
ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &sv);
|
||||||
|
|
||||||
|
|
||||||
memset(&sampler_desc, 0, sizeof sampler_desc);
|
memset(&sampler_desc, 0, sizeof sampler_desc);
|
||||||
|
|
|
@ -440,7 +440,7 @@ static void init_tex( void )
|
||||||
if (sv == NULL)
|
if (sv == NULL)
|
||||||
exit(5);
|
exit(5);
|
||||||
|
|
||||||
ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
|
ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &sv);
|
||||||
|
|
||||||
|
|
||||||
memset(&sampler_desc, 0, sizeof sampler_desc);
|
memset(&sampler_desc, 0, sizeof sampler_desc);
|
||||||
|
|
|
@ -265,7 +265,7 @@ static void init_tex( void )
|
||||||
if (sv == NULL)
|
if (sv == NULL)
|
||||||
exit(5);
|
exit(5);
|
||||||
|
|
||||||
ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
|
ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &sv);
|
||||||
|
|
||||||
|
|
||||||
memset(&sampler_desc, 0, sizeof sampler_desc);
|
memset(&sampler_desc, 0, sizeof sampler_desc);
|
||||||
|
|
|
@ -168,7 +168,7 @@ static void init_tex( void )
|
||||||
PIPE_FORMAT_B8G8R8A8_UNORM, tex2d);
|
PIPE_FORMAT_B8G8R8A8_UNORM, tex2d);
|
||||||
|
|
||||||
sv = graw_util_create_simple_sampler_view(&info, texture);
|
sv = graw_util_create_simple_sampler_view(&info, texture);
|
||||||
info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
|
info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &sv);
|
||||||
|
|
||||||
sampler = graw_util_create_simple_sampler(&info,
|
sampler = graw_util_create_simple_sampler(&info,
|
||||||
PIPE_TEX_WRAP_REPEAT,
|
PIPE_TEX_WRAP_REPEAT,
|
||||||
|
|
|
@ -129,11 +129,11 @@ static void draw( void )
|
||||||
|
|
||||||
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||||
|
|
||||||
info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &linear_sv);
|
info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &linear_sv);
|
||||||
set_vertices(vertices1, 4);
|
set_vertices(vertices1, 4);
|
||||||
util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4);
|
util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4);
|
||||||
|
|
||||||
info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &srgb_sv);
|
info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &srgb_sv);
|
||||||
set_vertices(vertices2, 4);
|
set_vertices(vertices2, 4);
|
||||||
util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4);
|
util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4);
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ init_tex(const unsigned swizzle[4])
|
||||||
if (sv == NULL)
|
if (sv == NULL)
|
||||||
exit(5);
|
exit(5);
|
||||||
|
|
||||||
info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
|
info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &sv);
|
||||||
|
|
||||||
sampler = graw_util_create_simple_sampler(&info,
|
sampler = graw_util_create_simple_sampler(&info,
|
||||||
PIPE_TEX_WRAP_REPEAT,
|
PIPE_TEX_WRAP_REPEAT,
|
||||||
|
|
|
@ -338,7 +338,7 @@ static void init_tex( void )
|
||||||
if (sv == NULL)
|
if (sv == NULL)
|
||||||
exit(5);
|
exit(5);
|
||||||
|
|
||||||
ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
|
ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &sv);
|
||||||
|
|
||||||
|
|
||||||
memset(&sampler_desc, 0, sizeof sampler_desc);
|
memset(&sampler_desc, 0, sizeof sampler_desc);
|
||||||
|
|
|
@ -315,7 +315,7 @@ static void init_sampler_views(struct context *ctx, const int *slots)
|
||||||
assert(ctx->view[i]);
|
assert(ctx->view[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_COMPUTE, 0, i, ctx->view);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_COMPUTE, 0, i, 0, ctx->view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroy_sampler_views(struct context *ctx)
|
static void destroy_sampler_views(struct context *ctx)
|
||||||
|
@ -323,7 +323,7 @@ static void destroy_sampler_views(struct context *ctx)
|
||||||
struct pipe_context *pipe = ctx->pipe;
|
struct pipe_context *pipe = ctx->pipe;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_COMPUTE, 0, MAX_RESOURCES, NULL);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_COMPUTE, 0, 0, MAX_RESOURCES, NULL);
|
||||||
|
|
||||||
for (i = 0; i < MAX_RESOURCES; ++i) {
|
for (i = 0; i < MAX_RESOURCES; ++i) {
|
||||||
if (ctx->view[i]) {
|
if (ctx->view[i]) {
|
||||||
|
|
|
@ -322,7 +322,7 @@ static void draw(struct program *p)
|
||||||
cso_set_samplers(p->cso, PIPE_SHADER_FRAGMENT, 1, samplers);
|
cso_set_samplers(p->cso, PIPE_SHADER_FRAGMENT, 1, samplers);
|
||||||
|
|
||||||
/* texture sampler view */
|
/* texture sampler view */
|
||||||
p->pipe->set_sampler_views(p->pipe, PIPE_SHADER_FRAGMENT, 0, 1, &p->view);
|
p->pipe->set_sampler_views(p->pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &p->view);
|
||||||
|
|
||||||
/* shaders */
|
/* shaders */
|
||||||
cso_set_fragment_shader_handle(p->cso, p->fs);
|
cso_set_fragment_shader_handle(p->cso, p->fs);
|
||||||
|
|
|
@ -252,7 +252,7 @@ update_textures(struct st_context *st,
|
||||||
for (unsigned i = 0; i < num_unbind; i++)
|
for (unsigned i = 0; i < num_unbind; i++)
|
||||||
pipe_sampler_view_reference(&sampler_views[num_textures + i], NULL);
|
pipe_sampler_view_reference(&sampler_views[num_textures + i], NULL);
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, shader_stage, 0, num_textures + num_unbind,
|
pipe->set_sampler_views(pipe, shader_stage, 0, num_textures, num_unbind,
|
||||||
sampler_views);
|
sampler_views);
|
||||||
st->state.num_sampler_views[shader_stage] = num_textures;
|
st->state.num_sampler_views[shader_stage] = num_textures;
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,7 +247,8 @@ setup_render_state(struct gl_context *ctx,
|
||||||
memcpy(sampler_views, st->state.frag_sampler_views,
|
memcpy(sampler_views, st->state.frag_sampler_views,
|
||||||
sizeof(sampler_views));
|
sizeof(sampler_views));
|
||||||
sampler_views[fpv->bitmap_sampler] = sv;
|
sampler_views[fpv->bitmap_sampler] = sv;
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, sampler_views);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, 0,
|
||||||
|
sampler_views);
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] =
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] =
|
||||||
MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], num);
|
MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], num);
|
||||||
}
|
}
|
||||||
|
@ -279,10 +280,9 @@ restore_render_state(struct gl_context *ctx)
|
||||||
/* Unbind all because st/mesa won't do it if the current shader doesn't
|
/* Unbind all because st/mesa won't do it if the current shader doesn't
|
||||||
* use them.
|
* use them.
|
||||||
*/
|
*/
|
||||||
static struct pipe_sampler_view *null[PIPE_MAX_SAMPLERS];
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0,
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
|
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT],
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT],
|
||||||
null);
|
NULL);
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = 0;
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = 0;
|
||||||
|
|
||||||
st->dirty |= ST_NEW_VERTEX_ARRAYS |
|
st->dirty |= ST_NEW_VERTEX_ARRAYS |
|
||||||
|
|
|
@ -881,12 +881,14 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
|
||||||
sampler_views[fpv->drawpix_sampler] = sv[0];
|
sampler_views[fpv->drawpix_sampler] = sv[0];
|
||||||
if (sv[1])
|
if (sv[1])
|
||||||
sampler_views[fpv->pixelmap_sampler] = sv[1];
|
sampler_views[fpv->pixelmap_sampler] = sv[1];
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, sampler_views);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, 0,
|
||||||
|
sampler_views);
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] =
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] =
|
||||||
MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], num);
|
MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], num);
|
||||||
} else {
|
} else {
|
||||||
/* drawing a depth/stencil image */
|
/* drawing a depth/stencil image */
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_sampler_view, sv);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_sampler_view,
|
||||||
|
0, sv);
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] =
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] =
|
||||||
MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], num_sampler_view);
|
MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], num_sampler_view);
|
||||||
}
|
}
|
||||||
|
@ -940,10 +942,9 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
|
||||||
/* Unbind all because st/mesa won't do it if the current shader doesn't
|
/* Unbind all because st/mesa won't do it if the current shader doesn't
|
||||||
* use them.
|
* use them.
|
||||||
*/
|
*/
|
||||||
static struct pipe_sampler_view *null[PIPE_MAX_SAMPLERS];
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0,
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
|
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT],
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT],
|
||||||
null);
|
NULL);
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = 0;
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = 0;
|
||||||
|
|
||||||
st->dirty |= ST_NEW_VERTEX_ARRAYS |
|
st->dirty |= ST_NEW_VERTEX_ARRAYS |
|
||||||
|
|
|
@ -189,7 +189,8 @@ try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb,
|
||||||
if (sampler_view == NULL)
|
if (sampler_view == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &sampler_view);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0,
|
||||||
|
&sampler_view);
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] =
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] =
|
||||||
MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], 1);
|
MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], 1);
|
||||||
|
|
||||||
|
@ -258,10 +259,9 @@ fail:
|
||||||
/* Unbind all because st/mesa won't do it if the current shader doesn't
|
/* Unbind all because st/mesa won't do it if the current shader doesn't
|
||||||
* use them.
|
* use them.
|
||||||
*/
|
*/
|
||||||
static struct pipe_sampler_view *null[PIPE_MAX_SAMPLERS];
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0,
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
|
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT],
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT],
|
||||||
null);
|
NULL);
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = 0;
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = 0;
|
||||||
pipe->set_shader_images(pipe, PIPE_SHADER_FRAGMENT, 0, 0, 1, NULL);
|
pipe->set_shader_images(pipe, PIPE_SHADER_FRAGMENT, 0, 0, 1, NULL);
|
||||||
|
|
||||||
|
|
|
@ -1312,7 +1312,8 @@ try_pbo_upload_common(struct gl_context *ctx,
|
||||||
if (sampler_view == NULL)
|
if (sampler_view == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &sampler_view);
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0,
|
||||||
|
&sampler_view);
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] =
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] =
|
||||||
MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], 1);
|
MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], 1);
|
||||||
|
|
||||||
|
@ -1354,10 +1355,9 @@ fail:
|
||||||
/* Unbind all because st/mesa won't do it if the current shader doesn't
|
/* Unbind all because st/mesa won't do it if the current shader doesn't
|
||||||
* use them.
|
* use them.
|
||||||
*/
|
*/
|
||||||
static struct pipe_sampler_view *null[PIPE_MAX_SAMPLERS];
|
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0,
|
||||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
|
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT],
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT],
|
||||||
null);
|
NULL);
|
||||||
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = 0;
|
st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = 0;
|
||||||
|
|
||||||
st->dirty |= ST_NEW_VERTEX_ARRAYS |
|
st->dirty |= ST_NEW_VERTEX_ARRAYS |
|
||||||
|
|
Loading…
Reference in New Issue