summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2017-06-27 09:36:19 -0600
committerBrian Paul <[email protected]>2017-06-30 13:37:10 -0600
commit95d5c48f68b598cfa6db25f44aac52b3e11403cc (patch)
tree20c2384847bd0a4ee7b50923fc270b550321d6f7 /src/mesa/state_tracker
parentf4d5e55dd1cb4617ee18387d2aff337676b420c4 (diff)
st/mesa: fix texture image resource selection in st_render_texture()
If we're rendering to an incomplete/inconsistent (cube) texture, the different faces/levels of the texture may be stored in different resources. Before, we always used the texture object resource. Now, we use the texture image resource. In normal circumstances, that's the same resource. But in some cases, such as the Piglit fbo-incomplete-texture-03 test, the cube faces are in different resources and we need to render to the texture image resource. Fixes fbo-incomplete-texture-03 with VMware driver. Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 2559c239ed2..a4d710c5dc4 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -470,6 +470,21 @@ st_update_renderbuffer_surface(struct st_context *st,
strb->surface = *psurf;
}
+
+/**
+ * Return the pipe_resource which stores a particular texture image.
+ */
+static struct pipe_resource *
+get_teximage_resource(struct gl_texture_object *texObj,
+ unsigned face, unsigned level)
+{
+ struct st_texture_image *stImg =
+ st_texture_image(texObj->Image[face][level]);
+
+ return stImg->pt;
+}
+
+
/**
* Called by ctx->Driver.RenderTexture
*/
@@ -487,7 +502,9 @@ st_render_texture(struct gl_context *ctx,
if (!st_finalize_texture(ctx, pipe, att->Texture, att->CubeMapFace))
return;
- pt = st_get_texobj_resource(att->Texture);
+ pt = get_teximage_resource(att->Texture,
+ att->CubeMapFace,
+ att->TextureLevel);
assert(pt);
/* point renderbuffer at texobject */