glsl: Change _mesa_glsl_parse_state ctor to use gl_shader_stage enum.
[mesa.git] / src / mesa / main / uniforms.h
index 287d7106bb6e43fa18fadf6935b5900ec9693b08..f7cac63286b697d5059ee8a052738f4c8aca4831 100644 (file)
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 
@@ -141,6 +142,9 @@ _mesa_UniformBlockBinding(GLuint program,
                          GLuint uniformBlockIndex,
                          GLuint uniformBlockBinding);
 void GLAPIENTRY
+_mesa_GetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex,
+                                     GLenum pname, GLint *params);
+void GLAPIENTRY
 _mesa_GetActiveUniformBlockiv(GLuint program,
                              GLuint uniformBlockIndex,
                              GLenum pname,
@@ -167,6 +171,10 @@ _mesa_GetActiveUniformsiv(GLuint program,
 void GLAPIENTRY
 _mesa_GetUniformiv(GLhandleARB, GLint, GLint *);
 
+long
+_mesa_parse_program_resource_name(const GLchar *name,
+                                  const GLchar **out_base_name_end);
+
 unsigned
 _mesa_get_uniform_location(struct gl_context *ctx, struct gl_shader_program *shProg,
                           const GLchar *name, unsigned *offset);
@@ -213,6 +221,11 @@ _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg,
 extern const struct gl_program_parameter *
 get_uniform_parameter(struct gl_shader_program *shProg, GLint index);
 
+extern void
+_mesa_get_uniform_name(const struct gl_uniform_storage *uni,
+                       GLsizei maxLength, GLsizei *length,
+                       GLchar *nameOut);
+
 struct gl_builtin_uniform_element {
    const char *field;
    int tokens[STATE_LENGTH];
@@ -259,20 +272,24 @@ struct gl_builtin_uniform_desc {
  * Combine the uniform's base location and the offset
  */
 static inline GLint
-_mesa_uniform_merge_location_offset(unsigned base_location, unsigned offset)
+_mesa_uniform_merge_location_offset(const struct gl_shader_program *prog,
+                                    unsigned base_location, unsigned offset)
 {
-   return (base_location << 16) | offset;
+   assert(prog->UniformLocationBaseScale >= 1);
+   assert(offset < prog->UniformLocationBaseScale);
+   return (base_location * prog->UniformLocationBaseScale) + offset;
 }
 
 /**
  * Separate the uniform base location and parameter offset
  */
 static inline void
-_mesa_uniform_split_location_offset(GLint location, unsigned *base_location,
+_mesa_uniform_split_location_offset(const struct gl_shader_program *prog,
+                                    GLint location, unsigned *base_location,
                                    unsigned *offset)
 {
-   *offset = location & 0xffff;
-   *base_location = location >> 16;
+   *offset = location % prog->UniformLocationBaseScale;
+   *base_location = location / prog->UniformLocationBaseScale;
 }
 /*@}*/