summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2019-05-13 15:16:23 -0700
committerChia-I Wu <[email protected]>2019-05-22 09:28:19 -0700
commitfa9afb9de0379d47892eca2ec826c1bdb5caacd2 (patch)
tree28d34c68696476bc3d5555cdd71c5bd4917fd7f8 /src/gallium/drivers/virgl
parentcb7c9b2a9352cc73a2d3becc0427c53c8baf153a (diff)
virgl: handle NULL shader resource explicitly
When shader images/buffers are set, do not rely on virgl_encoder_write_res and virgl_resource_dirty to do the implicit NULL check. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Alexandros Frantzis <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl')
-rw-r--r--src/gallium/drivers/virgl/virgl_encode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c
index a0da36cdb89..72fecf43d02 100644
--- a/src/gallium/drivers/virgl/virgl_encode.c
+++ b/src/gallium/drivers/virgl/virgl_encode.c
@@ -963,7 +963,7 @@ int virgl_encode_set_shader_buffers(struct virgl_context *ctx,
virgl_encoder_write_dword(ctx->cbuf, shader);
virgl_encoder_write_dword(ctx->cbuf, start_slot);
for (i = 0; i < count; i++) {
- if (buffers) {
+ if (buffers && buffers[i].buffer) {
struct virgl_resource *res = virgl_resource(buffers[i].buffer);
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_offset);
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_size);
@@ -987,7 +987,7 @@ int virgl_encode_set_hw_atomic_buffers(struct virgl_context *ctx,
virgl_encoder_write_dword(ctx->cbuf, start_slot);
for (i = 0; i < count; i++) {
- if (buffers) {
+ if (buffers && buffers[i].buffer) {
struct virgl_resource *res = virgl_resource(buffers[i].buffer);
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_offset);
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_size);
@@ -1013,7 +1013,7 @@ int virgl_encode_set_shader_images(struct virgl_context *ctx,
virgl_encoder_write_dword(ctx->cbuf, shader);
virgl_encoder_write_dword(ctx->cbuf, start_slot);
for (i = 0; i < count; i++) {
- if (images) {
+ if (images && images[i].resource) {
struct virgl_resource *res = virgl_resource(images[i].resource);
virgl_encoder_write_dword(ctx->cbuf, images[i].format);
virgl_encoder_write_dword(ctx->cbuf, images[i].access);