st/mesa: only expose ARB_shader_bit_encoding with GLSL 1.3
[mesa.git] / src / mesa / state_tracker / st_program.c
index cebe39004b83a404d899eff1d077dde1cf1dc841..9f98298b4a099bd68cd111d05786427ec86dd7e2 100644 (file)
@@ -477,7 +477,7 @@ st_translate_fragment_program(struct st_context *st,
    GLuint inputMapping[FRAG_ATTRIB_MAX];
    GLuint interpMode[PIPE_MAX_SHADER_INPUTS];  /* XXX size? */
    GLuint attr;
-   const GLbitfield64 inputsRead = stfp->Base.Base.InputsRead;
+   GLbitfield64 inputsRead;
    struct ureg_program *ureg;
 
    GLboolean write_all = GL_FALSE;
@@ -531,6 +531,7 @@ st_translate_fragment_program(struct st_context *st,
    /*
     * Convert Mesa program inputs to TGSI input register semantics.
     */
+   inputsRead = stfp->Base.Base.InputsRead;
    for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) {
       if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
          const GLuint slot = fs_num_inputs++;
@@ -568,12 +569,12 @@ st_translate_fragment_program(struct st_context *st,
          case FRAG_ATTRIB_CLIP_DIST0:
             input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
             input_semantic_index[slot] = 0;
-            interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+            interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
             break;
          case FRAG_ATTRIB_CLIP_DIST1:
             input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
             input_semantic_index[slot] = 1;
-            interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+            interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
             break;
             /* In most cases, there is nothing special about these
              * inputs, so adopt a convention to use the generic
@@ -804,7 +805,7 @@ st_translate_geometry_program(struct st_context *st,
    GLuint outputMapping[GEOM_RESULT_MAX];
    struct pipe_context *pipe = st->pipe;
    GLuint attr;
-   const GLbitfield64 inputsRead = stgp->Base.Base.InputsRead;
+   GLbitfield64 inputsRead;
    GLuint vslot = 0;
    GLuint num_generic = 0;
 
@@ -844,6 +845,7 @@ st_translate_geometry_program(struct st_context *st,
    /*
     * Convert Mesa program inputs to TGSI input register semantics.
     */
+   inputsRead = stgp->Base.Base.InputsRead;
    for (attr = 0; attr < GEOM_ATTRIB_MAX; attr++) {
       if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
          const GLuint slot = gs_num_inputs;
@@ -1283,3 +1285,26 @@ st_destroy_program_variants(struct st_context *st)
    _mesa_HashWalk(st->ctx->Shared->ShaderObjects,
                   destroy_shader_program_variants_cb, st);
 }
+
+
+/**
+ * For debugging, print/dump the current vertex program.
+ */
+void
+st_print_current_vertex_program(void)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (ctx->VertexProgram._Current) {
+      struct st_vertex_program *stvp =
+         (struct st_vertex_program *) ctx->VertexProgram._Current;
+      struct st_vp_variant *stv;
+
+      debug_printf("Vertex program %u\n", stvp->Base.Base.Id);
+
+      for (stv = stvp->variants; stv; stv = stv->next) {
+         debug_printf("variant %p\n", stv);
+         tgsi_dump(stv->tgsi.tokens, 0);
+      }
+   }
+}