for (i = 0; i < hwtnl->cmd.vdecl_count; i++) {
unsigned j = hwtnl->cmd.vdecl_buffer_index[i];
- handle = svga_buffer_handle(svga, hwtnl->cmd.vbufs[j].buffer.resource);
+ handle = svga_buffer_handle(svga, hwtnl->cmd.vbufs[j].buffer.resource,
+ PIPE_BIND_VERTEX_BUFFER);
if (!handle)
return PIPE_ERROR_OUT_OF_MEMORY;
for (i = 0; i < hwtnl->cmd.prim_count; i++) {
if (hwtnl->cmd.prim_ib[i]) {
- handle = svga_buffer_handle(svga, hwtnl->cmd.prim_ib[i]);
+ handle = svga_buffer_handle(svga, hwtnl->cmd.prim_ib[i],
+ PIPE_BIND_INDEX_BUFFER);
if (!handle)
return PIPE_ERROR_OUT_OF_MEMORY;
}
if (sv) {
if (sv->base.texture->target == PIPE_BUFFER) {
- surfaces[i] = svga_buffer_handle(svga, sv->base.texture);
+ surfaces[i] = svga_buffer_handle(svga, sv->base.texture,
+ PIPE_BIND_SAMPLER_VIEW);
}
else {
surfaces[i] = svga_texture(sv->base.texture)->handle;
unsigned i = u_bit_scan(&enabled_constbufs);
buffer = svga_buffer(svga->curr.constbufs[shader][i].buffer);
if (buffer) {
- handle = svga_buffer_handle(svga, &buffer->b.b);
+ handle = svga_buffer_handle(svga, &buffer->b.b,
+ PIPE_BIND_CONSTANT_BUFFER);
if (svga->rebind.flags.constbufs) {
ret = svga->swc->resource_rebind(svga->swc,
if (sbuf) {
assert(sbuf->key.flags & SVGA3D_SURFACE_BIND_VERTEX_BUFFER);
- vbuffer_handles[i] = svga_buffer_handle(svga, &sbuf->b.b);
+ vbuffer_handles[i] = svga_buffer_handle(svga, &sbuf->b.b,
+ PIPE_BIND_VERTEX_BUFFER);
if (vbuffer_handles[i] == NULL)
return PIPE_ERROR_OUT_OF_MEMORY;
vbuffers[i] = &sbuf->b.b;
assert(sbuf->key.flags & SVGA3D_SURFACE_BIND_INDEX_BUFFER);
(void) sbuf; /* silence unused var warning */
- ib_handle = svga_buffer_handle(svga, ib);
+ ib_handle = svga_buffer_handle(svga, ib, PIPE_BIND_INDEX_BUFFER);
if (!ib_handle)
return PIPE_ERROR_OUT_OF_MEMORY;
}
struct svga_winsys_surface *src_surf;
struct svga_winsys_surface *dst_surf;
struct svga_buffer *dbuffer = svga_buffer(dst_tex);
+ struct svga_buffer *sbuffer = svga_buffer(src_tex);
- src_surf = svga_buffer_handle(svga, src_tex);
- dst_surf = svga_buffer_handle(svga, dst_tex);
+ src_surf = svga_buffer_handle(svga, src_tex, sbuffer->bind_flags);
+ dst_surf = svga_buffer_handle(svga, dst_tex, dbuffer->bind_flags);
ret = SVGA3D_vgpu10_BufferCopy(svga->swc, src_surf, dst_surf,
src_box->x, dstx, src_box->width);
assert(sbuf->key.flags & SVGA3D_SURFACE_BIND_STREAM_OUTPUT);
(void) sbuf;
- svga->so_surfaces[i] = svga_buffer_handle(svga, sot->base.buffer);
+ svga->so_surfaces[i] = svga_buffer_handle(svga, sot->base.buffer,
+ PIPE_BIND_STREAM_OUTPUT);
svga->so_targets[i] = &sot->base;
soBindings[i].offset = sot->base.buffer_offset;
assert(svga_have_vgpu10(svga));
if (!sbuf->user) {
- (void) svga_buffer_handle(svga, resource);
+ (void) svga_buffer_handle(svga, resource, sbuf->bind_flags);
}
if (sbuf->dma.pending > 0) {
*/
struct svga_winsys_surface *
svga_buffer_handle(struct svga_context *svga,
- struct pipe_resource *buf);
+ struct pipe_resource *buf,
+ unsigned tobind_flags);
void
svga_context_flush_buffers(struct svga_context *svga);
* if there are mapped ranges and the data is currently in a malloc'ed buffer.
*/
struct svga_winsys_surface *
-svga_buffer_handle(struct svga_context *svga, struct pipe_resource *buf)
+svga_buffer_handle(struct svga_context *svga, struct pipe_resource *buf,
+ unsigned tobind_flags)
{
struct pipe_screen *screen = svga->pipe.screen;
struct svga_screen *ss = svga_screen(screen);
/* unmap the texture upload buffer */
u_upload_unmap(svga->tex_upload);
- srcsurf = svga_buffer_handle(svga, st->upload.buf);
+ srcsurf = svga_buffer_handle(svga, st->upload.buf, 0);
dstsurf = svga_texture(texture)->handle;
assert(dstsurf);
/* we must unmap the buffer before getting the winsys handle */
u_upload_unmap(svga->const0_upload);
- dst_handle = svga_buffer_handle(svga, dst_buffer);
+ dst_handle = svga_buffer_handle(svga, dst_buffer,
+ PIPE_BIND_CONSTANT_BUFFER);
if (!dst_handle) {
pipe_resource_reference(&dst_buffer, NULL);
return PIPE_ERROR_OUT_OF_MEMORY;
struct svga_winsys_surface *handle;
if (buffer) {
- handle = svga_buffer_handle(svga, &buffer->b.b);
+ handle = svga_buffer_handle(svga, &buffer->b.b,
+ PIPE_BIND_CONSTANT_BUFFER);
enabled_constbufs |= 1 << index;
}
else {