summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c52
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h5
-rw-r--r--src/gallium/auxiliary/hud/hud_context.c14
-rw-r--r--src/gallium/auxiliary/util/u_blit.c5
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c22
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.h7
6 files changed, 38 insertions, 67 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 3a3a63a3327..e3d46f3c8de 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -87,9 +87,8 @@ struct cso_context {
*/
int max_sampler_seen;
- struct pipe_vertex_buffer aux_vertex_buffer_current;
- struct pipe_vertex_buffer aux_vertex_buffer_saved;
- unsigned aux_vertex_buffer_index;
+ struct pipe_vertex_buffer vertex_buffer0_current;
+ struct pipe_vertex_buffer vertex_buffer0_saved;
struct pipe_constant_buffer aux_constbuf_current[PIPE_SHADER_TYPES];
struct pipe_constant_buffer aux_constbuf_saved[PIPE_SHADER_TYPES];
@@ -291,8 +290,7 @@ static void cso_init_vbuf(struct cso_context *cso, unsigned flags)
/* Install u_vbuf if there is anything unsupported. */
if (u_vbuf_get_caps(cso->pipe->screen, &caps, flags)) {
- cso->vbuf = u_vbuf_create(cso->pipe, &caps,
- cso->aux_vertex_buffer_index);
+ cso->vbuf = u_vbuf_create(cso->pipe, &caps);
}
}
@@ -313,8 +311,6 @@ cso_create_context(struct pipe_context *pipe, unsigned u_vbuf_flags)
ctx->pipe = pipe;
ctx->sample_mask = ~0;
- ctx->aux_vertex_buffer_index = 0; /* 0 for now */
-
cso_init_vbuf(ctx, u_vbuf_flags);
/* Enable for testing: */
@@ -417,8 +413,8 @@ void cso_destroy_context( struct cso_context *ctx )
util_unreference_framebuffer_state(&ctx->fb);
util_unreference_framebuffer_state(&ctx->fb_saved);
- pipe_vertex_buffer_unreference(&ctx->aux_vertex_buffer_current);
- pipe_vertex_buffer_unreference(&ctx->aux_vertex_buffer_saved);
+ pipe_vertex_buffer_unreference(&ctx->vertex_buffer0_current);
+ pipe_vertex_buffer_unreference(&ctx->vertex_buffer0_saved);
for (i = 0; i < PIPE_SHADER_TYPES; i++) {
pipe_resource_reference(&ctx->aux_constbuf_current[i].buffer, NULL);
@@ -1158,15 +1154,12 @@ void cso_set_vertex_buffers(struct cso_context *ctx,
/* Save what's in the auxiliary slot, so that we can save and restore it
* for meta ops. */
- if (start_slot <= ctx->aux_vertex_buffer_index &&
- start_slot+count > ctx->aux_vertex_buffer_index) {
+ if (start_slot == 0) {
if (buffers) {
- const struct pipe_vertex_buffer *vb =
- buffers + (ctx->aux_vertex_buffer_index - start_slot);
-
- pipe_vertex_buffer_reference(&ctx->aux_vertex_buffer_current, vb);
+ pipe_vertex_buffer_reference(&ctx->vertex_buffer0_current,
+ buffers);
} else {
- pipe_vertex_buffer_unreference(&ctx->aux_vertex_buffer_current);
+ pipe_vertex_buffer_unreference(&ctx->vertex_buffer0_current);
}
}
@@ -1174,41 +1167,34 @@ void cso_set_vertex_buffers(struct cso_context *ctx,
}
static void
-cso_save_aux_vertex_buffer_slot(struct cso_context *ctx)
+cso_save_vertex_buffer0(struct cso_context *ctx)
{
struct u_vbuf *vbuf = ctx->vbuf;
if (vbuf) {
- u_vbuf_save_aux_vertex_buffer_slot(vbuf);
+ u_vbuf_save_vertex_buffer0(vbuf);
return;
}
- pipe_vertex_buffer_reference(&ctx->aux_vertex_buffer_saved,
- &ctx->aux_vertex_buffer_current);
+ pipe_vertex_buffer_reference(&ctx->vertex_buffer0_saved,
+ &ctx->vertex_buffer0_current);
}
static void
-cso_restore_aux_vertex_buffer_slot(struct cso_context *ctx)
+cso_restore_vertex_buffer0(struct cso_context *ctx)
{
struct u_vbuf *vbuf = ctx->vbuf;
if (vbuf) {
- u_vbuf_restore_aux_vertex_buffer_slot(vbuf);
+ u_vbuf_restore_vertex_buffer0(vbuf);
return;
}
- cso_set_vertex_buffers(ctx, ctx->aux_vertex_buffer_index, 1,
- &ctx->aux_vertex_buffer_saved);
- pipe_vertex_buffer_unreference(&ctx->aux_vertex_buffer_saved);
-}
-
-unsigned cso_get_aux_vertex_buffer_slot(struct cso_context *ctx)
-{
- return ctx->aux_vertex_buffer_index;
+ cso_set_vertex_buffers(ctx, 0, 1, &ctx->vertex_buffer0_saved);
+ pipe_vertex_buffer_unreference(&ctx->vertex_buffer0_saved);
}
-
void
cso_single_sampler(struct cso_context *ctx, enum pipe_shader_type shader_stage,
unsigned idx, const struct pipe_sampler_state *templ)
@@ -1595,7 +1581,7 @@ cso_save_state(struct cso_context *cso, unsigned state_mask)
cso->saved_state = state_mask;
if (state_mask & CSO_BIT_AUX_VERTEX_BUFFER_SLOT)
- cso_save_aux_vertex_buffer_slot(cso);
+ cso_save_vertex_buffer0(cso);
if (state_mask & CSO_BIT_BLEND)
cso_save_blend(cso);
if (state_mask & CSO_BIT_DEPTH_STENCIL_ALPHA)
@@ -1650,7 +1636,7 @@ cso_restore_state(struct cso_context *cso)
assert(state_mask);
if (state_mask & CSO_BIT_AUX_VERTEX_BUFFER_SLOT)
- cso_restore_aux_vertex_buffer_slot(cso);
+ cso_restore_vertex_buffer0(cso);
if (state_mask & CSO_BIT_BLEND)
cso_restore_blend(cso);
if (state_mask & CSO_BIT_DEPTH_STENCIL_ALPHA)
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
index 3a4e808f0c0..d3501fb92e9 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -87,11 +87,6 @@ void cso_set_vertex_buffers(struct cso_context *ctx,
unsigned start_slot, unsigned count,
const struct pipe_vertex_buffer *buffers);
-/* One vertex buffer slot is provided with the save/restore functionality.
- * cso_context chooses the slot, it can be non-zero. */
-unsigned cso_get_aux_vertex_buffer_slot(struct cso_context *ctx);
-
-
void cso_set_stream_outputs(struct cso_context *ctx,
unsigned num_targets,
struct pipe_stream_output_target **targets,
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 1baaabbb38e..6ed9ccffdbc 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -90,8 +90,7 @@ hud_draw_colored_prims(struct hud_context *hud, unsigned prim,
hud->constants.scale[1] = yscale;
cso_set_constant_buffer(cso, PIPE_SHADER_VERTEX, 0, &hud->constbuf);
- cso_set_vertex_buffers(cso, cso_get_aux_vertex_buffer_slot(cso),
- 1, &hud->color_prims.vbuf);
+ cso_set_vertex_buffers(cso, 0, 1, &hud->color_prims.vbuf);
cso_set_fragment_shader_handle(hud->cso, hud->fs_color);
cso_draw_arrays(cso, prim, 0, num_vertices);
@@ -561,16 +560,14 @@ hud_draw_results(struct hud_context *hud, struct pipe_resource *tex)
hud->constants.scale[1] = 1;
cso_set_constant_buffer(cso, PIPE_SHADER_VERTEX, 0, &hud->constbuf);
- cso_set_vertex_buffers(cso, cso_get_aux_vertex_buffer_slot(cso), 1,
- &hud->bg.vbuf);
+ cso_set_vertex_buffers(cso, 0, 1, &hud->bg.vbuf);
cso_draw_arrays(cso, PIPE_PRIM_QUADS, 0, hud->bg.num_vertices);
}
pipe_resource_reference(&hud->bg.vbuf.buffer.resource, NULL);
/* draw accumulated vertices for text */
if (hud->text.num_vertices) {
- cso_set_vertex_buffers(cso, cso_get_aux_vertex_buffer_slot(cso), 1,
- &hud->text.vbuf);
+ cso_set_vertex_buffers(cso, 0, 1, &hud->text.vbuf);
cso_set_fragment_shader_handle(hud->cso, hud->fs_text);
cso_draw_arrays(cso, PIPE_PRIM_QUADS, 0, hud->text.num_vertices);
}
@@ -598,8 +595,7 @@ hud_draw_results(struct hud_context *hud, struct pipe_resource *tex)
cso_set_constant_buffer(cso, PIPE_SHADER_VERTEX, 0, &hud->constbuf);
if (hud->whitelines.num_vertices) {
- cso_set_vertex_buffers(cso, cso_get_aux_vertex_buffer_slot(cso), 1,
- &hud->whitelines.vbuf);
+ cso_set_vertex_buffers(cso, 0, 1, &hud->whitelines.vbuf);
cso_set_fragment_shader_handle(hud->cso, hud->fs_color);
cso_draw_arrays(cso, PIPE_PRIM_LINES, 0, hud->whitelines.num_vertices);
}
@@ -1868,7 +1864,7 @@ hud_create(struct cso_context *cso, struct hud_context *share)
for (i = 0; i < 2; i++) {
hud->velems[i].src_offset = i * 2 * sizeof(float);
hud->velems[i].src_format = PIPE_FORMAT_R32G32_FLOAT;
- hud->velems[i].vertex_buffer_index = cso_get_aux_vertex_buffer_slot(cso);
+ hud->velems[i].vertex_buffer_index = 0;
}
/* sampler state (for font drawing) */
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index d1571cd1f56..9a43c2f6556 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -112,7 +112,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
for (i = 0; i < 2; i++) {
ctx->velem[i].src_offset = i * 4 * sizeof(float);
ctx->velem[i].instance_divisor = 0;
- ctx->velem[i].vertex_buffer_index = cso_get_aux_vertex_buffer_slot(cso);
+ ctx->velem[i].vertex_buffer_index = 0;
ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
}
@@ -631,8 +631,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
s0, t0, s1, t1,
z);
- util_draw_vertex_buffer(ctx->pipe, ctx->cso, ctx->vbuf,
- cso_get_aux_vertex_buffer_slot(ctx->cso),
+ util_draw_vertex_buffer(ctx->pipe, ctx->cso, ctx->vbuf, 0,
offset,
PIPE_PRIM_TRIANGLE_FAN,
4, /* verts */
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index 8a680d60a68..42f37c75742 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -154,8 +154,7 @@ struct u_vbuf {
uint32_t enabled_vb_mask;
/* Saved vertex buffer. */
- unsigned aux_vertex_buffer_slot;
- struct pipe_vertex_buffer aux_vertex_buffer_saved;
+ struct pipe_vertex_buffer vertex_buffer0_saved;
/* Vertex buffers for the driver.
* There are usually no user buffers. */
@@ -300,13 +299,11 @@ boolean u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps,
}
struct u_vbuf *
-u_vbuf_create(struct pipe_context *pipe,
- struct u_vbuf_caps *caps, unsigned aux_vertex_buffer_index)
+u_vbuf_create(struct pipe_context *pipe, struct u_vbuf_caps *caps)
{
struct u_vbuf *mgr = CALLOC_STRUCT(u_vbuf);
mgr->caps = *caps;
- mgr->aux_vertex_buffer_slot = aux_vertex_buffer_index;
mgr->pipe = pipe;
mgr->cso_cache = cso_cache_create();
mgr->translate_cache = translate_cache_create();
@@ -381,7 +378,7 @@ void u_vbuf_destroy(struct u_vbuf *mgr)
for (i = 0; i < PIPE_MAX_ATTRIBS; i++)
pipe_vertex_buffer_unreference(&mgr->real_vertex_buffer[i]);
- pipe_vertex_buffer_unreference(&mgr->aux_vertex_buffer_saved);
+ pipe_vertex_buffer_unreference(&mgr->vertex_buffer0_saved);
translate_cache_destroy(mgr->translate_cache);
cso_cache_delete(mgr->cso_cache);
@@ -1313,15 +1310,14 @@ void u_vbuf_restore_vertex_elements(struct u_vbuf *mgr)
mgr->ve_saved = NULL;
}
-void u_vbuf_save_aux_vertex_buffer_slot(struct u_vbuf *mgr)
+void u_vbuf_save_vertex_buffer0(struct u_vbuf *mgr)
{
- pipe_vertex_buffer_reference(&mgr->aux_vertex_buffer_saved,
- &mgr->vertex_buffer[mgr->aux_vertex_buffer_slot]);
+ pipe_vertex_buffer_reference(&mgr->vertex_buffer0_saved,
+ &mgr->vertex_buffer[0]);
}
-void u_vbuf_restore_aux_vertex_buffer_slot(struct u_vbuf *mgr)
+void u_vbuf_restore_vertex_buffer0(struct u_vbuf *mgr)
{
- u_vbuf_set_vertex_buffers(mgr, mgr->aux_vertex_buffer_slot, 1,
- &mgr->aux_vertex_buffer_saved);
- pipe_vertex_buffer_unreference(&mgr->aux_vertex_buffer_saved);
+ u_vbuf_set_vertex_buffers(mgr, 0, 1, &mgr->vertex_buffer0_saved);
+ pipe_vertex_buffer_unreference(&mgr->vertex_buffer0_saved);
}
diff --git a/src/gallium/auxiliary/util/u_vbuf.h b/src/gallium/auxiliary/util/u_vbuf.h
index d0704524561..a6139834575 100644
--- a/src/gallium/auxiliary/util/u_vbuf.h
+++ b/src/gallium/auxiliary/util/u_vbuf.h
@@ -61,8 +61,7 @@ boolean u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps,
unsigned flags);
struct u_vbuf *
-u_vbuf_create(struct pipe_context *pipe,
- struct u_vbuf_caps *caps, unsigned aux_vertex_buffer_index);
+u_vbuf_create(struct pipe_context *pipe, struct u_vbuf_caps *caps);
void u_vbuf_destroy(struct u_vbuf *mgr);
@@ -77,7 +76,7 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info);
/* Save/restore functionality. */
void u_vbuf_save_vertex_elements(struct u_vbuf *mgr);
void u_vbuf_restore_vertex_elements(struct u_vbuf *mgr);
-void u_vbuf_save_aux_vertex_buffer_slot(struct u_vbuf *mgr);
-void u_vbuf_restore_aux_vertex_buffer_slot(struct u_vbuf *mgr);
+void u_vbuf_save_vertex_buffer0(struct u_vbuf *mgr);
+void u_vbuf_restore_vertex_buffer0(struct u_vbuf *mgr);
#endif