mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
gallium/trace: consolidate sampler, sampler_view code
This commit is contained in:
parent
0ad95b923a
commit
348ac08bfd
1 changed files with 82 additions and 50 deletions
|
|
@ -288,45 +288,65 @@ trace_context_create_sampler_state(struct pipe_context *_pipe,
|
|||
|
||||
|
||||
static INLINE void
|
||||
trace_context_bind_fragment_sampler_states(struct pipe_context *_pipe,
|
||||
unsigned num_states,
|
||||
void **states)
|
||||
trace_context_bind_sampler_states(struct pipe_context *_pipe,
|
||||
unsigned shader,
|
||||
unsigned num_states,
|
||||
void **states)
|
||||
{
|
||||
struct trace_context *tr_ctx = trace_context(_pipe);
|
||||
struct pipe_context *pipe = tr_ctx->pipe;
|
||||
|
||||
trace_dump_call_begin("pipe_context", "bind_fragment_sampler_states");
|
||||
switch (shader) {
|
||||
case PIPE_SHADER_VERTEX:
|
||||
trace_dump_call_begin("pipe_context", "bind_vertex_sampler_states");
|
||||
break;
|
||||
case PIPE_SHADER_GEOMETRY:
|
||||
trace_dump_call_begin("pipe_context", "bind_geometry_sampler_states");
|
||||
break;
|
||||
case PIPE_SHADER_FRAGMENT:
|
||||
trace_dump_call_begin("pipe_context", "bind_fragment_sampler_states");
|
||||
break;
|
||||
default:
|
||||
debug_error("Unexpected shader in trace_context_bind_sampler_states()");
|
||||
}
|
||||
|
||||
trace_dump_arg(ptr, pipe);
|
||||
trace_dump_arg(uint, num_states);
|
||||
trace_dump_arg_array(ptr, states, num_states);
|
||||
|
||||
pipe->bind_fragment_sampler_states(pipe, num_states, states);
|
||||
switch (shader) {
|
||||
case PIPE_SHADER_VERTEX:
|
||||
pipe->bind_vertex_sampler_states(pipe, num_states, states);
|
||||
break;
|
||||
case PIPE_SHADER_GEOMETRY:
|
||||
pipe->bind_geometry_sampler_states(pipe, num_states, states);
|
||||
break;
|
||||
case PIPE_SHADER_FRAGMENT:
|
||||
pipe->bind_fragment_sampler_states(pipe, num_states, states);
|
||||
break;
|
||||
default:
|
||||
debug_error("Unexpected shader in trace_context_bind_sampler_states()");
|
||||
}
|
||||
|
||||
trace_dump_call_end();
|
||||
}
|
||||
|
||||
|
||||
static INLINE void
|
||||
trace_context_bind_fragment_sampler_states(struct pipe_context *_pipe,
|
||||
unsigned num,
|
||||
void **states)
|
||||
{
|
||||
trace_context_bind_sampler_states(_pipe, PIPE_SHADER_FRAGMENT, num, states);
|
||||
}
|
||||
|
||||
|
||||
static INLINE void
|
||||
trace_context_bind_vertex_sampler_states(struct pipe_context *_pipe,
|
||||
unsigned num_states,
|
||||
unsigned num,
|
||||
void **states)
|
||||
{
|
||||
struct trace_context *tr_ctx = trace_context(_pipe);
|
||||
struct pipe_context *pipe = tr_ctx->pipe;
|
||||
|
||||
if (!pipe->bind_vertex_sampler_states)
|
||||
return;
|
||||
|
||||
trace_dump_call_begin("pipe_context", "bind_vertex_sampler_states");
|
||||
|
||||
trace_dump_arg(ptr, pipe);
|
||||
trace_dump_arg(uint, num_states);
|
||||
trace_dump_arg_array(ptr, states, num_states);
|
||||
|
||||
pipe->bind_vertex_sampler_states(pipe, num_states, states);
|
||||
|
||||
trace_dump_call_end();
|
||||
trace_context_bind_sampler_states(_pipe, PIPE_SHADER_VERTEX, num, states);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -962,9 +982,10 @@ trace_context_surface_destroy(struct pipe_context *_pipe,
|
|||
|
||||
|
||||
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(struct pipe_context *_pipe,
|
||||
unsigned shader,
|
||||
unsigned num,
|
||||
struct pipe_sampler_view **views)
|
||||
{
|
||||
struct trace_context *tr_ctx = trace_context(_pipe);
|
||||
struct trace_sampler_view *tr_view;
|
||||
|
|
@ -978,47 +999,58 @@ trace_context_set_fragment_sampler_views(struct pipe_context *_pipe,
|
|||
}
|
||||
views = unwrapped_views;
|
||||
|
||||
trace_dump_call_begin("pipe_context", "set_fragment_sampler_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_arg(ptr, pipe);
|
||||
/*trace_dump_arg(uint, shader);*/
|
||||
trace_dump_arg(uint, num);
|
||||
trace_dump_arg_array(ptr, views, num);
|
||||
|
||||
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 trace_context_set_sampler_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, num, views);
|
||||
}
|
||||
|
||||
|
||||
static INLINE void
|
||||
trace_context_set_vertex_sampler_views(struct pipe_context *_pipe,
|
||||
unsigned num,
|
||||
struct pipe_sampler_view **views)
|
||||
{
|
||||
struct trace_context *tr_ctx = trace_context(_pipe);
|
||||
struct trace_sampler_view *tr_view;
|
||||
struct pipe_context *pipe = tr_ctx->pipe;
|
||||
struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS];
|
||||
unsigned i;
|
||||
|
||||
if (!pipe->set_vertex_sampler_views)
|
||||
return;
|
||||
|
||||
for(i = 0; i < num; ++i) {
|
||||
tr_view = trace_sampler_view(views[i]);
|
||||
unwrapped_views[i] = tr_view ? tr_view->sampler_view : NULL;
|
||||
}
|
||||
views = unwrapped_views;
|
||||
|
||||
trace_dump_call_begin("pipe_context", "set_vertex_sampler_views");
|
||||
|
||||
trace_dump_arg(ptr, pipe);
|
||||
trace_dump_arg(uint, num);
|
||||
trace_dump_arg_array(ptr, views, num);
|
||||
|
||||
pipe->set_vertex_sampler_views(pipe, num, views);
|
||||
|
||||
trace_dump_call_end();
|
||||
trace_context_set_sampler_views(_pipe, PIPE_SHADER_VERTEX, num, views);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue