summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/intel/intel_fbo.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-02-26 16:51:50 -0700
committerBrian Paul <[email protected]>2009-02-26 18:48:36 -0700
commitf77b720cde981d441e482bbbd68115634b3041ce (patch)
tree6a94e62c48a5a249413e24123bfb4f7aa2b138a6 /src/mesa/drivers/dri/intel/intel_fbo.c
parent645f220710923f72e80281fa75e577e133b5a53c (diff)
intel: check texture formats in intel_validate_framebuffer()
We can't render into any texture format; only certain formats. Check that render-to-texture's format is renderable in the intel_validate_framebuffer() There seems to be a bug somewhere that causes rendering to rgb565 textures to be corrupted so disallow that for now. This will be revisted.
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_fbo.c')
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 739a85232e5..53075378bcd 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -634,6 +634,7 @@ intel_finish_render_texture(GLcontext * ctx,
static void
intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
{
+ struct intel_context *intel = intel_context(ctx);
const struct intel_renderbuffer *depthRb =
intel_get_renderbuffer(fb, BUFFER_DEPTH);
const struct intel_renderbuffer *stencilRb =
@@ -645,6 +646,34 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
*/
fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
}
+
+ /* check that texture color buffers are a format we can render into */
+ {
+ const struct gl_texture_format *supportedFormat;
+ GLuint i;
+
+ /* The texture format we can render into seems to depend on the
+ * screen depth. There currently seems to be a problem when
+ * rendering into a rgb565 texture when the screen is abgr8888.
+ */
+ if (intel->front_region->cpp == 4)
+ supportedFormat = &_mesa_texformat_argb8888;
+ else
+ supportedFormat = &_mesa_texformat_rgb565;
+
+ for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+ const struct gl_texture_object *texObj =
+ fb->Attachment[BUFFER_COLOR0 + i].Texture;
+ if (texObj) {
+ const struct gl_texture_image *texImg =
+ texObj->Image[0][texObj->BaseLevel];
+ if (texImg && texImg->TexFormat != supportedFormat) {
+ fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+ break;
+ }
+ }
+ }
+ }
}