summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorAlejandro Piñeiro <apinheiro@igalia.com>2021-08-26 02:01:28 +0200
committerMarge Bot <emma+marge@anholt.net>2021-12-03 15:32:36 +0000
commitbb8285c25859b35d06ccd283d7fdf1bab07dc059 (patch)
treecda7d61550a2235071773ec77bee7181c4b716b1 /src/gallium
parent60a1968fa19a6f936bda2a34e80e3164676ffaaa (diff)
v3d: add support for no buffer object bound
From the GL_OES_texture_buffer spec: "If no buffer object is bound to the buffer texture, the results of the texel access are undefined." this can be interpreted as allowing any result to come back, but not terminate the program. The current solution is not entirely complete, as it could still try to get a wrong address for the shader state address. This can be checked with piglit test arb_texture_buffer_object-render-no-bo; the test is skip because it requires OpenGL 3.1, but if overriding the version then it will crash. Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/v3d/v3d_uniforms.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gallium/drivers/v3d/v3d_uniforms.c b/src/gallium/drivers/v3d/v3d_uniforms.c
index 4bcf92cd149..d316195dd53 100644
--- a/src/gallium/drivers/v3d/v3d_uniforms.c
+++ b/src/gallium/drivers/v3d/v3d_uniforms.c
@@ -172,6 +172,20 @@ write_tmu_p0(struct v3d_job *job,
int unit = v3d_unit_data_get_unit(data);
struct pipe_sampler_view *psview = texstate->textures[unit];
struct v3d_sampler_view *sview = v3d_sampler_view(psview);
+ /* GL_OES_texture_buffer spec:
+ * "If no buffer object is bound to the buffer texture, the
+ * results of the texel access are undefined."
+ *
+ * This can be interpreted as allowing any result to come back, but
+ * not terminate the program (and some tests interpret that).
+ *
+ * FIXME: just return is not a full valid solution, as it could still
+ * try to get a wrong address for the shader state address. Perhaps we
+ * would need to set up a BO with a "default texture state"
+ */
+ if (sview == NULL)
+ return;
+
struct v3d_resource *rsc = v3d_resource(sview->texture);
cl_aligned_reloc(&job->indirect, uniforms, sview->bo,