summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-06-20 08:47:09 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-06-20 08:47:09 -0600
commit73f96c51052bf5233191d852ef463462306bf1d5 (patch)
tree29a1f9f4b5f052f7894dce351ebfb4a8ae69b85a /src/mesa/pipe
parent6cb2d0cb71d2019bd2c941a8c042e56275b22c1c (diff)
Initial work for glClear(), clear color state.
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/p_context.h10
-rw-r--r--src/mesa/pipe/p_state.h5
-rw-r--r--src/mesa/pipe/softpipe/sp_clear.c47
-rw-r--r--src/mesa/pipe/softpipe/sp_clear.h43
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c4
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h1
-rw-r--r--src/mesa/pipe/softpipe/sp_state.h3
-rw-r--r--src/mesa/pipe/softpipe/sp_state_surface.c15
8 files changed, 122 insertions, 6 deletions
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index 3e0c61eda2..32444343be 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -53,6 +53,10 @@ struct pipe_context {
void (*draw_vb)( struct pipe_context *pipe,
struct vertex_buffer *VB );
+ /** Clear framebuffer */
+ void (*clear)(struct pipe_context *pipe, GLboolean color, GLboolean depth,
+ GLboolean stencil, GLboolean accum);
+
/*
* State functions
*/
@@ -62,12 +66,12 @@ struct pipe_context {
void (*set_blend_state)( struct pipe_context *,
const struct pipe_blend_state * );
- void (*set_cbuf_state)( struct pipe_context *,
- const struct pipe_surface * );
-
void (*set_clip_state)( struct pipe_context *,
const struct pipe_clip_state * );
+ void (*set_clear_color_state)( struct pipe_context *,
+ const struct pipe_clear_color_state * );
+
void (*set_depth_state)( struct pipe_context *,
const struct pipe_depth_state * );
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h
index c88c0de6ad..c4bf0d2195 100644
--- a/src/mesa/pipe/p_state.h
+++ b/src/mesa/pipe/p_state.h
@@ -133,6 +133,11 @@ struct pipe_blend_color {
GLfloat color[4];
};
+struct pipe_clear_color_state
+{
+ GLfloat color[4];
+};
+
struct pipe_line_state
{
GLuint smooth:1;
diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c
new file mode 100644
index 0000000000..c7fbca4229
--- /dev/null
+++ b/src/mesa/pipe/softpipe/sp_clear.c
@@ -0,0 +1,47 @@
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/* Author:
+ * Brian Paul
+ */
+
+
+#include "sp_clear.h"
+
+
+void
+softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth,
+ GLboolean stencil, GLboolean accum)
+{
+ /* validate state (scissor)? */
+
+ if (color) {
+ }
+ if (depth) {
+ }
+
+}
diff --git a/src/mesa/pipe/softpipe/sp_clear.h b/src/mesa/pipe/softpipe/sp_clear.h
new file mode 100644
index 0000000000..f9db99dd32
--- /dev/null
+++ b/src/mesa/pipe/softpipe/sp_clear.h
@@ -0,0 +1,43 @@
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/* Author:
+ * Brian Paul
+ */
+
+#ifndef SP_CLEAR_H
+#define SP_CLEAR_H
+
+#include "pipe/p_state.h"
+struct pipe_context;
+
+extern void
+softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth,
+ GLboolean stencil, GLboolean accum);
+
+
+#endif /* SP_CLEAR_H */
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index e0acf4177b..7ab65162bd 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -36,6 +36,7 @@
#include "vf/vf.h"
#include "sp_context.h"
+#include "sp_clear.h"
#include "sp_prim.h"
#include "sp_state.h"
#include "sp_draw.h"
@@ -68,6 +69,7 @@ struct pipe_context *softpipe_create( void )
softpipe->pipe.destroy = softpipe_destroy;
softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state;
softpipe->pipe.set_clip_state = softpipe_set_clip_state;
+ softpipe->pipe.set_clear_color_state = softpipe_set_clear_color_state;
softpipe->pipe.set_point_state = softpipe_set_point_state;
softpipe->pipe.set_viewport = softpipe_set_viewport;
softpipe->pipe.set_setup_state = softpipe_set_setup_state;
@@ -75,7 +77,7 @@ struct pipe_context *softpipe_create( void )
softpipe->pipe.set_fs_state = softpipe_set_fs_state;
softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple;
softpipe->pipe.draw_vb = softpipe_draw_vb;
-
+ softpipe->pipe.clear = softpipe_clear;
softpipe->prim.setup = prim_setup( softpipe );
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index 43cb6f3f0b..0a183ea385 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -76,6 +76,7 @@ struct softpipe_context {
struct pipe_blend_state blend;
struct pipe_alpha_test_state alpha_test;
struct pipe_clip_state clip;
+ struct pipe_clear_color_state clear_color;
struct pipe_point_state point;
struct pipe_scissor_rect scissor;
struct pipe_poly_stipple poly_stipple;
diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h
index 4d18e80b38..bc5a3512ae 100644
--- a/src/mesa/pipe/softpipe/sp_state.h
+++ b/src/mesa/pipe/softpipe/sp_state.h
@@ -38,6 +38,9 @@
void softpipe_set_framebuffer_state( struct pipe_context *,
const struct pipe_framebuffer_state * );
+void softpipe_set_clear_color_state( struct pipe_context *,
+ const struct pipe_clear_color_state * );
+
void softpipe_set_clip_state( struct pipe_context *,
const struct pipe_clip_state * );
diff --git a/src/mesa/pipe/softpipe/sp_state_surface.c b/src/mesa/pipe/softpipe/sp_state_surface.c
index 99332fdd52..4d27814e1b 100644
--- a/src/mesa/pipe/softpipe/sp_state_surface.c
+++ b/src/mesa/pipe/softpipe/sp_state_surface.c
@@ -37,8 +37,9 @@
/*
* XXX this might get moved someday
*/
-void softpipe_set_framebuffer_state( struct pipe_context *pipe,
- const struct pipe_framebuffer_state *fb )
+void
+softpipe_set_framebuffer_state(struct pipe_context *pipe,
+ const struct pipe_framebuffer_state *fb)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
@@ -48,3 +49,13 @@ void softpipe_set_framebuffer_state( struct pipe_context *pipe,
}
+
+
+void
+softpipe_set_clear_color_state(struct pipe_context *pipe,
+ const struct pipe_clear_color_state *clear)
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+
+ softpipe->clear_color = *clear; /* struct copy */
+}