ctx->pipe->bind_rasterizer_state( ctx->pipe, NULL );
{
+ static struct pipe_sampler_view *views[PIPE_MAX_SAMPLERS] = { NULL };
static void *zeros[PIPE_MAX_SAMPLERS] = { NULL };
struct pipe_screen *scr = ctx->pipe->screen;
unsigned sh;
assert(max <= PIPE_MAX_SAMPLERS);
if (max > 0) {
ctx->pipe->bind_sampler_states(ctx->pipe, sh, 0, max, zeros);
+ ctx->pipe->set_sampler_views(ctx->pipe, sh, 0, max, views);
}
}
}
ctx->pipe->bind_fs_state( ctx->pipe, NULL );
ctx->pipe->bind_vs_state( ctx->pipe, NULL );
ctx->pipe->bind_vertex_elements_state( ctx->pipe, NULL );
- ctx->pipe->set_fragment_sampler_views(ctx->pipe, 0, NULL);
- if (ctx->pipe->set_vertex_sampler_views)
- ctx->pipe->set_vertex_sampler_views(ctx->pipe, 0, NULL);
+
if (ctx->pipe->set_stream_output_targets)
ctx->pipe->set_stream_output_targets(ctx->pipe, 0, NULL, 0);
}
info->nr_views = count;
/* bind the new sampler views */
- switch (shader_stage) {
- case PIPE_SHADER_FRAGMENT:
- ctx->pipe->set_fragment_sampler_views(ctx->pipe, count, info->views);
- break;
- case PIPE_SHADER_VERTEX:
- ctx->pipe->set_vertex_sampler_views(ctx->pipe, count, info->views);
- break;
- case PIPE_SHADER_GEOMETRY:
- ctx->pipe->set_geometry_sampler_views(ctx->pipe, count, info->views);
- break;
- default:
- assert(!"bad shader type in cso_set_sampler_views()");
- }
+ ctx->pipe->set_sampler_views(ctx->pipe, shader_stage, 0, count,
+ info->views);
}
num = MAX2(info->nr_views, nr_saved);
/* bind the old/saved sampler views */
- switch (shader_stage) {
- case PIPE_SHADER_FRAGMENT:
- ctx->pipe->set_fragment_sampler_views(ctx->pipe, num, info->views);
- break;
- case PIPE_SHADER_VERTEX:
- ctx->pipe->set_vertex_sampler_views(ctx->pipe, num, info->views);
- break;
- case PIPE_SHADER_GEOMETRY:
- ctx->pipe->set_geometry_sampler_views(ctx->pipe, num, info->views);
- break;
- default:
- assert(!"bad shader type in cso_restore_sampler_views()");
- }
+ ctx->pipe->set_sampler_views(ctx->pipe, shader_stage, 0, num, info->views);
info->nr_views = nr_saved;
info->nr_views_saved = 0;
void (*driver_bind_sampler_states)(struct pipe_context *, unsigned, unsigned,
unsigned, void **);
- void (*driver_set_sampler_views)(struct pipe_context *,
- unsigned,
+ void (*driver_set_sampler_views)(struct pipe_context *, unsigned shader,
+ unsigned start, unsigned count,
struct pipe_sampler_view **);
};
aaline->driver_bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0,
num_samplers, aaline->state.sampler);
- aaline->driver_set_sampler_views(pipe, num_samplers, aaline->state.sampler_views);
+ aaline->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
+ num_samplers, aaline->state.sampler_views);
/* Disable triangle culling, stippling, unfilled mode etc. */
r = draw_get_rasterizer_no_cull(draw, rast->scissor, rast->flatshade);
aaline->num_samplers,
aaline->state.sampler);
- aaline->driver_set_sampler_views(pipe,
- aaline->num_sampler_views,
+ aaline->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
+ aaline->num_samplers,
aaline->state.sampler_views);
/* restore original rasterizer state */
pipe->delete_fs_state = aaline->driver_delete_fs_state;
pipe->bind_sampler_states = aaline->driver_bind_sampler_states;
- pipe->set_fragment_sampler_views = aaline->driver_set_sampler_views;
+ pipe->set_sampler_views = aaline->driver_set_sampler_views;
FREE( stage );
}
static void
-aaline_set_sampler_views(struct pipe_context *pipe,
- unsigned num,
+aaline_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+ unsigned start, unsigned num,
struct pipe_sampler_view **views)
{
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
return;
}
- /* save current */
- for (i = 0; i < num; i++) {
- pipe_sampler_view_reference(&aaline->state.sampler_views[i], views[i]);
- }
- for ( ; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
- pipe_sampler_view_reference(&aaline->state.sampler_views[i], NULL);
+ if (shader == PIPE_SHADER_FRAGMENT) {
+ /* save current */
+ for (i = 0; i < num; i++) {
+ pipe_sampler_view_reference(&aaline->state.sampler_views[start + i],
+ views[i]);
+ }
+ aaline->num_sampler_views = num;
}
- aaline->num_sampler_views = num;
/* pass-through */
- aaline->driver_set_sampler_views(pipe, num, views);
+ aaline->driver_set_sampler_views(pipe, shader, start, num, views);
}
aaline->driver_delete_fs_state = pipe->delete_fs_state;
aaline->driver_bind_sampler_states = pipe->bind_sampler_states;
- aaline->driver_set_sampler_views = pipe->set_fragment_sampler_views;
+ aaline->driver_set_sampler_views = pipe->set_sampler_views;
/* override the driver's functions */
pipe->create_fs_state = aaline_create_fs_state;
pipe->delete_fs_state = aaline_delete_fs_state;
pipe->bind_sampler_states = aaline_bind_sampler_states;
- pipe->set_fragment_sampler_views = aaline_set_sampler_views;
+ pipe->set_sampler_views = aaline_set_sampler_views;
/* Install once everything is known to be OK:
*/
unsigned, unsigned, void **);
void (*driver_set_sampler_views)(struct pipe_context *,
- unsigned,
+ unsigned shader, unsigned start,
+ unsigned count,
struct pipe_sampler_view **);
void (*driver_set_polygon_stipple)(struct pipe_context *,
pstip->driver_bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0,
num_samplers, pstip->state.samplers);
- pstip->driver_set_sampler_views(pipe, num_samplers, pstip->state.sampler_views);
+ pstip->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
+ num_samplers, pstip->state.sampler_views);
+
draw->suspend_flushing = FALSE;
/* now really draw first triangle */
pstip->num_samplers,
pstip->state.samplers);
- pstip->driver_set_sampler_views(pipe,
+ pstip->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
pstip->num_sampler_views,
pstip->state.sampler_views);
+
draw->suspend_flushing = FALSE;
}
static void
pstip_set_sampler_views(struct pipe_context *pipe,
- unsigned num,
+ unsigned shader, unsigned start, unsigned num,
struct pipe_sampler_view **views)
{
struct pstip_stage *pstip = pstip_stage_from_pipe(pipe);
uint i;
- /* save current */
- for (i = 0; i < num; i++) {
- pipe_sampler_view_reference(&pstip->state.sampler_views[i], views[i]);
- }
- for (; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
- pipe_sampler_view_reference(&pstip->state.sampler_views[i], NULL);
+ if (shader == PIPE_SHADER_FRAGMENT) {
+ /* save current */
+ for (i = 0; i < num; i++) {
+ pipe_sampler_view_reference(&pstip->state.sampler_views[start + i],
+ views[i]);
+ }
+ pstip->num_sampler_views = num;
}
- pstip->num_sampler_views = num;
-
/* pass-through */
- pstip->driver_set_sampler_views(pstip->pipe, num, views);
+ pstip->driver_set_sampler_views(pstip->pipe, shader, start, num, views);
}
pstip->driver_delete_fs_state = pipe->delete_fs_state;
pstip->driver_bind_sampler_states = pipe->bind_sampler_states;
- pstip->driver_set_sampler_views = pipe->set_fragment_sampler_views;
+ pstip->driver_set_sampler_views = pipe->set_sampler_views;
pstip->driver_set_polygon_stipple = pipe->set_polygon_stipple;
/* override the driver's functions */
pipe->delete_fs_state = pstip_delete_fs_state;
pipe->bind_sampler_states = pstip_bind_sampler_states;
- pipe->set_fragment_sampler_views = pstip_set_sampler_views;
+ pipe->set_sampler_views = pstip_set_sampler_views;
pipe->set_polygon_stipple = pstip_set_polygon_stipple;
return TRUE;
ctx->base.saved_num_sampler_states = ~0;
/* Fragment sampler views. */
- pipe->set_fragment_sampler_views(pipe,
- ctx->base.saved_num_sampler_views,
- ctx->base.saved_sampler_views);
+ pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
+ ctx->base.saved_num_sampler_views,
+ ctx->base.saved_sampler_views);
for (i = 0; i < ctx->base.saved_num_sampler_views; i++)
pipe_sampler_view_reference(&ctx->base.saved_sampler_views[i], NULL);
views[0] = src;
views[1] = pipe->create_sampler_view(pipe, src->texture, &templ);
- pipe->set_fragment_sampler_views(pipe, 2, views);
+ pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 2, views);
pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0, 2, samplers);
pipe_sampler_view_reference(&views[1], NULL);
view = pipe->create_sampler_view(pipe, src->texture, &templ);
- pipe->set_fragment_sampler_views(pipe, 1, &view);
+ pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &view);
pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT,
0, 1, &sampler_state);
pipe_sampler_view_reference(&view, NULL);
} else {
- pipe->set_fragment_sampler_views(pipe, 1, &src);
+ pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &src);
pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT,
0, 1, &sampler_state);
}
c->pipe->bind_fs_state(c->pipe, layer->fs);
c->pipe->bind_sampler_states(c->pipe, PIPE_SHADER_FRAGMENT, 0,
num_sampler_views, layer->samplers);
- c->pipe->set_fragment_sampler_views(c->pipe, num_sampler_views, samplers);
+ c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_FRAGMENT, 0,
+ num_sampler_views, samplers);
+
util_draw_arrays(c->pipe, PIPE_PRIM_QUADS, vb_index * 4, 4);
vb_index++;
idct->pipe->bind_sampler_states(idct->pipe, PIPE_SHADER_FRAGMENT,
0, 2, idct->samplers);
- idct->pipe->set_fragment_sampler_views(idct->pipe, 2, buffer->sampler_views.stage[0]);
+ idct->pipe->set_sampler_views(idct->pipe, PIPE_SHADER_FRAGMENT, 0, 2,
+ buffer->sampler_views.stage[0]);
/* mismatch control */
idct->pipe->set_framebuffer_state(idct->pipe, &buffer->fb_state_mismatch);
idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state);
idct->pipe->bind_sampler_states(idct->pipe, PIPE_SHADER_FRAGMENT,
0, 2, idct->samplers);
- idct->pipe->set_fragment_sampler_views(idct->pipe, 2, buffer->sampler_views.stage[1]);
+ idct->pipe->set_sampler_views(idct->pipe, PIPE_SHADER_FRAGMENT,
+ 0, 2, buffer->sampler_views.stage[1]);
}
filter->pipe->bind_blend_state(filter->pipe, filter->blend);
filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
0, 1, &filter->sampler);
- filter->pipe->set_fragment_sampler_views(filter->pipe, 1, &src);
+ filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
+ 0, 1, &src);
filter->pipe->bind_vs_state(filter->pipe, filter->vs);
filter->pipe->bind_fs_state(filter->pipe, filter->fs);
filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
renderer->pipe->bind_vs_state(renderer->pipe, renderer->vs_ref);
renderer->pipe->bind_fs_state(renderer->pipe, renderer->fs_ref);
- renderer->pipe->set_fragment_sampler_views(renderer->pipe, 1, &ref);
+ renderer->pipe->set_sampler_views(renderer->pipe, PIPE_SHADER_FRAGMENT,
+ 0, 1, &ref);
renderer->pipe->bind_sampler_states(renderer->pipe, PIPE_SHADER_FRAGMENT,
0, 1, &renderer->sampler_ref);
filter->pipe->bind_blend_state(filter->pipe, filter->blend);
filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
0, 1, &filter->sampler);
- filter->pipe->set_fragment_sampler_views(filter->pipe, 1, &src);
+ filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
+ 0, 1, &src);
filter->pipe->bind_vs_state(filter->pipe, filter->vs);
filter->pipe->bind_fs_state(filter->pipe, filter->fs);
filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT)
vl_idct_prepare_stage2(i ? &dec->idct_c : &dec->idct_y, &buf->idct[plane]);
else {
- dec->base.context->set_fragment_sampler_views(dec->base.context, 1, &mc_source_sv[plane]);
+ dec->base.context->set_sampler_views(dec->base.context,
+ PIPE_SHADER_FRAGMENT, 0, 1,
+ &mc_source_sv[plane]);
dec->base.context->bind_sampler_states(dec->base.context,
PIPE_SHADER_FRAGMENT,
0, 1, &dec->sampler_ycbcr);
0, 3, zscan->samplers);
zscan->pipe->set_framebuffer_state(zscan->pipe, &buffer->fb_state);
zscan->pipe->set_viewport_states(zscan->pipe, 0, 1, &buffer->viewport);
- zscan->pipe->set_fragment_sampler_views(zscan->pipe, 3, &buffer->src);
+ zscan->pipe->set_sampler_views(zscan->pipe, PIPE_SHADER_FRAGMENT,
+ 0, 3, &buffer->src);
zscan->pipe->bind_vs_state(zscan->pipe, zscan->vs);
zscan->pipe->bind_fs_state(zscan->pipe, zscan->fs);
util_draw_arrays_instanced(zscan->pipe, PIPE_PRIM_QUADS, 0, 4, 0, num_instances);
PsSetShaderWithIfaces (D3D11 only)
- Gallium does not support shader interfaces
-PsSetShaderResources -> set_fragment_sampler_views
+PsSetShaderResources -> set_sampler_views
* may want to allow binding subsets instead of all at once
QueryBegin -> begin_query
VsSetShaderWithIfaces (D3D11 only)
- Gallium does not support shader interfaces
-VsSetShaderResources -> set_fragment_sampler_views
+VsSetShaderResources -> set_sampler_views
* may want to allow binding subsets instead of all at once
texture is going to be constrained to. Similar to the LOD range, this is added
to the array index which is used for sampling.
-* ``set_fragment_sampler_views`` binds an array of sampler views to
- fragment shader stage. Every binding point acquires a reference
+* ``set_sampler_views`` binds an array of sampler views to a shader stage.
+ Every binding point acquires a reference
to a respective sampler view and releases a reference to the previous
- sampler view. If M is the maximum number of sampler units and N units
- is passed to set_fragment_sampler_views, the driver should unbind the
- sampler views for units N..M-1.
-
-* ``set_vertex_sampler_views`` binds an array of sampler views to vertex
- shader stage. Every binding point acquires a reference to a respective
- sampler view and releases a reference to the previous sampler view.
+ sampler view.
* ``create_sampler_view`` creates a new sampler view. ``texture`` is associated
with the sampler view which results in sampler view holding a reference
In addition, normal texture sampling is allowed from the compute
program: ``bind_sampler_states`` may be used to set up texture
-samplers for the compute stage and ``set_compute_sampler_views`` may
+samplers for the compute stage and ``set_sampler_views`` may
be used to bind a number of sampler views to it.
ctx->dirty |= FD_DIRTY_VERTTEX;
}
+static void
+fd_set_sampler_views(struct pipe_context *pctx, unsigned shader,
+ unsigne start, unsigned nr,
+ struct pipe_sampler_view **views)
+{
+ assert(start == 0);
+ switch (shader) {
+ case PIPE_SHADER_FRAGMENT:
+ fd_fragtex_set_sampler_views(pctx, nr, views);
+ break;
+ case PIPE_SHADER_VERTEX:
+ fd_verttex_set_sampler_views(pctx, nr, views);
+ break;
+ default:
+ ;
+ }
+}
+
void
fd_texture_init(struct pipe_context *pctx)
{
pctx->sampler_view_destroy = fd_sampler_view_destroy;
pctx->bind_sampler_states = fd_sampler_states_bind;
- pctx->set_fragment_sampler_views = fd_fragtex_set_sampler_views;
-
- pctx->set_vertex_sampler_views = fd_verttex_set_sampler_views;
+ pctx->set_sampler_views = fd_set_sampler_views;
}
struct galahad_context *glhd_pipe = galahad_context(_pipe);
struct pipe_context *pipe = glhd_pipe->pipe;
struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS];
- struct pipe_sampler_view **views = NULL;
unsigned i;
- if (_views) {
- for (i = 0; i < num; i++)
- unwrapped_views[i] = galahad_sampler_view_unwrap(_views[i]);
- for (; i < PIPE_MAX_SAMPLERS; i++)
- unwrapped_views[i] = NULL;
+ for (i = 0; i < num; i++)
+ unwrapped_views[i] = galahad_sampler_view_unwrap(_views[i]);
- views = unwrapped_views;
- }
-
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- pipe->set_vertex_sampler_views(pipe, num, views);
- break;
- case PIPE_SHADER_FRAGMENT:
- pipe->set_fragment_sampler_views(pipe, num, views);
- break;
- case PIPE_SHADER_GEOMETRY:
- pipe->set_geometry_sampler_views(pipe, num, views);
- break;
- default:
- assert(0);
- }
-}
-
-static void
-galahad_context_set_vertex_sampler_views(struct pipe_context *_pipe,
- unsigned num,
- struct pipe_sampler_view **_views)
-{
- galahad_context_set_sampler_views(_pipe, PIPE_SHADER_VERTEX,
- 0, num, _views);
-}
-
-static void
-galahad_context_set_fragment_sampler_views(struct pipe_context *_pipe,
- unsigned num,
- struct pipe_sampler_view **_views)
-{
- galahad_context_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT,
- 0, num, _views);
-}
-
-static void
-galahad_context_set_geometry_sampler_views(struct pipe_context *_pipe,
- unsigned num,
- struct pipe_sampler_view **_views)
-{
- galahad_context_set_sampler_views(_pipe, PIPE_SHADER_GEOMETRY,
- 0, num, _views);
+ pipe->set_sampler_views(pipe, shader, start, num, unwrapped_views);
}
static void
GLHD_PIPE_INIT(set_polygon_stipple);
GLHD_PIPE_INIT(set_scissor_states);
GLHD_PIPE_INIT(set_viewport_states);
- GLHD_PIPE_INIT(set_fragment_sampler_views);
- GLHD_PIPE_INIT(set_vertex_sampler_views);
- GLHD_PIPE_INIT(set_geometry_sampler_views);
- //GLHD_PIPE_INIT(set_compute_sampler_views);
+ GLHD_PIPE_INIT(set_sampler_views);
//GLHD_PIPE_INIT(set_shader_resources);
GLHD_PIPE_INIT(set_vertex_buffers);
GLHD_PIPE_INIT(set_index_buffer);
}
+static void
+i915_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+ unsigned start, unsigned num,
+ struct pipe_sampler_view **views)
+{
+ assert(start == 0);
+ switch (shader) {
+ case PIPE_SHADER_FRAGMENT:
+ i915_set_fragment_sampler_views(pipe, num, views);
+ break;
+ case PIPE_SHADER_VERTEX:
+ i915_set_vertex_sampler_views(pipe, num, views);
+ break;
+ default:
+ ;
+ }
+}
+
+
static struct pipe_sampler_view *
i915_create_sampler_view(struct pipe_context *pipe,
struct pipe_resource *texture,
i915->base.set_polygon_stipple = i915_set_polygon_stipple;
i915->base.set_scissor_states = i915_set_scissor_states;
- i915->base.set_fragment_sampler_views = i915_set_fragment_sampler_views;
- i915->base.set_vertex_sampler_views = i915_set_vertex_sampler_views;
+ i915->base.set_sampler_views = i915_set_sampler_views;
i915->base.create_sampler_view = i915_create_sampler_view;
i915->base.sampler_view_destroy = i915_sampler_view_destroy;
i915->base.set_viewport_states = i915_set_viewport_states;
struct identity_context *id_pipe = identity_context(_pipe);
struct pipe_context *pipe = id_pipe->pipe;
struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS];
- struct pipe_sampler_view **views = NULL;
unsigned i;
- /* remove this when we have pipe->set_sampler_views(..., start, ...) */
- assert(start == 0);
+ for (i = 0; i < num; i++)
+ unwrapped_views[i] = identity_sampler_view_unwrap(_views[i]);
- if (_views) {
- for (i = 0; i < num; i++)
- unwrapped_views[i] = identity_sampler_view_unwrap(_views[i]);
- for (; i < PIPE_MAX_SAMPLERS; i++)
- unwrapped_views[i] = NULL;
-
- views = unwrapped_views;
- }
-
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- pipe->set_vertex_sampler_views(pipe, num, views);
- break;
- case PIPE_SHADER_GEOMETRY:
- pipe->set_geometry_sampler_views(pipe, num, views);
- break;
- case PIPE_SHADER_FRAGMENT:
- pipe->set_fragment_sampler_views(pipe, num, views);
- break;
- default:
- debug_error("Unexpected shader in identity_set_sampler_views()");
- }
-}
-
-static void
-identity_set_fragment_sampler_views(struct pipe_context *_pipe,
- unsigned num,
- struct pipe_sampler_view **_views)
-{
- identity_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT, 0, num, _views);
-}
-
-static void
-identity_set_vertex_sampler_views(struct pipe_context *_pipe,
- unsigned num,
- struct pipe_sampler_view **_views)
-{
- identity_set_sampler_views(_pipe, PIPE_SHADER_VERTEX, 0, num, _views);
+ pipe->set_sampler_views(pipe, shader, start, num, unwrapped_views);
}
static void
id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple;
id_pipe->base.set_scissor_states = identity_set_scissor_states;
id_pipe->base.set_viewport_states = identity_set_viewport_states;
- id_pipe->base.set_fragment_sampler_views = identity_set_fragment_sampler_views;
- id_pipe->base.set_vertex_sampler_views = identity_set_vertex_sampler_views;
+ id_pipe->base.set_sampler_views = identity_set_sampler_views;
id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers;
id_pipe->base.set_index_buffer = identity_set_index_buffer;
id_pipe->base.resource_copy_region = identity_resource_copy_region;
ilo->dirty |= ILO_DIRTY_VIEW_CS;
}
+static void
+ilo_set_sampler_views2(struct pipe_context *pipe, unsigned shader,
+ unsigned start_slot, unsigned num_views,
+ struct pipe_sampler_view **views)
+{
+ switch (shader) {
+ case PIPE_SHADER_VERTEX:
+ ilo_set_vertex_sampler_views(pipe, num_views, views);
+ break;
+ case PIPE_SHADER_GEOMETRY:
+ ilo_set_geometry_sampler_views(pipe, num_views, views);
+ break;
+ case PIPE_SHADER_FRAGMENT:
+ ilo_set_fragment_sampler_views(pipe, num_views, views);
+ break;
+ case PIPE_SHADER_COMPUTE:
+ ilo_set_compute_sampler_views(pipe, start_slot, num_views, views);
+ break;
+ }
+}
+
+
static void
ilo_set_shader_resources(struct pipe_context *pipe,
unsigned start, unsigned count,
ilo->base.set_polygon_stipple = ilo_set_polygon_stipple;
ilo->base.set_scissor_states = ilo_set_scissor_states;
ilo->base.set_viewport_states = ilo_set_viewport_states;
- ilo->base.set_fragment_sampler_views = ilo_set_fragment_sampler_views;
- ilo->base.set_vertex_sampler_views = ilo_set_vertex_sampler_views;
- ilo->base.set_geometry_sampler_views = ilo_set_geometry_sampler_views;
- ilo->base.set_compute_sampler_views = ilo_set_compute_sampler_views;
+ ilo->base.set_sampler_views = ilo_set_sampler_views2;
ilo->base.set_shader_resources = ilo_set_shader_resources;
ilo->base.set_vertex_buffers = ilo_set_vertex_buffers;
ilo->base.set_index_buffer = ilo_set_index_buffer;
}
-static void
-llvmpipe_set_fragment_sampler_views(struct pipe_context *pipe,
- unsigned num,
- struct pipe_sampler_view **views)
-{
- llvmpipe_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, views);
-}
-
-
-static void
-llvmpipe_set_vertex_sampler_views(struct pipe_context *pipe,
- unsigned num,
- struct pipe_sampler_view **views)
-{
- llvmpipe_set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, num, views);
-}
-
-
-static void
-llvmpipe_set_geometry_sampler_views(struct pipe_context *pipe,
- unsigned num,
- struct pipe_sampler_view **views)
-{
- llvmpipe_set_sampler_views(pipe, PIPE_SHADER_GEOMETRY, 0, num, views);
-}
-
static struct pipe_sampler_view *
llvmpipe_create_sampler_view(struct pipe_context *pipe,
struct pipe_resource *texture,
llvmpipe->pipe.create_sampler_state = llvmpipe_create_sampler_state;
llvmpipe->pipe.bind_sampler_states = llvmpipe_bind_sampler_states;
- llvmpipe->pipe.set_fragment_sampler_views = llvmpipe_set_fragment_sampler_views;
- llvmpipe->pipe.set_vertex_sampler_views = llvmpipe_set_vertex_sampler_views;
- llvmpipe->pipe.set_geometry_sampler_views = llvmpipe_set_geometry_sampler_views;
llvmpipe->pipe.create_sampler_view = llvmpipe_create_sampler_view;
+ llvmpipe->pipe.set_sampler_views = llvmpipe_set_sampler_views;
llvmpipe->pipe.sampler_view_destroy = llvmpipe_sampler_view_destroy;
llvmpipe->pipe.delete_sampler_state = llvmpipe_delete_sampler_state;
}
return surface;
}
-static void noop_set_vs_sampler_view(struct pipe_context *ctx, unsigned count,
- struct pipe_sampler_view **views)
-{
-}
-
-static void noop_set_ps_sampler_view(struct pipe_context *ctx, unsigned count,
- struct pipe_sampler_view **views)
+static void noop_set_sampler_views(struct pipe_context *ctx, unsigned shader,
+ unsigned start, unsigned count,
+ struct pipe_sampler_view **views)
{
}
ctx->set_blend_color = noop_set_blend_color;
ctx->set_clip_state = noop_set_clip_state;
ctx->set_constant_buffer = noop_set_constant_buffer;
- ctx->set_fragment_sampler_views = noop_set_ps_sampler_view;
+ ctx->set_sampler_views = noop_set_sampler_views;
ctx->set_framebuffer_state = noop_set_framebuffer_state;
ctx->set_polygon_stipple = noop_set_polygon_stipple;
ctx->set_sample_mask = noop_set_sample_mask;
ctx->set_stencil_ref = noop_set_stencil_ref;
ctx->set_vertex_buffers = noop_set_vertex_buffers;
ctx->set_index_buffer = noop_set_index_buffer;
- ctx->set_vertex_sampler_views = noop_set_vs_sampler_view;
ctx->set_viewport_states = noop_set_viewport_states;
ctx->sampler_view_destroy = noop_sampler_view_destroy;
ctx->surface_destroy = noop_surface_destroy;
nv40_verttex_sampler_states_bind(struct pipe_context *pipe,
unsigned nr, void **hwcso);
+void
+nv40_verttex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
+ struct pipe_sampler_view **views);
+
+void
+nv30_fragtex_set_sampler_views(struct pipe_context *pipe,
+ unsigned nr, struct pipe_sampler_view **views);
+
void
nv30_push_vbo(struct nv30_context *nv30, const struct pipe_draw_info *info);
}
-static void
+void
nv30_fragtex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
struct pipe_sampler_view **views)
{
nv30->dirty |= NV30_NEW_FRAGTEX;
}
+
+static void
+nv30_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+ unsigned start, unsigned nr,
+ struct pipe_sampler_view **views)
+{
+ assert(start == 0);
+ switch (shader) {
+ case PIPE_SHADER_FRAGMENT:
+ nv30_fragtex_set_sampler_views(pipe, nr, views);
+ break;
+ case PIPE_SHADER_VERTEX:
+ nv40_verttex_set_sampler_views(pipe, nr, views);
+ break;
+ default:
+ ;
+ }
+}
+
+
void
nv30_fragtex_init(struct pipe_context *pipe)
{
- pipe->set_fragment_sampler_views = nv30_fragtex_set_sampler_views;
+ pipe->set_sampler_views = nv30_set_sampler_views;
}
}
-static void
+void
nv40_verttex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
struct pipe_sampler_view **views)
{
void
nv40_verttex_init(struct pipe_context *pipe)
{
- pipe->set_vertex_sampler_views = nv40_verttex_set_sampler_views;
+ /* nothing */
}
}
static void
-nv50_vp_set_sampler_views(struct pipe_context *pipe,
- unsigned nr,
- struct pipe_sampler_view **views)
+nv50_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+ unsigned start, unsigned nr,
+ struct pipe_sampler_view **views)
{
- nv50_stage_set_sampler_views(nv50_context(pipe), 0, nr, views);
+ assert(start == 0);
+ switch (shader) {
+ case PIPE_SHADER_VERTEX:
+ nv50_stage_set_sampler_views(nv50_context(pipe), 0, nr, views);
+ break;
+ case PIPE_SHADER_GEOMETRY:
+ nv50_stage_set_sampler_views(nv50_context(pipe), 1, nr, views);
+ break;
+ case PIPE_SHADER_FRAGMENT:
+ nv50_stage_set_sampler_views(nv50_context(pipe), 2, nr, views);
+ break;
+ default:
+ ;
+ }
}
-static void
-nv50_fp_set_sampler_views(struct pipe_context *pipe,
- unsigned nr,
- struct pipe_sampler_view **views)
-{
- nv50_stage_set_sampler_views(nv50_context(pipe), 2, nr, views);
-}
-static void
-nv50_gp_set_sampler_views(struct pipe_context *pipe,
- unsigned nr,
- struct pipe_sampler_view **views)
-{
- nv50_stage_set_sampler_views(nv50_context(pipe), 1, nr, views);
-}
/* ============================= SHADERS =======================================
*/
pipe->create_sampler_view = nv50_create_sampler_view;
pipe->sampler_view_destroy = nv50_sampler_view_destroy;
- pipe->set_vertex_sampler_views = nv50_vp_set_sampler_views;
- pipe->set_fragment_sampler_views = nv50_fp_set_sampler_views;
- pipe->set_geometry_sampler_views = nv50_gp_set_sampler_views;
+ pipe->set_sampler_views = nv50_set_sampler_views;
pipe->create_vs_state = nv50_vp_state_create;
pipe->create_fs_state = nv50_fp_state_create;
nvc0->dirty |= NVC0_NEW_TEXTURES;
}
-static void
-nvc0_vp_set_sampler_views(struct pipe_context *pipe,
- unsigned nr,
- struct pipe_sampler_view **views)
-{
- nvc0_stage_set_sampler_views(nvc0_context(pipe), 0, nr, views);
-}
-
-static void
-nvc0_fp_set_sampler_views(struct pipe_context *pipe,
- unsigned nr,
- struct pipe_sampler_view **views)
-{
- nvc0_stage_set_sampler_views(nvc0_context(pipe), 4, nr, views);
-}
-
-static void
-nvc0_gp_set_sampler_views(struct pipe_context *pipe,
- unsigned nr,
- struct pipe_sampler_view **views)
-{
- nvc0_stage_set_sampler_views(nvc0_context(pipe), 3, nr, views);
-}
-
static void
nvc0_stage_set_sampler_views_range(struct nvc0_context *nvc0, const unsigned s,
unsigned start, unsigned nr,
}
static void
-nvc0_cp_set_sampler_views(struct pipe_context *pipe,
- unsigned start, unsigned nr,
- struct pipe_sampler_view **views)
+nvc0_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+ unsigned start, unsigned nr,
+ struct pipe_sampler_view **views)
{
- nvc0_stage_set_sampler_views_range(nvc0_context(pipe), 5, start, nr, views);
-
- nvc0_context(pipe)->dirty_cp |= NVC0_NEW_CP_TEXTURES;
+ assert(start == 0);
+ switch (shader) {
+ case PIPE_SHADER_VERTEX:
+ nvc0_stage_set_sampler_views(nvc0_context(pipe), 0, nr, views);
+ break;
+ case PIPE_SHADER_GEOMETRY:
+ nvc0_stage_set_sampler_views(nvc0_context(pipe), 3, nr, views);
+ break;
+ case PIPE_SHADER_FRAGMENT:
+ nvc0_stage_set_sampler_views(nvc0_context(pipe), 4, nr, views);
+ break;
+ case PIPE_SHADER_COMPUTE:
+ nvc0_stage_set_sampler_views_range(nvc0_context(pipe), 5,
+ start, nr, views);
+ nvc0_context(pipe)->dirty_cp |= NVC0_NEW_CP_TEXTURES;
+ break;
+ default:
+ ;
+ }
}
pipe->create_sampler_view = nvc0_create_sampler_view;
pipe->sampler_view_destroy = nvc0_sampler_view_destroy;
- pipe->set_vertex_sampler_views = nvc0_vp_set_sampler_views;
- pipe->set_fragment_sampler_views = nvc0_fp_set_sampler_views;
- pipe->set_geometry_sampler_views = nvc0_gp_set_sampler_views;
- pipe->set_compute_sampler_views = nvc0_cp_set_sampler_views;
+ pipe->set_sampler_views = nvc0_set_sampler_views;
pipe->create_vs_state = nvc0_vp_state_create;
pipe->create_fs_state = nvc0_fp_state_create;
return R300_TX_CACHE(num + index);
}
-static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
- unsigned count,
- struct pipe_sampler_view** views)
+static void r300_set_sampler_views(struct pipe_context* pipe, unsigned shader,
+ unsigned start, unsigned count,
+ struct pipe_sampler_view** views)
{
struct r300_context* r300 = r300_context(pipe);
struct r300_textures_state* state =
unsigned tex_units = r300->screen->caps.num_tex_units;
boolean dirty_tex = FALSE;
+ if (shader != PIPE_SHADER_FRAGMENT)
+ return;
+
+ assert(start == 0); /* non-zero not handled yet */
+
if (count > tex_units) {
return;
}
r300->context.bind_sampler_states = r300_bind_sampler_states;
r300->context.delete_sampler_state = r300_delete_sampler_state;
- r300->context.set_fragment_sampler_views = r300_set_fragment_sampler_views;
+ r300->context.set_sampler_views = r300_set_sampler_views;
r300->context.create_sampler_view = r300_create_sampler_view;
r300->context.sampler_view_destroy = r300_sampler_view_destroy;
}
}
-static void evergreen_set_cs_sampler_view(struct pipe_context *ctx_,
+void evergreen_set_cs_sampler_view(struct pipe_context *ctx_,
unsigned start_slot, unsigned count,
struct pipe_sampler_view **views)
{
ctx->b.b.bind_compute_state = evergreen_bind_compute_state;
// ctx->context.create_sampler_view = evergreen_compute_create_sampler_view;
ctx->b.b.set_compute_resources = evergreen_set_compute_resources;
- ctx->b.b.set_compute_sampler_views = evergreen_set_cs_sampler_view;
ctx->b.b.set_global_binding = evergreen_set_global_binding;
ctx->b.b.launch_grid = evergreen_launch_grid;
struct compute_memory_pool* compute_memory_pool_new(
struct r600_screen *rscreen);
+/* evergreen_compute.c */
+void evergreen_set_cs_sampler_view(struct pipe_context *ctx_,
+ unsigned start_slot, unsigned count,
+ struct pipe_sampler_view **views);
+
/* evergreen_state.c */
struct pipe_sampler_view *
evergreen_create_sampler_view_custom(struct pipe_context *ctx,
assert(start == 0); /* XXX fix below */
+ if (shader == PIPE_SHADER_COMPUTE) {
+ evergreen_set_cs_sampler_view(pipe, start, count, views);
+ return;
+ }
+
remaining_mask = dst->views.enabled_mask & disable_mask;
while (remaining_mask) {
}
}
-static void r600_set_vs_sampler_views(struct pipe_context *ctx, unsigned count,
- struct pipe_sampler_view **views)
-{
- r600_set_sampler_views(ctx, PIPE_SHADER_VERTEX, 0, count, views);
-}
-
-static void r600_set_ps_sampler_views(struct pipe_context *ctx, unsigned count,
- struct pipe_sampler_view **views)
-{
- r600_set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, count, views);
-}
-
static void r600_set_viewport_states(struct pipe_context *ctx,
unsigned start_slot,
unsigned num_viewports,
rctx->b.b.set_viewport_states = r600_set_viewport_states;
rctx->b.b.set_vertex_buffers = r600_set_vertex_buffers;
rctx->b.b.set_index_buffer = r600_set_index_buffer;
- rctx->b.b.set_fragment_sampler_views = r600_set_ps_sampler_views;
- rctx->b.b.set_vertex_sampler_views = r600_set_vs_sampler_views;
+ rctx->b.b.set_sampler_views = r600_set_sampler_views;
rctx->b.b.sampler_view_destroy = r600_sampler_view_destroy;
rctx->b.b.texture_barrier = r600_texture_barrier;
rctx->b.b.set_stream_output_targets = r600_set_streamout_targets;
/* XXX consider moving this function to si_descriptors.c for gcc to inline
* the si_set_sampler_view calls. LTO might help too. */
-static void si_set_sampler_views(struct r600_context *rctx,
- unsigned shader, unsigned count,
+static void si_set_sampler_views(struct pipe_context *ctx,
+ unsigned shader, unsigned start,
+ unsigned count,
struct pipe_sampler_view **views)
{
+ struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_textures_info *samplers = &rctx->samplers[shader];
struct si_pipe_sampler_view **rviews = (struct si_pipe_sampler_view **)views;
int i;
+ if (shader != PIPE_SHADER_VERTEX && shader != PIPE_SHADER_FRAGMENT)
+ return;
+
+ assert(start == 0);
+
for (i = 0; i < count; i++) {
if (views[i]) {
struct r600_texture *rtex =
rctx->b.flags |= R600_CONTEXT_INV_TEX_CACHE;
}
-static void si_set_vs_sampler_views(struct pipe_context *ctx, unsigned count,
- struct pipe_sampler_view **views)
-{
- struct r600_context *rctx = (struct r600_context *)ctx;
-
- si_set_sampler_views(rctx, PIPE_SHADER_VERTEX, count, views);
-}
-
-static void si_set_ps_sampler_views(struct pipe_context *ctx, unsigned count,
- struct pipe_sampler_view **views)
-{
- struct r600_context *rctx = (struct r600_context *)ctx;
-
- si_set_sampler_views(rctx, PIPE_SHADER_FRAGMENT, count, views);
-}
-
static struct si_pm4_state *si_set_sampler_states(struct r600_context *rctx, unsigned count,
void **states,
struct r600_textures_info *samplers,
rctx->b.b.delete_sampler_state = si_delete_sampler_state;
rctx->b.b.create_sampler_view = si_create_sampler_view;
- rctx->b.b.set_vertex_sampler_views = si_set_vs_sampler_views;
- rctx->b.b.set_fragment_sampler_views = si_set_ps_sampler_views;
+ rctx->b.b.set_sampler_views = si_set_sampler_views;
rctx->b.b.sampler_view_destroy = si_sampler_view_destroy;
rctx->b.b.set_sample_mask = si_set_sample_mask;
views = unwrapped_views;
}
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- pipe->set_vertex_sampler_views(pipe, num, views);
- break;
- case PIPE_SHADER_FRAGMENT:
- pipe->set_fragment_sampler_views(pipe, num, views);
- break;
- default:
- assert(0);
- }
+ pipe->set_sampler_views(pipe, shader, start, num, views);
pipe_mutex_unlock(rb_pipe->call_mutex);
}
-static void
-rbug_set_vertex_sampler_views(struct pipe_context *_pipe,
- unsigned num,
- struct pipe_sampler_view **_views)
-{
- rbug_set_sampler_views(_pipe, PIPE_SHADER_VERTEX, 0, num, _views);
-}
-
-static void
-rbug_set_fragment_sampler_views(struct pipe_context *_pipe,
- unsigned num,
- struct pipe_sampler_view **_views)
-{
- rbug_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT, 0, num, _views);
-}
-
static void
rbug_set_vertex_buffers(struct pipe_context *_pipe,
unsigned start_slot, unsigned num_buffers,
rb_pipe->base.set_polygon_stipple = rbug_set_polygon_stipple;
rb_pipe->base.set_scissor_states = rbug_set_scissor_states;
rb_pipe->base.set_viewport_states = rbug_set_viewport_states;
- rb_pipe->base.set_fragment_sampler_views = rbug_set_fragment_sampler_views;
- rb_pipe->base.set_vertex_sampler_views = rbug_set_vertex_sampler_views;
+ rb_pipe->base.set_sampler_views = rbug_set_sampler_views;
rb_pipe->base.set_vertex_buffers = rbug_set_vertex_buffers;
rb_pipe->base.set_index_buffer = rbug_set_index_buffer;
rb_pipe->base.set_sample_mask = rbug_set_sample_mask;
}
-static void
-softpipe_set_fragment_sampler_views(struct pipe_context *pipe,
- unsigned num,
- struct pipe_sampler_view **views)
-{
- softpipe_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, views);
-}
-
-
-static void
-softpipe_set_vertex_sampler_views(struct pipe_context *pipe,
- unsigned num,
- struct pipe_sampler_view **views)
-{
- softpipe_set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, num, views);
-}
-
-
-static void
-softpipe_set_geometry_sampler_views(struct pipe_context *pipe,
- unsigned num,
- struct pipe_sampler_view **views)
-{
- softpipe_set_sampler_views(pipe, PIPE_SHADER_GEOMETRY, 0, num, views);
-}
-
-
static void
softpipe_delete_sampler_state(struct pipe_context *pipe,
void *sampler)
pipe->bind_sampler_states = softpipe_bind_sampler_states;
pipe->delete_sampler_state = softpipe_delete_sampler_state;
- pipe->set_fragment_sampler_views = softpipe_set_fragment_sampler_views;
- pipe->set_vertex_sampler_views = softpipe_set_vertex_sampler_views;
- pipe->set_geometry_sampler_views = softpipe_set_geometry_sampler_views;
-
pipe->create_sampler_view = softpipe_create_sampler_view;
+ pipe->set_sampler_views = softpipe_set_sampler_views;
pipe->sampler_view_destroy = softpipe_sampler_view_destroy;
}
}
-static void
-svga_set_fragment_sampler_views(struct pipe_context *pipe,
- unsigned num,
- struct pipe_sampler_view **views)
-{
- svga_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, views);
-}
-
-
void svga_init_sampler_functions( struct svga_context *svga )
{
svga->pipe.create_sampler_state = svga_create_sampler_state;
svga->pipe.bind_sampler_states = svga_bind_sampler_states;
svga->pipe.delete_sampler_state = svga_delete_sampler_state;
- svga->pipe.set_fragment_sampler_views = svga_set_fragment_sampler_views;
+ svga->pipe.set_sampler_views = svga_set_sampler_views;
svga->pipe.create_sampler_view = svga_create_sampler_view;
svga->pipe.sampler_view_destroy = svga_sampler_view_destroy;
}
}
views = unwrapped_views;
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- trace_dump_call_begin("pipe_context", "set_vertex_sampler_views");
- break;
- case PIPE_SHADER_GEOMETRY:
- trace_dump_call_begin("pipe_context", "set_geometry_sampler_views");
- break;
- case PIPE_SHADER_FRAGMENT:
- trace_dump_call_begin("pipe_context", "set_fragment_sampler_views");
- break;
- default:
- debug_error("Unexpected shader in trace_context_set_sampler_views()");
- }
+ trace_dump_call_begin("pipe_context", "set_sampler_views");
trace_dump_arg(ptr, pipe);
- /*trace_dump_arg(uint, shader);*/
+ trace_dump_arg(uint, shader);
+ trace_dump_arg(uint, start);
trace_dump_arg(uint, num);
trace_dump_arg_array(ptr, views, num);
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- pipe->set_vertex_sampler_views(pipe, num, views);
- break;
- case PIPE_SHADER_GEOMETRY:
- pipe->set_geometry_sampler_views(pipe, num, views);
- break;
- case PIPE_SHADER_FRAGMENT:
- pipe->set_fragment_sampler_views(pipe, num, views);
- break;
- default:
- debug_error("Unexpected shader in trace_context_set_sampler_views()");
- }
+ pipe->set_sampler_views(pipe, shader, start, num, views);
trace_dump_call_end();
}
-static INLINE void
-trace_context_set_fragment_sampler_views(struct pipe_context *_pipe,
- unsigned num,
- struct pipe_sampler_view **views)
-{
- trace_context_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT, 0, num, views);
-}
-
-
-static INLINE void
-trace_context_set_vertex_sampler_views(struct pipe_context *_pipe,
- unsigned num,
- struct pipe_sampler_view **views)
-{
- trace_context_set_sampler_views(_pipe, PIPE_SHADER_VERTEX, 0, num, views);
-}
-
-
-static INLINE void
-trace_context_set_geometry_sampler_views(struct pipe_context *_pipe,
- unsigned num,
- struct pipe_sampler_view **views)
-{
- trace_context_set_sampler_views(_pipe, PIPE_SHADER_GEOMETRY, 0, num, views);
-}
-
-
static INLINE void
trace_context_set_vertex_buffers(struct pipe_context *_pipe,
unsigned start_slot, unsigned num_buffers,
TR_CTX_INIT(set_polygon_stipple);
TR_CTX_INIT(set_scissor_states);
TR_CTX_INIT(set_viewport_states);
- TR_CTX_INIT(set_fragment_sampler_views);
- TR_CTX_INIT(set_vertex_sampler_views);
- TR_CTX_INIT(set_geometry_sampler_views);
+ TR_CTX_INIT(set_sampler_views);
TR_CTX_INIT(create_sampler_view);
TR_CTX_INIT(sampler_view_destroy);
TR_CTX_INIT(create_surface);
unsigned num_viewports,
const struct pipe_viewport_state *);
- void (*set_fragment_sampler_views)(struct pipe_context *,
- unsigned num_views,
- struct pipe_sampler_view **);
-
- void (*set_vertex_sampler_views)(struct pipe_context *,
- unsigned num_views,
- struct pipe_sampler_view **);
-
- void (*set_geometry_sampler_views)(struct pipe_context *,
- unsigned num_views,
- struct pipe_sampler_view **);
-
- void (*set_compute_sampler_views)(struct pipe_context *,
- unsigned start_slot, unsigned num_views,
- struct pipe_sampler_view **);
+ void (*set_sampler_views)(struct pipe_context *, unsigned shader,
+ unsigned start_slot, unsigned num_views,
+ struct pipe_sampler_view **);
/**
* Bind an array of shader resources that will be used by the
if (sv == NULL)
exit(5);
- ctx->set_fragment_sampler_views(ctx, 1, &sv);
+ ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
memset(&sampler_desc, 0, sizeof sampler_desc);
if (sv == NULL)
exit(5);
- ctx->set_fragment_sampler_views(ctx, 1, &sv);
+ ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
memset(&sampler_desc, 0, sizeof sampler_desc);
if (sv == NULL)
exit(5);
- ctx->set_fragment_sampler_views(ctx, 1, &sv);
+ ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
memset(&sampler_desc, 0, sizeof sampler_desc);
PIPE_FORMAT_B8G8R8A8_UNORM, tex2d);
sv = graw_util_create_simple_sampler_view(&info, texture);
- info.ctx->set_fragment_sampler_views(info.ctx, 1, &sv);
+ info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
sampler = graw_util_create_simple_sampler(&info,
PIPE_TEX_WRAP_REPEAT,
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
- info.ctx->set_fragment_sampler_views(info.ctx, 1, &linear_sv);
+ info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &linear_sv);
set_vertices(vertices1, 4);
util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4);
- info.ctx->set_fragment_sampler_views(info.ctx, 1, &srgb_sv);
+ info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &srgb_sv);
set_vertices(vertices2, 4);
util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4);
if (sv == NULL)
exit(5);
- info.ctx->set_fragment_sampler_views(info.ctx, 1, &sv);
+ info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
sampler = graw_util_create_simple_sampler(&info,
PIPE_TEX_WRAP_REPEAT,
if (sv == NULL)
exit(5);
- ctx->set_fragment_sampler_views(ctx, 1, &sv);
+ ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv);
memset(&sampler_desc, 0, sizeof sampler_desc);
assert(ctx->view[i]);
}
- pipe->set_compute_sampler_views(pipe, 0, i, ctx->view);
+ pipe->set_sampler_views(pipe, PIPE_SHADER_COMPUTE, 0, i, ctx->view);
}
static void destroy_sampler_views(struct context *ctx)
struct pipe_context *pipe = ctx->pipe;
int i;
- pipe->set_compute_sampler_views(pipe, 0, MAX_RESOURCES, NULL);
+ pipe->set_sampler_views(pipe, PIPE_SHADER_COMPUTE, 0, MAX_RESOURCES, NULL);
for (i = 0; i < MAX_RESOURCES; ++i) {
if (ctx->view[i]) {
self._state.vs.sampler = []
self._state.gs.sampler = []
self._state.fs.sampler = []
- self._state.vs.sampler_views = []
- self._state.gs.sampler_views = []
- self._state.fs.sampler_views = []
+ self._state.sampler_views = {}
self._state.vs.constant_buffer = []
self._state.gs.constant_buffer = []
self._state.fs.constant_buffer = []
def sampler_view_destroy(self, view):
pass
- def set_fragment_sampler_views(self, num, views):
- self._state.fs.sampler_views = views
-
- def set_geometry_sampler_views(self, num, views):
- self._state.gs.sampler_views = views
-
- def set_vertex_sampler_views(self, num, views):
- self._state.vs.sampler_views = views
+ def set_sampler_views(self, shader, start, num, views):
+ self._state.sampler_views[shader] = views
def set_vertex_buffers(self, start_slot, num_buffers, buffers):
self._update(self._state.vertex_buffers, start_slot, num_buffers, buffers)