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
*/
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 * );
GLfloat color[4];
};
+struct pipe_clear_color_state
+{
+ GLfloat color[4];
+};
+
struct pipe_line_state
{
GLuint smooth:1;
--- /dev/null
+/**************************************************************************
+ *
+ * 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) {
+ }
+
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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 */
#include "vf/vf.h"
#include "sp_context.h"
+#include "sp_clear.h"
#include "sp_prim.h"
#include "sp_state.h"
#include "sp_draw.h"
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;
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 );
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;
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 * );
/*
* 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);
}
+
+
+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 */
+}
vf/vf_sse.c
SOFTPIPE_SOURCES = \
+ pipe/softpipe/sp_clear.c \
pipe/softpipe/sp_context.c \
pipe/softpipe/sp_draw.c \
pipe/softpipe/sp_prim_clip.c \
state_tracker/st_atom.c \
state_tracker/st_atom_alphatest.c \
state_tracker/st_atom_blend.c \
+ state_tracker/st_atom_clear_color.c \
state_tracker/st_atom_clip.c \
state_tracker/st_atom_depth.c \
state_tracker/st_atom_fs.c \
static const struct st_tracked_state *atoms[] =
{
&st_update_framebuffer,
+ &st_update_clear_color,
&st_update_clip,
&st_update_fs,
&st_update_point,
const struct st_tracked_state st_update_framebuffer;
const struct st_tracked_state st_update_clip;
+const struct st_tracked_state st_update_clear_color;
const struct st_tracked_state st_update_depth;
const struct st_tracked_state st_update_fs;
const struct st_tracked_state st_update_point;
--- /dev/null
+/**************************************************************************
+ *
+ * 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.
+ *
+ **************************************************************************/
+
+ /*
+ * Authors:
+ * Keith Whitwell <keith@tungstengraphics.com>
+ * Brian Paul
+ */
+
+#include "st_context.h"
+#include "st_atom.h"
+#include "pipe/p_context.h"
+
+
+static void
+update_clear_color_state( struct st_context *st )
+{
+ struct pipe_clear_color_state clear;
+
+ clear.color[0] = st->ctx->Color.ClearColor[0];
+ clear.color[1] = st->ctx->Color.ClearColor[1];
+ clear.color[2] = st->ctx->Color.ClearColor[2];
+ clear.color[3] = st->ctx->Color.ClearColor[3];
+
+ if (memcmp(&clear, &st->state.clear_color, sizeof(clear)) != 0) {
+ st->state.clear_color = clear;
+ st->pipe->set_clear_color_state( st->pipe, &clear );
+ }
+}
+
+
+const struct st_tracked_state st_update_clear_color = {
+ .dirty = {
+ .mesa = _NEW_COLOR,
+ .st = 0,
+ },
+ .update = update_clear_color_state
+};
struct pipe_fs_state fs;
struct pipe_alpha_test_state alpha_test;
struct pipe_blend_state blend;
+ struct pipe_clear_color_state clear_color;
struct pipe_clip_state clip;
struct pipe_depth_state depth;
struct pipe_point_state point;