(rb_pipe->draw_blocker & RBUG_BLOCK_RULE)) {
int k;
boolean block = FALSE;
+ unsigned sh;
+
debug_printf("%s (%p %p) (%p %p) (%p %u) (%p %u)\n", __FUNCTION__,
- (void *) rb_pipe->draw_rule.fs, (void *) rb_pipe->curr.fs,
- (void *) rb_pipe->draw_rule.vs, (void *) rb_pipe->curr.vs,
+ (void *) rb_pipe->draw_rule.shader[PIPE_SHADER_FRAGMENT],
+ (void *) rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT],
+ (void *) rb_pipe->draw_rule.shader[PIPE_SHADER_VERTEX],
+ (void *) rb_pipe->curr.shader[PIPE_SHADER_VERTEX],
(void *) rb_pipe->draw_rule.surf, 0,
(void *) rb_pipe->draw_rule.texture, 0);
- if (rb_pipe->draw_rule.fs &&
- rb_pipe->draw_rule.fs == rb_pipe->curr.fs)
- block = TRUE;
- if (rb_pipe->draw_rule.vs &&
- rb_pipe->draw_rule.vs == rb_pipe->curr.vs)
- block = TRUE;
+ for (sh = 0; sh < PIPE_SHADER_TYPES; sh++) {
+ if (rb_pipe->draw_rule.shader[sh] &&
+ rb_pipe->draw_rule.shader[sh] == rb_pipe->curr.shader[sh])
+ block = TRUE;
+ }
+
if (rb_pipe->draw_rule.surf &&
rb_pipe->draw_rule.surf == rb_pipe->curr.zsbuf)
block = TRUE;
if (rb_pipe->draw_rule.surf == rb_pipe->curr.cbufs[k])
block = TRUE;
if (rb_pipe->draw_rule.texture) {
- for (k = 0; k < rb_pipe->curr.num_fs_views; k++)
- if (rb_pipe->draw_rule.texture == rb_pipe->curr.fs_texs[k])
- block = TRUE;
- for (k = 0; k < rb_pipe->curr.num_vs_views; k++) {
- if (rb_pipe->draw_rule.texture == rb_pipe->curr.vs_texs[k]) {
- block = TRUE;
+ for (sh = 0; sh < Elements(rb_pipe->curr.num_views); sh++) {
+ for (k = 0; k < rb_pipe->curr.num_views[sh]; k++) {
+ if (rb_pipe->draw_rule.texture == rb_pipe->curr.texs[sh][k]) {
+ block = TRUE;
+ sh = PIPE_SHADER_TYPES; /* to break out of both loops */
+ break;
+ }
}
}
}
rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_BEFORE);
pipe_mutex_lock(rb_pipe->call_mutex);
- if (!(rb_pipe->curr.fs && rb_pipe->curr.fs->disabled) &&
- !(rb_pipe->curr.gs && rb_pipe->curr.gs->disabled) &&
- !(rb_pipe->curr.vs && rb_pipe->curr.vs->disabled))
+ /* XXX loop over PIPE_SHADER_x here */
+ if (!(rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT] && rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT]->disabled) &&
+ !(rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY] && rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY]->disabled) &&
+ !(rb_pipe->curr.shader[PIPE_SHADER_VERTEX] && rb_pipe->curr.shader[PIPE_SHADER_VERTEX]->disabled))
pipe->draw_vbo(pipe, info);
pipe_mutex_unlock(rb_pipe->call_mutex);
pipe_mutex_lock(rb_pipe->call_mutex);
fs = rbug_shader_unwrap(_fs);
- rb_pipe->curr.fs = rbug_shader(_fs);
+ rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT] = rbug_shader(_fs);
pipe->bind_fs_state(pipe,
fs);
pipe_mutex_lock(rb_pipe->call_mutex);
vs = rbug_shader_unwrap(_vs);
- rb_pipe->curr.vs = rbug_shader(_vs);
+ rb_pipe->curr.shader[PIPE_SHADER_VERTEX] = rbug_shader(_vs);
pipe->bind_vs_state(pipe,
vs);
pipe_mutex_lock(rb_pipe->call_mutex);
gs = rbug_shader_unwrap(_gs);
- rb_pipe->curr.gs = rbug_shader(_gs);
+ rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY] = rbug_shader(_gs);
pipe->bind_gs_state(pipe,
gs);
}
static void
-rbug_set_fragment_sampler_views(struct pipe_context *_pipe,
- unsigned num,
- struct pipe_sampler_view **_views)
+rbug_set_sampler_views(struct pipe_context *_pipe,
+ unsigned shader,
+ unsigned start,
+ unsigned num,
+ struct pipe_sampler_view **_views)
{
struct rbug_context *rb_pipe = rbug_context(_pipe);
struct pipe_context *pipe = rb_pipe->pipe;
struct pipe_sampler_view **views = NULL;
unsigned i;
+ assert(start == 0); /* XXX fix */
+
/* must protect curr status */
pipe_mutex_lock(rb_pipe->call_mutex);
- rb_pipe->curr.num_fs_views = 0;
- memset(rb_pipe->curr.fs_views, 0, sizeof(rb_pipe->curr.fs_views));
- memset(rb_pipe->curr.fs_texs, 0, sizeof(rb_pipe->curr.fs_texs));
+ rb_pipe->curr.num_views[shader] = 0;
+ memset(rb_pipe->curr.views[shader], 0, sizeof(rb_pipe->curr.views[shader]));
+ memset(rb_pipe->curr.texs[shader], 0, sizeof(rb_pipe->curr.texs[shader]));
memset(unwrapped_views, 0, sizeof(unwrapped_views));
if (_views) {
- rb_pipe->curr.num_fs_views = num;
+ rb_pipe->curr.num_views[shader] = num;
for (i = 0; i < num; i++) {
- rb_pipe->curr.fs_views[i] = rbug_sampler_view(_views[i]);
- rb_pipe->curr.fs_texs[i] = rbug_resource(_views[i] ? _views[i]->texture : NULL);
+ rb_pipe->curr.views[shader][i] = rbug_sampler_view(_views[i]);
+ rb_pipe->curr.texs[shader][i] = rbug_resource(_views[i] ? _views[i]->texture : NULL);
unwrapped_views[i] = rbug_sampler_view_unwrap(_views[i]);
}
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_FRAGMENT:
+ pipe->set_fragment_sampler_views(pipe, num, views);
+ break;
+ default:
+ assert(0);
+ }
pipe_mutex_unlock(rb_pipe->call_mutex);
}
unsigned num,
struct pipe_sampler_view **_views)
{
- struct rbug_context *rb_pipe = rbug_context(_pipe);
- struct pipe_context *pipe = rb_pipe->pipe;
- struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS];
- struct pipe_sampler_view **views = NULL;
- unsigned i;
-
- /* must protect curr status */
- pipe_mutex_lock(rb_pipe->call_mutex);
-
- rb_pipe->curr.num_vs_views = 0;
- memset(rb_pipe->curr.vs_views, 0, sizeof(rb_pipe->curr.vs_views));
- memset(rb_pipe->curr.vs_texs, 0, sizeof(rb_pipe->curr.vs_texs));
- memset(unwrapped_views, 0, sizeof(unwrapped_views));
-
- if (_views) {
- rb_pipe->curr.num_vs_views = num;
- for (i = 0; i < num; i++) {
- rb_pipe->curr.vs_views[i] = rbug_sampler_view(_views[i]);
- rb_pipe->curr.vs_texs[i] = rbug_resource(_views[i]->texture);
- unwrapped_views[i] = rbug_sampler_view_unwrap(_views[i]);
- }
- views = unwrapped_views;
- }
-
- pipe->set_vertex_sampler_views(pipe, num, views);
+ rbug_set_sampler_views(_pipe, PIPE_SHADER_VERTEX, 0, num, _views);
+}
- pipe_mutex_unlock(rb_pipe->call_mutex);
+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
for (i = 0; i < rb_context->curr.nr_cbufs; i++)
cbufs[i] = VOID2U64(rb_context->curr.cbufs[i]);
- for (i = 0; i < rb_context->curr.num_fs_views; i++)
- texs[i] = VOID2U64(rb_context->curr.fs_texs[i]);
+ /* XXX what about vertex/geometry shader texture views? */
+ for (i = 0; i < rb_context->curr.num_views[PIPE_SHADER_FRAGMENT]; i++)
+ texs[i] = VOID2U64(rb_context->curr.texs[PIPE_SHADER_FRAGMENT][i]);
rbug_send_context_info_reply(tr_rbug->con, serial,
- VOID2U64(rb_context->curr.vs), VOID2U64(rb_context->curr.fs),
- texs, rb_context->curr.num_fs_views,
+ VOID2U64(rb_context->curr.shader[PIPE_SHADER_VERTEX]), VOID2U64(rb_context->curr.shader[PIPE_SHADER_FRAGMENT]),
+ texs, rb_context->curr.num_views[PIPE_SHADER_FRAGMENT],
cbufs, rb_context->curr.nr_cbufs,
VOID2U64(rb_context->curr.zsbuf),
rb_context->draw_blocker, rb_context->draw_blocked, NULL);
}
pipe_mutex_lock(rb_context->draw_mutex);
- rb_context->draw_rule.vs = U642VOID(rule->vertex);
- rb_context->draw_rule.fs = U642VOID(rule->fragment);
+ rb_context->draw_rule.shader[PIPE_SHADER_VERTEX] = U642VOID(rule->vertex);
+ rb_context->draw_rule.shader[PIPE_SHADER_FRAGMENT] = U642VOID(rule->fragment);
rb_context->draw_rule.texture = U642VOID(rule->texture);
rb_context->draw_rule.surf = U642VOID(rule->surface);
rb_context->draw_rule.blocker = rule->block;
/* remove old replaced shader */
if (tr_shdr->replaced_shader) {
/* if this shader is bound rebind the original shader */
- if (rb_context->curr.fs == tr_shdr || rb_context->curr.vs == tr_shdr)
+ if (rb_context->curr.shader[PIPE_SHADER_FRAGMENT] == tr_shdr || rb_context->curr.shader[PIPE_SHADER_VERTEX] == tr_shdr)
rbug_shader_bind_locked(pipe, tr_shdr, tr_shdr->shader);
FREE(tr_shdr->replaced_tokens);
goto err;
/* bind new shader if the shader is currently a bound */
- if (rb_context->curr.fs == tr_shdr || rb_context->curr.vs == tr_shdr)
+ if (rb_context->curr.shader[PIPE_SHADER_FRAGMENT] == tr_shdr || rb_context->curr.shader[PIPE_SHADER_VERTEX] == tr_shdr)
rbug_shader_bind_locked(pipe, tr_shdr, state);
/* save state */