added pipe->supported_formats()
authorBrian <brian@i915.localnet.net>
Fri, 3 Aug 2007 02:40:33 +0000 (20:40 -0600)
committerBrian <brian@i915.localnet.net>
Fri, 3 Aug 2007 02:40:33 +0000 (20:40 -0600)
src/mesa/pipe/p_context.h
src/mesa/pipe/softpipe/sp_context.c

index 4f8bdae1409e561934240230089ffda318007bc7..7acaabbdfd07cd3df90a1940b7fde0a9869bcec6 100644 (file)
@@ -49,6 +49,12 @@ struct pipe_context {
 
    void (*destroy)( struct pipe_context * );
 
+   /*
+    * Queries
+    */
+   const GLuint *(*supported_formats)(struct pipe_context *pipe,
+                                      GLuint *numFormats);
+
    /*
     * Drawing
     */
index 9fba9605e8c64f53251d98129b863ba2ff21136c..fe7f2f351a4f6e3f27272d7e4faa4ff25826e99d 100644 (file)
 #include "sp_prim_setup.h"
 
 
+
+/**
+ * Return list of supported surface/texture formats.
+ * If we find texture and drawable support differs, add a selector
+ * parameter or another function.
+ */
+static const GLuint *
+softpipe_supported_formats(struct pipe_context *pipe, GLuint *numFormats)
+{
+   static const GLuint supported[] = {
+      PIPE_FORMAT_U_R8_G8_B8_A8,
+      PIPE_FORMAT_U_A8_R8_G8_B8,
+      PIPE_FORMAT_U_R5_G6_B5,
+      PIPE_FORMAT_U_L8,
+      PIPE_FORMAT_U_A8,
+      PIPE_FORMAT_U_I8,
+      PIPE_FORMAT_U_L8_A8,
+      PIPE_FORMAT_S_R16_G16_B16_A16,
+      PIPE_FORMAT_YCBCR,
+      PIPE_FORMAT_YCBCR_REV,
+      PIPE_FORMAT_U_Z16,
+      PIPE_FORMAT_U_Z32,
+      PIPE_FORMAT_F_Z32,
+      PIPE_FORMAT_S8_Z24,
+      PIPE_FORMAT_U_S8
+   };
+
+   *numFormats = sizeof(supported)/sizeof(supported[0]);
+   return supported;
+}
+
+
+
 static void map_surfaces(struct softpipe_context *sp)
 {
    struct pipe_context *pipe = &sp->pipe;
@@ -140,6 +173,9 @@ struct pipe_context *softpipe_create( void )
    struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context);
 
    softpipe->pipe.destroy = softpipe_destroy;
+
+   softpipe->pipe.supported_formats = softpipe_supported_formats;
+
    softpipe->pipe.set_alpha_test_state = softpipe_set_alpha_test_state;
    softpipe->pipe.set_blend_color = softpipe_set_blend_color;
    softpipe->pipe.set_blend_state = softpipe_set_blend_state;