[Mesa-dev] [PATCH] st/mesa: fix crash with default TBO.
Dave Airlie
airlied at gmail.com
Sat Jan 12 22:15:03 PST 2013
From: Dave Airlie <airlied at redhat.com>
(this is my hacky attempt at fixing the problem previously described,
maybe its correct).
The formats test triggers this once it finishes.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/mesa/state_tracker/st_atom_texture.c | 6 ++++--
src/mesa/state_tracker/st_cb_texture.c | 9 +++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index dba1d82..e6b0c9e 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -214,7 +214,9 @@ update_single_texture(struct st_context *st,
}
/* Determine the format of the texture sampler view */
- st_view_format = stObj->pt->format;
+ st_view_format = 0;
+ if (stObj->pt)
+ st_view_format = stObj->pt->format;
{
gl_format texFormat;
@@ -238,7 +240,7 @@ update_single_texture(struct st_context *st,
firstImageFormat = st_mesa_format_to_pipe_format(linearFormat);
}
- if (firstImageFormat != stObj->pt->format)
+ if (firstImageFormat != st_view_format)
st_view_format = firstImageFormat;
}
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index b5c1f1f..eccac68 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1329,6 +1329,15 @@ st_finalize_texture(struct gl_context *ctx,
if (tObj->Target == GL_TEXTURE_BUFFER) {
struct st_buffer_object *st_obj = st_buffer_object(tObj->BufferObject);
+ if (!st_obj) {
+ pipe_resource_reference(&stObj->pt, NULL);
+ pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
+ stObj->width0 = 0;
+ stObj->height0 = 0;
+ stObj->depth0 = 0;
+ return GL_TRUE;
+ }
+
if (st_obj->buffer != stObj->pt) {
pipe_resource_reference(&stObj->pt, st_obj->buffer);
pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
--
1.8.0.2
More information about the mesa-dev
mailing list