Mesa (master): nvfx: prevent swizzled rendering into formats where it' s not supported

Luca Barbieri lb at kemper.freedesktop.org
Sat Sep 4 21:01:22 UTC 2010


Module: Mesa
Branch: master
Commit: f7392eb23a700ab7a131f4a0d23426996ac352a5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f7392eb23a700ab7a131f4a0d23426996ac352a5

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Sat Sep  4 17:48:19 2010 +0200

nvfx: prevent swizzled rendering into formats where it's not supported

---

 src/gallium/drivers/nvfx/nvfx_state_fb.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c b/src/gallium/drivers/nvfx/nvfx_state_fb.c
index b9d30c4..667b084 100644
--- a/src/gallium/drivers/nvfx/nvfx_state_fb.c
+++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c
@@ -5,6 +5,7 @@
 static inline boolean
 nvfx_surface_linear_renderable(struct pipe_surface* surf)
 {
+	/* TODO: precompute this in nvfx_surface creation */
 	return (surf->texture->flags & NVFX_RESOURCE_FLAG_LINEAR)
 		&& !(surf->offset & 63)
 		&& !(((struct nvfx_surface*)surf)->pitch & 63);
@@ -13,13 +14,14 @@ nvfx_surface_linear_renderable(struct pipe_surface* surf)
 static inline boolean
 nvfx_surface_swizzled_renderable(struct pipe_framebuffer_state* fb, struct pipe_surface* surf)
 {
-	/* TODO: return FALSE if we have a format not supporting swizzled rendering (e.g. r8); currently those are not supported at all */
+	/* TODO: precompute this in nvfx_surface creation */
 	return !((struct nvfx_miptree*)surf->texture)->linear_pitch
 		&& (surf->texture->target != PIPE_TEXTURE_3D || u_minify(surf->texture->depth0, surf->level) <= 1)
 		&& !(surf->offset & 127)
 		&& (surf->width == fb->width)
 		&& (surf->height == fb->height)
-		&& !((struct nvfx_surface*)surf)->temp;
+		&& !((struct nvfx_surface*)surf)->temp
+		&& (surf->format == PIPE_FORMAT_B8G8R8A8_UNORM || surf->format == PIPE_FORMAT_B8G8R8X8_UNORM || surf->format == PIPE_FORMAT_B5G6R5_UNORM);
 }
 
 static boolean




More information about the mesa-commit mailing list