intel: added intel_rendering_to_texture() helper function.
authorBrian Paul <brianp@vmware.com>
Fri, 16 Jan 2009 20:31:04 +0000 (13:31 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 16 Jan 2009 20:31:04 +0000 (13:31 -0700)
When we're rendering to textures we have to invert the viewport transformation.
This helper cleans up that test and can be used elsewhere...

src/mesa/drivers/dri/intel/intel_fbo.h

index 9d15582d78c8d1da410a3f83ce8bf4b3b3a2e6b0..c57a01c759bc4632b3e7bf73183308f5387320a1 100644 (file)
@@ -111,5 +111,22 @@ extern struct intel_region *intel_get_rb_region(struct gl_framebuffer *fb,
 
 
 
+/**
+ * Are we currently rendering into a texture?
+ */
+static INLINE GLboolean
+intel_rendering_to_texture(const GLcontext *ctx)
+{
+   if (ctx->DrawBuffer->Name) {
+      /* User-created FBO */
+      const struct intel_renderbuffer *irb =
+         intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]);
+      return irb && irb->RenderToTexture;
+   }
+   else {
+      return GL_FALSE;
+   }
+}
+
 
 #endif /* INTEL_FBO_H */