summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Faye-Lund <erik.faye-lund@collabora.com>2021-05-04 13:04:48 +0200
committerMarge Bot <eric+marge@anholt.net>2021-05-05 11:16:42 +0000
commita2d091694f8cf30f7f8a15d9c26712d4e56eaa6c (patch)
treea66a86a1c2bc73f08debe2127280a3a8fc9346e3
parentc05e48308b432f93785520f48fbddc813040b11d (diff)
gallium/u_vbuf: avoid dereferencing NULL pointer
When I last time fixed this, I missed that continuing here would make us leak pointers in the translate state, which is what made this avoid a crash in the first place. That's not great, we need to set *some* pointer in this case. The obvious option would be NULL, but that means that the translate-code also needs to support NULL-pointers here. Instead, let's point to a small, static buffer that contains enough zero-data for the largest possible vertex attribute. This avoids having to add more NULL-checks. Fixes: a8e8204b186 ("gallium/u_vbuf: support NULL-resources") Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7773>
-rw-r--r--.gitlab-ci/windows/quick_gl.txt5
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c5
-rw-r--r--src/gallium/drivers/zink/ci/piglit-zink-lvp-fails.txt1
3 files changed, 6 insertions, 5 deletions
diff --git a/.gitlab-ci/windows/quick_gl.txt b/.gitlab-ci/windows/quick_gl.txt
index 816ae879d61..89a582ead2c 100644
--- a/.gitlab-ci/windows/quick_gl.txt
+++ b/.gitlab-ci/windows/quick_gl.txt
@@ -149,7 +149,6 @@ spec/!opengl 1.1/polygon-mode-offset/config 4: expected white pixel on left edge
spec/!opengl 1.1/polygon-mode-offset/config 4: expected white pixel on right edge: fail
spec/!opengl 1.1/polygon-mode-offset/config 4: expected white pixel on top edge: fail
spec/!opengl 1.1/polygon-offset: fail
-spec/!opengl 1.1/ppgtt_memory_alignment: fail
spec/!opengl 1.1/read-front clear-front-first samples=16: skip
spec/!opengl 1.1/read-front clear-front-first samples=2: skip
spec/!opengl 1.1/read-front clear-front-first samples=32: skip
@@ -4754,8 +4753,8 @@ wgl/wgl-sanity: skip
summary:
name: results
---- --------
- pass: 13298
- fail: 539
+ pass: 13299
+ fail: 538
crash: 68
skip: 4126
timeout: 0
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index 69c22e39258..4d826abdfa9 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -437,8 +437,11 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
unsigned size = vb->stride ? num_vertices * vb->stride
: sizeof(double)*4;
- if (!vb->buffer.resource)
+ if (!vb->buffer.resource) {
+ static uint64_t dummy_buf[4] = { 0 };
+ tr->set_buffer(tr, i, dummy_buf, 0, 0);
continue;
+ }
if (offset + size > vb->buffer.resource->width0) {
/* Don't try to map past end of buffer. This often happens when
diff --git a/src/gallium/drivers/zink/ci/piglit-zink-lvp-fails.txt b/src/gallium/drivers/zink/ci/piglit-zink-lvp-fails.txt
index 6f7641948b7..876faca1a3a 100644
--- a/src/gallium/drivers/zink/ci/piglit-zink-lvp-fails.txt
+++ b/src/gallium/drivers/zink/ci/piglit-zink-lvp-fails.txt
@@ -42,7 +42,6 @@ spec@!opengl 1.1@polygon-mode,Fail
spec@!opengl 1.1@polygon-mode-facing,Fail
spec@!opengl 1.1@polygon-mode-offset,Fail
spec@!opengl 1.1@polygon-offset,Fail
-spec@!opengl 1.1@ppgtt_memory_alignment,Crash
spec@!opengl 1.1@read-front,Fail
spec@!opengl 1.1@read-front clear-front-first,Fail
spec@!opengl 1.1@read-front clear-front-first samples=2,Fail