r300g: add r300_init_render_functions, remove r300_render.h
authorMarek Olšák <maraeo@gmail.com>
Tue, 25 May 2010 21:29:39 +0000 (23:29 +0200)
committerMarek Olšák <maraeo@gmail.com>
Tue, 25 May 2010 21:32:25 +0000 (23:32 +0200)
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_render.c
src/gallium/drivers/r300/r300_render.h [deleted file]

index 70f022e9777350ee76654564f03d8978491408ac..505970ffb8a1e315cebe981b8612d91bd55197d4 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "r300_context.h"
 #include "r300_emit.h"
-#include "r300_render.h"
 #include "r300_screen.h"
 #include "r300_screen_buffer.h"
 #include "r300_state_invariant.h"
@@ -182,25 +181,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
 
     r300->context.destroy = r300_destroy_context;
 
-    if (r300screen->caps.has_tcl) {
-        r300->context.draw_arrays = r300_draw_arrays;
-        r300->context.draw_elements = r300_draw_elements;
-        r300->context.draw_range_elements = r300_draw_range_elements;
-
-        if (r300screen->caps.is_r500) {
-            r300->emit_draw_arrays_immediate = r500_emit_draw_arrays_immediate;
-            r300->emit_draw_arrays = r500_emit_draw_arrays;
-            r300->emit_draw_elements = r500_emit_draw_elements;
-        } else {
-            r300->emit_draw_arrays_immediate = r300_emit_draw_arrays_immediate;
-            r300->emit_draw_arrays = r300_emit_draw_arrays;
-            r300->emit_draw_elements = r300_emit_draw_elements;
-        }
-    } else {
-        r300->context.draw_arrays = r300_swtcl_draw_arrays;
-        r300->context.draw_elements = r300_draw_elements;
-        r300->context.draw_range_elements = r300_swtcl_draw_range_elements;
-
+    if (!r300screen->caps.has_tcl) {
         /* Create a Draw. This is used for SW TCL. */
         r300->draw = draw_create(&r300->context);
         /* Enable our renderer. */
@@ -222,6 +203,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     r300_init_blit_functions(r300);
     r300_init_flush_functions(r300);
     r300_init_query_functions(r300);
+    r300_init_render_functions(r300);
     r300_init_state_functions(r300);
     r300_init_resource_functions(r300);
 
index b658d4b977bd433f2a74e669ae808258c6cbea18..0933d6b833a19c4482d39bbf5f7aea1c323fb3e5 100644 (file)
@@ -470,6 +470,7 @@ struct draw_stage* r300_draw_stage(struct r300_context* r300);
 void r300_init_blit_functions(struct r300_context *r300);
 void r300_init_flush_functions(struct r300_context* r300);
 void r300_init_query_functions(struct r300_context* r300);
+void r300_init_render_functions(struct r300_context *r300);
 void r300_init_state_functions(struct r300_context* r300);
 void r300_init_resource_functions(struct r300_context* r300);
 
index e1f61982be223c8571e286b0976690c92ff6155a..42716552c7f18f5625976bb057b7d2db2eaf92c5 100644 (file)
@@ -38,7 +38,6 @@
 #include "r300_screen_buffer.h"
 #include "r300_emit.h"
 #include "r300_reg.h"
-#include "r300_render.h"
 #include "r300_state_derived.h"
 
 static uint32_t r300_translate_primitive(unsigned prim)
@@ -237,10 +236,10 @@ static boolean immd_is_good_idea(struct r300_context *r300,
  * after resolving fallback issues (e.g. stencil ref two-sided).             *
  ****************************************************************************/
 
-void r500_emit_draw_arrays_immediate(struct r300_context *r300,
-                                     unsigned mode,
-                                     unsigned start,
-                                     unsigned count)
+static void r500_emit_draw_arrays_immediate(struct r300_context *r300,
+                                            unsigned mode,
+                                            unsigned start,
+                                            unsigned count)
 {
     struct pipe_vertex_element* velem;
     struct pipe_vertex_buffer* vbuf;
@@ -327,9 +326,9 @@ void r500_emit_draw_arrays_immediate(struct r300_context *r300,
     }
 }
 
-void r500_emit_draw_arrays(struct r300_context *r300,
-                           unsigned mode,
-                           unsigned count)
+static void r500_emit_draw_arrays(struct r300_context *r300,
+                                  unsigned mode,
+                                  unsigned count)
 {
     boolean alt_num_verts = count > 65535;
     CS_LOCALS(r300);
@@ -356,14 +355,14 @@ void r500_emit_draw_arrays(struct r300_context *r300,
     END_CS;
 }
 
-void r500_emit_draw_elements(struct r300_context *r300,
-                             struct pipe_resource* indexBuffer,
-                             unsigned indexSize,
-                             unsigned minIndex,
-                             unsigned maxIndex,
-                             unsigned mode,
-                             unsigned start,
-                             unsigned count)
+static void r500_emit_draw_elements(struct r300_context *r300,
+                                    struct pipe_resource* indexBuffer,
+                                    unsigned indexSize,
+                                    unsigned minIndex,
+                                    unsigned maxIndex,
+                                    unsigned mode,
+                                    unsigned start,
+                                    unsigned count)
 {
     uint32_t count_dwords;
     uint32_t offset_dwords = indexSize * start / sizeof(uint32_t);
@@ -463,10 +462,10 @@ static void r300_end_stencil_ref_fallback(struct r300_context *r300)
     END_CS;
 }
 
-void r300_emit_draw_arrays_immediate(struct r300_context *r300,
-                                     unsigned mode,
-                                     unsigned start,
-                                     unsigned count)
+static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
+                                            unsigned mode,
+                                            unsigned start,
+                                            unsigned count)
 {
     if (!r300->stencil_ref_bf_fallback) {
         r500_emit_draw_arrays_immediate(r300, mode, start, count);
@@ -479,9 +478,9 @@ void r300_emit_draw_arrays_immediate(struct r300_context *r300,
     }
 }
 
-void r300_emit_draw_arrays(struct r300_context *r300,
-                           unsigned mode,
-                           unsigned count)
+static void r300_emit_draw_arrays(struct r300_context *r300,
+                                  unsigned mode,
+                                  unsigned count)
 {
     if (!r300->stencil_ref_bf_fallback) {
         r500_emit_draw_arrays(r300, mode, count);
@@ -494,14 +493,14 @@ void r300_emit_draw_arrays(struct r300_context *r300,
     }
 }
 
-void r300_emit_draw_elements(struct r300_context *r300,
-                             struct pipe_resource* indexBuffer,
-                             unsigned indexSize,
-                             unsigned minIndex,
-                             unsigned maxIndex,
-                             unsigned mode,
-                             unsigned start,
-                             unsigned count)
+static void r300_emit_draw_elements(struct r300_context *r300,
+                                    struct pipe_resource* indexBuffer,
+                                    unsigned indexSize,
+                                    unsigned minIndex,
+                                    unsigned maxIndex,
+                                    unsigned mode,
+                                    unsigned start,
+                                    unsigned count)
 {
     if (!r300->stencil_ref_bf_fallback) {
         r500_emit_draw_elements(r300, indexBuffer, indexSize,
@@ -580,15 +579,15 @@ static void r300_align_ushort_elts(struct r300_context *r300,
 }
 
 /* This is the fast-path drawing & emission for HW TCL. */
-void r300_draw_range_elements(struct pipe_context* pipe,
-                              struct pipe_resource* indexBuffer,
-                              unsigned indexSize,
-                              int indexBias,
-                              unsigned minIndex,
-                              unsigned maxIndex,
-                              unsigned mode,
-                              unsigned start,
-                              unsigned count)
+static void r300_draw_range_elements(struct pipe_context* pipe,
+                                     struct pipe_resource* indexBuffer,
+                                     unsigned indexSize,
+                                     int indexBias,
+                                     unsigned minIndex,
+                                     unsigned maxIndex,
+                                     unsigned mode,
+                                     unsigned start,
+                                     unsigned count)
 {
     struct r300_context* r300 = r300_context(pipe);
     struct pipe_resource* orgIndexBuffer = indexBuffer;
@@ -652,10 +651,10 @@ void r300_draw_range_elements(struct pipe_context* pipe,
 }
 
 /* Simple helpers for context setup. Should probably be moved to util. */
-void r300_draw_elements(struct pipe_context* pipe,
-                        struct pipe_resource* indexBuffer,
-                        unsigned indexSize, int indexBias, unsigned mode,
-                        unsigned start, unsigned count)
+static void r300_draw_elements(struct pipe_context* pipe,
+                               struct pipe_resource* indexBuffer,
+                               unsigned indexSize, int indexBias, unsigned mode,
+                               unsigned start, unsigned count)
 {
     struct r300_context *r300 = r300_context(pipe);
 
@@ -664,8 +663,8 @@ void r300_draw_elements(struct pipe_context* pipe,
                               mode, start, count);
 }
 
-void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
-                      unsigned start, unsigned count)
+static void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
+                             unsigned start, unsigned count)
 {
     struct r300_context* r300 = r300_context(pipe);
     boolean alt_num_verts = r300->screen->caps.is_r500 &&
@@ -718,10 +717,10 @@ void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
  ***************************************************************************/
 
 /* SW TCL arrays, using Draw. */
-void r300_swtcl_draw_arrays(struct pipe_context* pipe,
-                               unsigned mode,
-                               unsigned start,
-                               unsigned count)
+static void r300_swtcl_draw_arrays(struct pipe_context* pipe,
+                                   unsigned mode,
+                                   unsigned start,
+                                   unsigned count)
 {
     struct r300_context* r300 = r300_context(pipe);
     struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS];
@@ -761,15 +760,15 @@ void r300_swtcl_draw_arrays(struct pipe_context* pipe,
 }
 
 /* SW TCL elements, using Draw. */
-void r300_swtcl_draw_range_elements(struct pipe_context* pipe,
-                                       struct pipe_resource* indexBuffer,
-                                       unsigned indexSize,
-                                       int indexBias,
-                                       unsigned minIndex,
-                                       unsigned maxIndex,
-                                       unsigned mode,
-                                       unsigned start,
-                                       unsigned count)
+static void r300_swtcl_draw_range_elements(struct pipe_context* pipe,
+                                           struct pipe_resource* indexBuffer,
+                                           unsigned indexSize,
+                                           int indexBias,
+                                           unsigned minIndex,
+                                           unsigned maxIndex,
+                                           unsigned mode,
+                                           unsigned start,
+                                           unsigned count)
 {
     struct r300_context* r300 = r300_context(pipe);
     struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS];
@@ -1095,3 +1094,26 @@ struct draw_stage* r300_draw_stage(struct r300_context* r300)
 
     return stage;
 }
+
+void r300_init_render_functions(struct r300_context *r300)
+{
+    if (r300->screen->caps.has_tcl) {
+        r300->context.draw_arrays = r300_draw_arrays;
+        r300->context.draw_elements = r300_draw_elements;
+        r300->context.draw_range_elements = r300_draw_range_elements;
+
+        if (r300->screen->caps.is_r500) {
+            r300->emit_draw_arrays_immediate = r500_emit_draw_arrays_immediate;
+            r300->emit_draw_arrays = r500_emit_draw_arrays;
+            r300->emit_draw_elements = r500_emit_draw_elements;
+        } else {
+            r300->emit_draw_arrays_immediate = r300_emit_draw_arrays_immediate;
+            r300->emit_draw_arrays = r300_emit_draw_arrays;
+            r300->emit_draw_elements = r300_emit_draw_elements;
+        }
+    } else {
+        r300->context.draw_arrays = r300_swtcl_draw_arrays;
+        r300->context.draw_elements = r300_draw_elements;
+        r300->context.draw_range_elements = r300_swtcl_draw_range_elements;
+    }
+}
diff --git a/src/gallium/drivers/r300/r300_render.h b/src/gallium/drivers/r300/r300_render.h
deleted file mode 100644 (file)
index 71dea21..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2009 Corbin Simpson <MostAwesomeDude@gmail.com>
- *
- * 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
- * on 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
- * THE AUTHOR(S) AND/OR THEIR 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 R300_RENDER_H
-#define R300_RENDER_H
-
-void r500_emit_draw_arrays_immediate(struct r300_context *r300,
-                                     unsigned mode,
-                                     unsigned start,
-                                     unsigned count);
-
-void r500_emit_draw_arrays(struct r300_context *r300,
-                           unsigned mode,
-                           unsigned count);
-
-void r500_emit_draw_elements(struct r300_context *r300,
-                             struct pipe_resource* indexBuffer,
-                             unsigned indexSize,
-                             unsigned minIndex,
-                             unsigned maxIndex,
-                             unsigned mode,
-                             unsigned start,
-                             unsigned count);
-
-void r300_emit_draw_arrays_immediate(struct r300_context *r300,
-                                     unsigned mode,
-                                     unsigned start,
-                                     unsigned count);
-
-void r300_emit_draw_arrays(struct r300_context *r300,
-                           unsigned mode,
-                           unsigned count);
-
-void r300_emit_draw_elements(struct r300_context *r300,
-                             struct pipe_resource* indexBuffer,
-                             unsigned indexSize,
-                             unsigned minIndex,
-                             unsigned maxIndex,
-                             unsigned mode,
-                             unsigned start,
-                             unsigned count);
-
-void r300_draw_range_elements(struct pipe_context* pipe,
-                              struct pipe_resource* indexBuffer,
-                              unsigned indexSize,
-                              int indexBias,
-                              unsigned minIndex,
-                              unsigned maxIndex,
-                              unsigned mode,
-                              unsigned start,
-                              unsigned count);
-
-void r300_draw_elements(struct pipe_context* pipe,
-                        struct pipe_resource* indexBuffer,
-                        unsigned indexSize, int indexBias, unsigned mode,
-                        unsigned start, unsigned count);
-
-void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
-                      unsigned start, unsigned count);
-
-void r300_swtcl_draw_arrays(struct pipe_context* pipe,
-                            unsigned mode,
-                            unsigned start,
-                            unsigned count);
-
-void r300_swtcl_draw_range_elements(struct pipe_context* pipe,
-                                    struct pipe_resource* indexBuffer,
-                                    unsigned indexSize,
-                                    int indexBias,
-                                    unsigned minIndex,
-                                    unsigned maxIndex,
-                                    unsigned mode,
-                                    unsigned start,
-                                    unsigned count);
-
-#endif /* R300_RENDER_H */