Added accum function/files.
authorBrian <brian.paul@tungstengraphics.com>
Sun, 14 Oct 2007 17:52:00 +0000 (11:52 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Sun, 14 Oct 2007 17:52:00 +0000 (11:52 -0600)
src/mesa/sources
src/mesa/state_tracker/st_cb_accum.c [new file with mode: 0644]
src/mesa/state_tracker/st_cb_accum.h [new file with mode: 0644]
src/mesa/state_tracker/st_context.c

index 069be2e01db9c3fa1dbe344547bdd4e4366e1115..cf307401b23793fe83dd6b6ad84423fa9edbecae 100644 (file)
@@ -208,6 +208,7 @@ STATETRACKER_SOURCES = \
        state_tracker/st_atom_stipple.c \
        state_tracker/st_atom_texture.c \
        state_tracker/st_atom_viewport.c \
+       state_tracker/st_cb_accum.c \
        state_tracker/st_cb_bufferobjects.c \
        state_tracker/st_cb_clear.c \
        state_tracker/st_cb_flush.c \
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
new file mode 100644 (file)
index 0000000..c8fef6c
--- /dev/null
@@ -0,0 +1,90 @@
+/**************************************************************************
+ * 
+ * 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:
+  *   Brian Paul
+  */
+
+#include "main/imports.h"
+#include "main/image.h"
+#include "main/macros.h"
+
+#include "st_context.h"
+#include "st_atom.h"
+#include "st_cache.h"
+#include "st_draw.h"
+#include "st_program.h"
+#include "st_cb_accum.h"
+#include "st_draw.h"
+#include "st_format.h"
+#include "pipe/p_context.h"
+#include "pipe/p_defines.h"
+
+
+
+static void
+st_Accum(GLcontext *ctx, GLenum op, GLfloat value)
+{
+   const GLint xpos = ctx->DrawBuffer->_Xmin;
+   const GLint ypos = ctx->DrawBuffer->_Ymin;
+   const GLint width = ctx->DrawBuffer->_Xmax - xpos;
+   const GLint height = ctx->DrawBuffer->_Ymax - ypos;
+
+   switch (op) {
+   case GL_ADD:
+      if (value != 0.0F) {
+         accum_add(ctx, value, xpos, ypos, width, height);
+      }
+      break;
+   case GL_MULT:
+      if (value != 1.0F) {
+         accum_mult(ctx, value, xpos, ypos, width, height);
+      }
+      break;
+   case GL_ACCUM:
+      if (value != 0.0F) {
+         accum_accum(ctx, value, xpos, ypos, width, height);
+      }
+      break;
+   case GL_LOAD:
+      accum_load(ctx, value, xpos, ypos, width, height);
+      break;
+   case GL_RETURN:
+      accum_return(ctx, value, xpos, ypos, width, height);
+      break;
+   default:
+      assert(0);
+   }
+}
+
+
+
+void st_init_accum_functions(struct dd_function_table *functions)
+{
+   functions->Accum = st_Accum;
+}
diff --git a/src/mesa/state_tracker/st_cb_accum.h b/src/mesa/state_tracker/st_cb_accum.h
new file mode 100644 (file)
index 0000000..8a4101c
--- /dev/null
@@ -0,0 +1,36 @@
+/**************************************************************************
+ * 
+ * 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.
+ * 
+ **************************************************************************/
+
+
+#ifndef ST_CB_ACCUM_H
+#define ST_CB_ACCUM_H
+
+
+extern void st_init_accum_functions(struct dd_function_table *functions);
+
+
+#endif /* ST_CB_ACCUM_H */
index 7c20b036a44201b08f3aff13828fa7171f6dbefa..09d9b1ea3b442f1ad44104e6220afb0de262c21b 100644 (file)
@@ -31,6 +31,7 @@
 #include "vbo/vbo.h"
 #include "st_public.h"
 #include "st_context.h"
+#include "st_cb_accum.h"
 #include "st_cb_bufferobjects.h"
 #include "st_cb_clear.h"
 #include "st_cb_drawpixels.h"
@@ -130,6 +131,7 @@ void st_destroy_context( struct st_context *st )
 
 void st_init_driver_functions(struct dd_function_table *functions)
 {
+   st_init_accum_functions(functions);
    st_init_bufferobject_functions(functions);
    st_init_clear_functions(functions);
    st_init_drawpixels_functions(functions);