Re: [Mesa-dev] [PATCH 2/2] st/mesa: fix texture image resource selection in st_render_texture()
On 07/01/2017 04:56 AM, Nicolai Hähnle wrote: On 29.06.2017 00:12, Brian Paul wrote: 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. --- src/mesa/state_tracker/st_cb_fbo.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 2559c23..a4d710c 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); When st_AllocTextureImageBuffer allocates a pipe resource for a "loose" image, it allocates a single level, even if the image is not a mip level 0. So I wonder if we need to adjust the level selection in the pipe_surface somehow. Is this covered by the incomplete texture tests? I think we're good. In st_update_renderbuffer_surface() we actually search the resources's mipmap levels to find the one that matches the expected surface size. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] st/mesa: fix texture image resource selection in st_render_texture()
On 29.06.2017 00:12, Brian Paul wrote: 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. --- src/mesa/state_tracker/st_cb_fbo.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 2559c23..a4d710c 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); When st_AllocTextureImageBuffer allocates a pipe resource for a "loose" image, it allocates a single level, even if the image is not a mip level 0. So I wonder if we need to adjust the level selection in the pipe_surface somehow. Is this covered by the incomplete texture tests? Cheers, Nicolai assert(pt); /* point renderbuffer at texobject */ -- Lerne, wie die Welt wirklich ist, Aber vergiss niemals, wie sie sein sollte. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] 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. --- src/mesa/state_tracker/st_cb_fbo.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 2559c23..a4d710c 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 */ -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev