summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-08-02 20:40:33 -0600
committerBrian <[email protected]>2007-08-02 20:40:33 -0600
commitc358a39af5968faf27c5fdc85bf64ac76fa2486b (patch)
tree7352a73c5883e9ae8d06a846564a3aa9845486b8
parent61d0215d7b35bff980acbf1d61c764f8b80c0e71 (diff)
added pipe->supported_formats()
-rw-r--r--src/mesa/pipe/p_context.h6
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c36
2 files changed, 42 insertions, 0 deletions
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index 4f8bdae1409..7acaabbdfd0 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -50,6 +50,12 @@ struct pipe_context {
void (*destroy)( struct pipe_context * );
/*
+ * Queries
+ */
+ const GLuint *(*supported_formats)(struct pipe_context *pipe,
+ GLuint *numFormats);
+
+ /*
* Drawing
*/
void (*draw_vb)( struct pipe_context *pipe,
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index 9fba9605e8c..fe7f2f351a4 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -41,6 +41,39 @@
#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;