nv40: point sprites
authorBen Skeggs <skeggsb@gmail.com>
Sun, 25 Nov 2007 01:02:12 +0000 (12:02 +1100)
committerBen Skeggs <skeggsb@gmail.com>
Sun, 25 Nov 2007 01:02:12 +0000 (12:02 +1100)
src/mesa/drivers/dri/nouveau_winsys/nouveau_context.c
src/mesa/pipe/nv40/nv40_context.c
src/mesa/pipe/nv40/nv40_state.c
src/mesa/pipe/nv40/nv40_state.h

index 584d236f34947a5337ba5cb79fede0a3e5951895..67df43647aad798b6730413f786a4d67cf209bcc 100644 (file)
@@ -25,6 +25,7 @@
 #define need_GL_ARB_fragment_program
 #define need_GL_ARB_multisample
 #define need_GL_ARB_occlusion_query
+#define need_GL_ARB_point_parameters
 #define need_GL_ARB_texture_compression
 #define need_GL_ARB_vertex_program
 #define need_GL_ARB_vertex_buffer_object
@@ -44,6 +45,7 @@ const struct dri_extension nv40_extensions[] =
        { "GL_ARB_fragment_program", NULL },
        { "GL_ARB_multisample", GL_ARB_multisample_functions },
        { "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions },
+       { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
        { "GL_ARB_texture_border_clamp", NULL },
        { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
        { "GL_ARB_texture_cube_map", NULL },
index ba9d875e0eddd8abbfb63dd4521f36499c04b539..8706ed1c07cbde589025c4ae437e9320ffc16df3 100644 (file)
@@ -54,7 +54,7 @@ nv40_get_param(struct pipe_context *pipe, int param)
        case PIPE_CAP_ANISOTROPIC_FILTER:
                return 1;
        case PIPE_CAP_POINT_SPRITE:
-               return 0;
+               return 1;
        case PIPE_CAP_MAX_RENDER_TARGETS:
                return 4;
        case PIPE_CAP_OCCLUSION_QUERY:
index b1928a5f91a2cd20d43d5bd08801d6302fd234c8..1b8989b8443de4b38771b82034789e0f2acb40a5 100644 (file)
@@ -278,6 +278,7 @@ nv40_rasterizer_state_create(struct pipe_context *pipe,
                             const struct pipe_rasterizer_state *cso)
 {
        struct nv40_rasterizer_state *rs;
+       int i;
 
        /*XXX: ignored:
         *      light_twoside
@@ -326,6 +327,16 @@ nv40_rasterizer_state_create(struct pipe_context *pipe,
                break;
        }
 
+       if (cso->point_sprite) {
+               rs->point_sprite = (1 << 0);
+               for (i = 0; i < 8; i++) {
+                       if (cso->sprite_coord_mode[i] != PIPE_SPRITE_COORD_NONE)
+                               rs->point_sprite |= (1 << (8 + i));
+               }
+       } else {
+               rs->point_sprite = 0;
+       }
+
        return (void *)rs;
 }
 
@@ -358,6 +369,9 @@ nv40_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso)
 
        BEGIN_RING(curie, NV40TCL_POLYGON_STIPPLE_ENABLE, 1);
        OUT_RING  (rs->poly_stipple_en);
+
+       BEGIN_RING(curie, NV40TCL_POINT_SPRITE, 1);
+       OUT_RING  (rs->point_sprite);
 }
 
 static void
index d0114972ef2f01d9ba9605cdd2f1a161c0db36e2..c6d22ceaa8669e292bc8400bf22943c5413b7d01 100644 (file)
@@ -51,6 +51,7 @@ struct nv40_rasterizer_state {
        uint32_t cull_face;
        uint32_t cull_face_en;
 
+       uint32_t point_sprite;
 };
 
 struct nv40_vertex_program {