Merge remote branch 'vdpau/pipe-video' into pipe-video
[mesa.git] / src / mesa / state_tracker / st_draw.c
index 318e08886c7e6cb73af2a37b771f7a5bd67b75b6..f4bf1802390cef7cd7959af14a96237253e72dad 100644 (file)
@@ -241,7 +241,7 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
  */
 static GLboolean
 is_interleaved_arrays(const struct st_vertex_program *vp,
-                      const struct st_vp_varient *vpv,
+                      const struct st_vp_variant *vpv,
                       const struct gl_client_array **arrays,
                       GLboolean *userSpace)
 {
@@ -297,7 +297,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp,
  */
 static void
 get_arrays_bounds(const struct st_vertex_program *vp,
-                  const struct st_vp_varient *vpv,
+                  const struct st_vp_variant *vpv,
                   const struct gl_client_array **arrays,
                   GLuint max_index,
                   const GLubyte **low, const GLubyte **high)
@@ -341,9 +341,9 @@ get_arrays_bounds(const struct st_vertex_program *vp,
  * \param velements  returns vertex element info
  */
 static void
-setup_interleaved_attribs(GLcontext *ctx,
+setup_interleaved_attribs(struct gl_context *ctx,
                           const struct st_vertex_program *vp,
-                          const struct st_vp_varient *vpv,
+                          const struct st_vp_variant *vpv,
                           const struct gl_client_array **arrays,
                           GLuint max_index,
                           GLboolean userSpace,
@@ -407,9 +407,9 @@ setup_interleaved_attribs(GLcontext *ctx,
  * \param velements  returns vertex element info
  */
 static void
-setup_non_interleaved_attribs(GLcontext *ctx,
+setup_non_interleaved_attribs(struct gl_context *ctx,
                               const struct st_vertex_program *vp,
-                              const struct st_vp_varient *vpv,
+                              const struct st_vp_variant *vpv,
                               const struct gl_client_array **arrays,
                               GLuint max_index,
                               GLboolean *userSpace,
@@ -496,7 +496,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
 
 
 static void
-setup_index_buffer(GLcontext *ctx,
+setup_index_buffer(struct gl_context *ctx,
                    const struct _mesa_index_buffer *ib,
                    struct pipe_index_buffer *ibuffer)
 {
@@ -545,13 +545,23 @@ setup_index_buffer(GLcontext *ctx,
  * issue a warning.
  */
 static void
-check_uniforms(GLcontext *ctx)
+check_uniforms(struct gl_context *ctx)
 {
-   const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
-   if (shProg && shProg->LinkStatus) {
-      GLuint i;
-      for (i = 0; i < shProg->Uniforms->NumUniforms; i++) {
-         const struct gl_uniform *u = &shProg->Uniforms->Uniforms[i];
+   struct gl_shader_program *shProg[3] = {
+      ctx->Shader.CurrentVertexProgram,
+      ctx->Shader.CurrentGeometryProgram,
+      ctx->Shader.CurrentFragmentProgram,
+   };
+   unsigned j;
+
+   for (j = 0; j < 3; j++) {
+      unsigned i;
+
+      if (shProg[j] == NULL || !shProg[j]->LinkStatus)
+        continue;
+
+      for (i = 0; i < shProg[j]->Uniforms->NumUniforms; i++) {
+         const struct gl_uniform *u = &shProg[j]->Uniforms->Uniforms[i];
          if (!u->Initialized) {
             _mesa_warning(ctx,
                           "Using shader with uninitialized uniform: %s",
@@ -567,7 +577,7 @@ check_uniforms(GLcontext *ctx)
  * the corresponding Gallium type.
  */
 static unsigned
-translate_prim(const GLcontext *ctx, unsigned prim)
+translate_prim(const struct gl_context *ctx, unsigned prim)
 {
    /* GL prims should match Gallium prims, spot-check a few */
    assert(GL_POINTS == PIPE_PRIM_POINTS);
@@ -595,7 +605,7 @@ translate_prim(const GLcontext *ctx, unsigned prim)
  * Basically, translate the information into the format expected by gallium.
  */
 void
-st_draw_vbo(GLcontext *ctx,
+st_draw_vbo(struct gl_context *ctx,
             const struct gl_client_array **arrays,
             const struct _mesa_prim *prims,
             GLuint nr_prims,
@@ -607,7 +617,7 @@ st_draw_vbo(GLcontext *ctx,
    struct st_context *st = st_context(ctx);
    struct pipe_context *pipe = st->pipe;
    const struct st_vertex_program *vp;
-   const struct st_vp_varient *vpv;
+   const struct st_vp_variant *vpv;
    struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
    GLuint attr;
    struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
@@ -640,7 +650,7 @@ st_draw_vbo(GLcontext *ctx,
 
    /* must get these after state validation! */
    vp = st->vp;
-   vpv = st->vp_varient;
+   vpv = st->vp_variant;
 
 #if 0
    if (MESA_VERBOSE & VERBOSE_GLSL) {
@@ -703,6 +713,9 @@ st_draw_vbo(GLcontext *ctx,
       }
    }
 
+   info.primitive_restart = st->ctx->Array.PrimitiveRestart;
+   info.restart_index = st->ctx->Array.RestartIndex;
+
    /* do actual drawing */
    for (i = 0; i < nr_prims; i++) {
       info.mode = translate_prim( ctx, prims[i].mode );
@@ -736,7 +749,7 @@ st_draw_vbo(GLcontext *ctx,
 
 void st_init_draw( struct st_context *st )
 {
-   GLcontext *ctx = st->ctx;
+   struct gl_context *ctx = st->ctx;
 
    vbo_set_draw_func(ctx, st_draw_vbo);