2 * Copyright © 2011 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
29 /* stdbool.h is necessary because this file is included in both C and C++ code.
33 #include "program/prog_parameter.h" /* For union gl_constant_value. */
36 * Used by GL_ARB_explicit_uniform_location extension code in the linker
37 * and glUniform* functions to identify inactive explicit uniform locations.
39 #define INACTIVE_UNIFORM_EXPLICIT_LOCATION ((gl_uniform_storage *) -1)
45 enum PACKED gl_uniform_driver_format
{
46 uniform_native
= 0, /**< Store data in the native format. */
47 uniform_int_float
, /**< Store integer data as floats. */
50 struct gl_uniform_driver_storage
{
52 * Number of bytes from one array element to the next.
54 uint8_t element_stride
;
57 * Number of bytes from one vector in a matrix to the next.
59 uint8_t vector_stride
;
62 * Base format of the stored data.
64 enum gl_uniform_driver_format format
;
67 * Pointer to the base of the data.
72 struct gl_opaque_uniform_index
{
74 * Base opaque uniform index
76 * If \c gl_uniform_storage::base_type is an opaque type, this
77 * represents its uniform index. If \c
78 * gl_uniform_storage::array_elements is not zero, the array will
79 * use opaque uniform indices \c index through \c index + \c
80 * gl_uniform_storage::array_elements - 1, inclusive.
82 * Note that the index may be different in each shader stage.
87 * Whether this opaque uniform is used in this shader stage.
92 struct gl_uniform_storage
{
94 /** Type of this uniform data stored.
96 * In the case of an array, it's the type of a single array element.
98 const struct glsl_type
*type
;
101 * The number of elements in this uniform.
103 * For non-arrays, this is always 0. For arrays, the value is the size of
106 unsigned array_elements
;
109 * Has this uniform ever been set?
113 struct gl_opaque_uniform_index sampler
[MESA_SHADER_STAGES
];
115 struct gl_opaque_uniform_index image
[MESA_SHADER_STAGES
];
118 * Storage used by the driver for the uniform
120 unsigned num_driver_storage
;
121 struct gl_uniform_driver_storage
*driver_storage
;
124 * Storage used by Mesa for the uniform
126 * This form of the uniform is used by Mesa's implementation of \c
127 * glGetUniform. It can also be used by drivers to obtain the value of the
128 * uniform if the \c ::driver_storage interface is not used.
130 union gl_constant_value
*storage
;
132 /** Fields for GL_ARB_uniform_buffer_object
137 * GL_UNIFORM_BLOCK_INDEX: index of the uniform block containing
138 * the uniform, or -1 for the default uniform block. Note that the
139 * index is into the linked program's UniformBlocks[] array, not
140 * the linked shader's.
144 /** GL_UNIFORM_OFFSET: byte offset within the uniform block, or -1. */
148 * GL_UNIFORM_MATRIX_STRIDE: byte stride between columns or rows of
149 * a matrix. Set to 0 for non-matrices in UBOs, or -1 for uniforms
150 * in the default uniform block.
155 * GL_UNIFORM_ARRAY_STRIDE: byte stride between elements of the
156 * array. Set to zero for non-arrays in UBOs, or -1 for uniforms
157 * in the default uniform block.
161 /** GL_UNIFORM_ROW_MAJOR: true iff it's a row-major matrix in a UBO */
167 * Index within gl_shader_program::AtomicBuffers[] of the atomic
168 * counter buffer this uniform is stored in, or -1 if this is not
171 int atomic_buffer_index
;
174 * The 'base location' for this uniform in the uniform remap table. For
175 * arrays this is the first element in the array.
177 unsigned remap_location
;
180 * This is a compiler-generated uniform that should not be advertised
190 #endif /* IR_UNIFORM_H */