r3xx/r5xx: Enable ARB_point_parameters.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 30 Jun 2008 18:12:51 +0000 (11:12 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 30 Jun 2008 18:12:51 +0000 (11:12 -0700)
This isn't complete yet. It does cover the two most common usage cases,
though, and at least the third one (POINT_DISTANCE_ATTENUATION) is possible,
so I'll do that later.

src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r300/r300_state.c

index 44c368030f6e22fde6cae88d02f6d02849f05f68..a9c581b236efb5611c70c576e5b2f8d3eaa2d3a2 100644 (file)
@@ -79,6 +79,7 @@ int hw_tcl_on = 1;
 
 #define need_GL_EXT_stencil_two_side
 #define need_GL_ARB_multisample
+#define need_GL_ARB_point_parameters
 #define need_GL_ARB_texture_compression
 #define need_GL_ARB_vertex_buffer_object
 #define need_GL_ARB_vertex_program
@@ -98,6 +99,7 @@ const struct dri_extension card_extensions[] = {
   {"GL_ARB_fragment_program",          NULL},
   {"GL_ARB_multisample",               GL_ARB_multisample_functions},
   {"GL_ARB_multitexture",              NULL},
+  {"GL_ARB_point_parameters",          GL_ARB_point_parameters_functions},
   {"GL_ARB_shadow",                    NULL},
   {"GL_ARB_texture_border_clamp",      NULL},
   {"GL_ARB_texture_compression",       GL_ARB_texture_compression_functions},
index f6f0c39066259a452553ff10e3bc6df824a47112..592ee9ccc1024e473b0c40ef1f9aa9fb59bc3679 100644 (file)
@@ -827,6 +827,31 @@ static void r300PointSize(GLcontext * ctx, GLfloat size)
            ((int)(size * 6) << R300_POINTSIZE_Y_SHIFT);
 }
 
+static void r300PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * param)
+{
+       r300ContextPtr r300 = R300_CONTEXT(ctx);
+
+       switch (pname) {
+       case GL_POINT_SIZE_MIN:
+               R300_STATECHANGE(r300, ga_point_minmax);
+               r300->hw.ga_point_minmax.cmd[1] &= ~R300_GA_POINT_MINMAX_MIN_MASK;
+               r300->hw.ga_point_minmax.cmd[1] |= (GLuint)(ctx->Point.MinSize * 16.0);
+               break;
+       case GL_POINT_SIZE_MAX:
+               R300_STATECHANGE(r300, ga_point_minmax);
+               r300->hw.ga_point_minmax.cmd[1] &= ~R300_GA_POINT_MINMAX_MAX_MASK;
+               r300->hw.ga_point_minmax.cmd[1] |= (GLuint)(ctx->Point.MaxSize * 16.0)
+                       << R300_GA_POINT_MINMAX_MAX_SHIFT;
+               break;
+       case GL_POINT_DISTANCE_ATTENUATION:
+               break;
+       case GL_POINT_FADE_THRESHOLD_SIZE:
+               break;
+       default:
+               break;
+       }
+}
+
 /* =============================================================
  * Line state
  */
@@ -2706,6 +2731,9 @@ void r300InitStateFuncs(struct dd_function_table *functions)
        functions->FrontFace = r300FrontFace;
        functions->ShadeModel = r300ShadeModel;
 
+       /* ARB_point_parameters */
+       functions->PointParameterfv = r300PointParameter;
+
        /* Stencil related */
        functions->StencilFuncSeparate = r300StencilFuncSeparate;
        functions->StencilMaskSeparate = r300StencilMaskSeparate;