r300: Add support for GL_EXT_provoking_vertex
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 4 Sep 2009 22:21:34 +0000 (18:21 -0400)
committerAlex Deucher <alexdeucher@gmail.com>
Fri, 4 Sep 2009 22:46:15 +0000 (18:46 -0400)
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r300/r300_reg.h
src/mesa/drivers/dri/r300/r300_state.c

index 2ea1b826de972f6ce3ebe56f2ff70371c2a112d8..6fcf209af66cde2316f7b9762e5d03d818ca1ea3 100644 (file)
@@ -84,6 +84,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define need_GL_EXT_framebuffer_object
 #define need_GL_EXT_fog_coord
 #define need_GL_EXT_gpu_program_parameters
+#define need_GL_EXT_provoking_vertex
 #define need_GL_EXT_secondary_color
 #define need_GL_EXT_stencil_two_side
 #define need_GL_ATI_separate_stencil
@@ -116,6 +117,7 @@ const struct dri_extension card_extensions[] = {
   {"GL_EXT_packed_depth_stencil",      NULL},
   {"GL_EXT_fog_coord",                 GL_EXT_fog_coord_functions },
   {"GL_EXT_gpu_program_parameters",     GL_EXT_gpu_program_parameters_functions},
+  {"GL_EXT_provoking_vertex",           GL_EXT_provoking_vertex_functions },
   {"GL_EXT_secondary_color",           GL_EXT_secondary_color_functions},
   {"GL_EXT_shadow_funcs",              NULL},
   {"GL_EXT_stencil_two_side",          GL_EXT_stencil_two_side_functions},
index 39b4b61a105853b2d734fb96541d8471c1ca10fc..98512d778e351c4ef0db5e1f9ed15498cc7a2b54 100644 (file)
@@ -1022,15 +1022,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
        R300_GA_COLOR_CONTROL_RGB0_SHADING_GOURAUD | R300_GA_COLOR_CONTROL_ALPHA0_SHADING_GOURAUD | \
        R300_GA_COLOR_CONTROL_RGB1_SHADING_GOURAUD | R300_GA_COLOR_CONTROL_ALPHA1_SHADING_GOURAUD | \
        R300_GA_COLOR_CONTROL_RGB2_SHADING_GOURAUD | R300_GA_COLOR_CONTROL_ALPHA2_SHADING_GOURAUD | \
-       R300_GA_COLOR_CONTROL_RGB3_SHADING_GOURAUD | R300_GA_COLOR_CONTROL_ALPHA3_SHADING_GOURAUD | \
-       R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST )
+       R300_GA_COLOR_CONTROL_RGB3_SHADING_GOURAUD | R300_GA_COLOR_CONTROL_ALPHA3_SHADING_GOURAUD)
 /** TODO: might be candidate for removal, the GOURAUD stuff also looks buggy to me */
 #      define R300_RE_SHADE_MODEL_FLAT     ( \
        R300_GA_COLOR_CONTROL_RGB0_SHADING_FLAT | R300_GA_COLOR_CONTROL_ALPHA0_SHADING_FLAT | \
        R300_GA_COLOR_CONTROL_RGB1_SHADING_FLAT | R300_GA_COLOR_CONTROL_ALPHA1_SHADING_GOURAUD | \
        R300_GA_COLOR_CONTROL_RGB2_SHADING_FLAT | R300_GA_COLOR_CONTROL_ALPHA2_SHADING_FLAT | \
-       R300_GA_COLOR_CONTROL_RGB3_SHADING_FLAT | R300_GA_COLOR_CONTROL_ALPHA3_SHADING_GOURAUD | \
-       R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST )
+       R300_GA_COLOR_CONTROL_RGB3_SHADING_FLAT | R300_GA_COLOR_CONTROL_ALPHA3_SHADING_GOURAUD)
 
 /* Specifies red & green components of fill color -- S312 format -- Backwards comp. */
 #define R300_GA_SOLID_RG                         0x427c
index 9301543d389d906873f0bf7dc3afd167e33f55a7..d4c3ecee6697f50a063491d61a25f82bb498eef4 100644 (file)
@@ -2253,6 +2253,14 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state)
                R300_STATECHANGE(r300, zb);
        }
 
+       if (new_state & (_NEW_LIGHT)) {
+               R300_STATECHANGE(r300, shade2);
+               if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION)
+                       r300->hw.shade2.cmd[1] |= R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST;
+               else
+                       r300->hw.shade2.cmd[1] &= ~R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST;
+       }
+
        r300->radeon.NewGLState |= new_state;
 }