Mesa (staging/21.2): i965: Emit a NULL surface for buffer textures with no buffer

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 15 16:06:53 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: 12b464b2b8bf011c9c3ead06926b3688100fd62a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=12b464b2b8bf011c9c3ead06926b3688100fd62a

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Wed Oct 13 16:31:57 2021 -0500

i965: Emit a NULL surface for buffer textures with no buffer

This is a preexisting bug but it was uncovered by 231653ea3506
("intel/isl: Add a max_buffer_size limit to isl_device") which added an
assert(num_elements > 0) for typed buffers.

Cc: mesa-stable at lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13351>
(cherry picked from commit 393fda2d341f65cba6e160d4704983370ae041f9)

---

 .pick_status.json                                |  2 +-
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 06defcabfdb..19c1a789eaf 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -346,7 +346,7 @@
         "description": "i965: Emit a NULL surface for buffer textures with no buffer",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 5caeda5239a..c750bc71936 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -680,6 +680,11 @@ buffer_texture_range_size(struct brw_context *brw,
                brw->ctx.Const.MaxTextureBufferSize * texel_size);
 }
 
+static void
+emit_null_surface_state(struct brw_context *brw,
+                        const struct gl_framebuffer *fb,
+                        uint32_t *out_offset);
+
 void
 brw_update_buffer_texture_surface(struct gl_context *ctx,
                                   unsigned unit,
@@ -695,6 +700,11 @@ brw_update_buffer_texture_surface(struct gl_context *ctx,
    const enum isl_format isl_format = brw_isl_format_for_mesa_format(format);
    int texel_size = _mesa_get_format_bytes(format);
 
+   if (tObj->BufferObject == NULL) {
+      emit_null_surface_state(brw, NULL, surf_offset);
+      return;
+   }
+
    if (intel_obj)
       bo = brw_bufferobj_buffer(brw, intel_obj, tObj->BufferOffset, size,
                                 false);



More information about the mesa-commit mailing list