st/mesa: added st_is_depth_stencil_combined() function
authorBrian Paul <brianp@vmware.com>
Mon, 23 Aug 2010 01:34:53 +0000 (19:34 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 23 Aug 2010 01:40:26 +0000 (19:40 -0600)
This code is part of a patch by Marek Olšák.

src/mesa/state_tracker/st_cb_fbo.c
src/mesa/state_tracker/st_cb_fbo.h

index 48d83ded55298888b884cdde6ad577a550e768c4..71bd4729e03dc5862109cccddc4f79a95997b559 100644 (file)
@@ -447,6 +447,30 @@ st_validate_attachment(struct pipe_screen *screen,
 }
 
 
+/**
+ * Check if two renderbuffer attachments name a combined depth/stencil
+ * renderbuffer.
+ */
+GLboolean
+st_is_depth_stencil_combined(const struct gl_renderbuffer_attachment *depth,
+                             const struct gl_renderbuffer_attachment *stencil)
+{
+   assert(depth && stencil);
+
+   if (depth->Type == stencil->Type) {
+      if (depth->Type == GL_RENDERBUFFER_EXT &&
+          depth->Renderbuffer == stencil->Renderbuffer)
+         return GL_TRUE;
+
+      if (depth->Type == GL_TEXTURE &&
+          depth->Texture == stencil->Texture)
+         return GL_TRUE;
+   }
+
+   return GL_FALSE;
+}
+
 /**
  * Check that the framebuffer configuration is valid in terms of what
  * the driver can support.
index 62a9bbcb25f087e893490903b773e3715f3ebb70..3e9815c1b13cfee4216075caf318438bbfc8401a 100644 (file)
@@ -88,4 +88,9 @@ st_get_renderbuffer_sampler_view(struct st_renderbuffer *rb,
                                  struct pipe_context *pipe);
 
 
+extern GLboolean
+st_is_depth_stencil_combined(const struct gl_renderbuffer_attachment *depth,
+                             const struct gl_renderbuffer_attachment *stencil);
+
+
 #endif /* ST_CB_FBO_H */