summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/softpipe
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-12-10 13:48:09 -0700
committerBrian <[email protected]>2007-12-10 13:48:09 -0700
commit4f58d9af9addb1506a1b2abc7dd8012147772b78 (patch)
treead223bf21560a3690d367e1cfedceb9fd2791f7e /src/mesa/pipe/softpipe
parentf26936b35253b697f1ccb5c2898a8607564bdcfe (diff)
Add 'type' parameter to is_format_supported() to specify texture vs. drawing surface, etc.
Additional types may be added in the future.
Diffstat (limited to 'src/mesa/pipe/softpipe')
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c24
-rw-r--r--src/mesa/pipe/softpipe/sp_winsys.h16
2 files changed, 27 insertions, 13 deletions
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index 809b165f450..8b8e04c2f9e 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -46,17 +46,29 @@
/**
- * Query format support.
- * If we find texture and drawable support differs, add a selector
- * parameter or another function.
+ * Query format support for creating a texture, drawing surface, etc.
+ * \param format the format to test
+ * \param type one of PIPE_TEXTURE, PIPE_SURFACE, PIPE_SCREEN_SURFACE
*/
static boolean
softpipe_is_format_supported( struct pipe_context *pipe,
- enum pipe_format format )
+ enum pipe_format format, uint type )
{
struct softpipe_context *softpipe = softpipe_context( pipe );
- /* ask winsys if the format is supported */
- return softpipe->winsys->is_format_supported( softpipe->winsys, format );
+
+ switch (type) {
+ case PIPE_TEXTURE:
+ /* softpipe supports all texture formats */
+ return TRUE;
+ case PIPE_SURFACE:
+ /* softpipe supports all (off-screen) surface formats */
+ return TRUE;
+ case PIPE_SCREEN_SURFACE:
+ return softpipe->winsys->is_format_supported( softpipe->winsys, format );
+ default:
+ assert(0);
+ return FALSE;
+ }
}
diff --git a/src/mesa/pipe/softpipe/sp_winsys.h b/src/mesa/pipe/softpipe/sp_winsys.h
index 1912e59b9f4..cbf64ebb850 100644
--- a/src/mesa/pipe/softpipe/sp_winsys.h
+++ b/src/mesa/pipe/softpipe/sp_winsys.h
@@ -25,21 +25,23 @@
*
**************************************************************************/
+/* This is the interface that softpipe requires any window system
+ * hosting it to implement. This is the only include file in softpipe
+ * which is public.
+ */
+
+
#ifndef SP_WINSYS_H
#define SP_WINSYS_H
-#include "pipe/p_compiler.h" // for boolean
+#include "pipe/p_compiler.h" /* for boolean */
-/* This is the interface that softpipe requires any window system
- * hosting it to implement. This is the only include file in softpipe
- * which is public.
- */
-
struct softpipe_winsys {
+ /** test if the given format is supported for front/back color bufs */
boolean (*is_format_supported)( struct softpipe_winsys *sws,
- uint format );
+ enum pipe_format format );
};