sampler);
}
+static void
+identity_bind_sampler_states(struct pipe_context *_pipe,
+ unsigned shader,
+ unsigned num_samplers,
+ void **samplers)
+{
+ struct identity_context *id_pipe = identity_context(_pipe);
+ struct pipe_context *pipe = id_pipe->pipe;
+
+ switch (shader) {
+ case PIPE_SHADER_VERTEX:
+ pipe->bind_vertex_sampler_states(pipe, num_samplers, samplers);
+ break;
+ case PIPE_SHADER_GEOMETRY:
+ pipe->bind_geometry_sampler_states(pipe, num_samplers, samplers);
+ break;
+ case PIPE_SHADER_FRAGMENT:
+ pipe->bind_fragment_sampler_states(pipe, num_samplers, samplers);
+ break;
+ default:
+ debug_error("Unexpected shader in identity_bind_sampler_states()");
+ }
+}
+
static void
identity_bind_fragment_sampler_states(struct pipe_context *_pipe,
unsigned num_samplers,
void **samplers)
{
- struct identity_context *id_pipe = identity_context(_pipe);
- struct pipe_context *pipe = id_pipe->pipe;
-
- pipe->bind_fragment_sampler_states(pipe,
- num_samplers,
- samplers);
+ identity_bind_sampler_states(_pipe, PIPE_SHADER_FRAGMENT,
+ num_samplers, samplers);
}
static void
unsigned num_samplers,
void **samplers)
{
- struct identity_context *id_pipe = identity_context(_pipe);
- struct pipe_context *pipe = id_pipe->pipe;
-
- pipe->bind_vertex_sampler_states(pipe,
- num_samplers,
- samplers);
+ identity_bind_sampler_states(_pipe, PIPE_SHADER_VERTEX,
+ num_samplers, samplers);
}
static void
}
static void
-identity_set_fragment_sampler_views(struct pipe_context *_pipe,
- unsigned num,
- struct pipe_sampler_view **_views)
+identity_set_sampler_views(struct pipe_context *_pipe,
+ unsigned shader,
+ unsigned num,
+ struct pipe_sampler_view **_views)
{
struct identity_context *id_pipe = identity_context(_pipe);
struct pipe_context *pipe = id_pipe->pipe;
views = unwrapped_views;
}
- pipe->set_fragment_sampler_views(pipe, num, 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, num, _views);
}
static void
unsigned num,
struct pipe_sampler_view **_views)
{
- 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;
-
- if (_views) {
- for (i = 0; i < num; i++)
- unwrapped_views[i] = identity_sampler_view_unwrap(_views[i]);
- for (; i < Elements(unwrapped_views); i++)
- unwrapped_views[i] = NULL;
-
- views = unwrapped_views;
- }
-
- pipe->set_vertex_sampler_views(pipe, num, views);
+ identity_set_sampler_views(_pipe, PIPE_SHADER_VERTEX, num, _views);
}
static void