summaryrefslogtreecommitdiff
path: root/src/glsl/ir_uniform.h
AgeCommit message (Collapse)AuthorFilesLines
2014-11-06glsl: Add infrastructure for "hidden" uniforms.Kenneth Graunke1-0/+6
In the compiler, we'd like to generate implicit uniforms for internal use. These should not be visible via the GL uniform introspection API. To support that, we add a new ir_variable::how_declared value of ir_var_hidden, and plumb that through to gl_uniform_storage. v2 (idr): Fix some memory management issues in move_hidden_uniforms_to_end. The comment block on the function has more details. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2014-10-21glsl: Delete unused gl_uniform_driver_format enum values.Kenneth Graunke1-11/+0
A while back, Matt made the uniform upload functions simply upload ctx->Const.UniformBooleanTrue for boolean values instead of 0/1, which removed the need to convert it later. We also set UniformBooleanTrue to 1.0f for drivers which want to treat booleans as 0.0/1.0f. Nothing ever sets these, so they are dead. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-06-16glsl/linker: initialize explicit uniform locationsTapani Pälli1-0/+5
Patch initializes the UniformRemapTable for explicit locations. This needs to happen before optimizations to make sure all inactive uniforms get their explicit locations correctly. v2: fix initialization bug, introduce define for inactive uniforms (Ian) Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-06-11glsl: Store gl_uniform_driver_storage::format as the actual typeIan Romanick1-5/+2
And delete the incorrect comment. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
2014-03-10mesa/glsl: introduce a remap table for uniform locationsTapani Pälli1-0/+6
Patch adds a remap table for uniforms that is used to provide a mapping from application specified uniform location to actual location in the UniformStorage. Existing UniformLocationBaseScale usage is removed as table can be used to set sequential values for array uniform elements. This mapping helps to implement GL_ARB_explicit_uniform_location so that uniforms locations can be reorganized and handled in a more easy manner. v2: small fixes + rename parameters for merge and split functions (Ian) improve documentation, remove old check for location bounds (Eric) Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2014-02-12glsl: Add gl_uniform_storage fields to keep track of image uniform indices.Francisco Jerez1-18/+23
v2: Promote anonymous struct into named struct. Reviewed-by: Paul Berry <stereotype441@gmail.com>
2014-01-08mesa: Clean up nomenclature for pipeline stages.Paul Berry1-1/+1
Previously, we had an enum called gl_shader_type which represented pipeline stages in the order they occur in the pipeline (i.e. MESA_SHADER_VERTEX=0, MESA_SHADER_GEOMETRY=1, etc), and several inconsistently named functions for converting between it and other representations: - _mesa_shader_type_to_string: gl_shader_type -> string - _mesa_shader_type_to_index: GLenum (GL_*_SHADER) -> gl_shader_type - _mesa_program_target_to_index: GLenum (GL_*_PROGRAM) -> gl_shader_type - _mesa_shader_enum_to_string: GLenum (GL_*_{SHADER,PROGRAM}) -> string This patch tries to clean things up so that we use more consistent terminology: the enum is now called gl_shader_stage (to emphasize that it is in the order of pipeline stages), and the conversion functions are: - _mesa_shader_stage_to_string: gl_shader_stage -> string - _mesa_shader_enum_to_shader_stage: GLenum (GL_*_SHADER) -> gl_shader_stage - _mesa_program_enum_to_shader_stage: GLenum (GL_*_PROGRAM) -> gl_shader_stage - _mesa_progshader_enum_to_string: GLenum (GL_*_{SHADER,PROGRAM}) -> string In addition, MESA_SHADER_TYPES has been renamed to MESA_SHADER_STAGES, for consistency with the new name for the enum. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> v2: Also rename the "target" field of _mesa_glsl_parse_state and the "target" parameter of _mesa_shader_stage_to_string to "stage". Reviewed-by: Brian Paul <brianp@vmware.com>
2013-10-29mesa: Add support for ARB_shader_atomic_counters.Francisco Jerez1-0/+7
This patch implements the common support code required for the ARB_shader_atomic_counters extension. It defines the necessary data structures for tracking atomic counter buffer objects (from now on "ABOs") associated with some specific context or shader program, it implements support for binding buffers to an ABO binding point and querying the existing atomic counters and buffers declared by GLSL shaders. v2: Fix extension checks. Drop unused MAX_ATOMIC_BUFFERS constant. Acked-by: Paul Berry <stereotype441@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-05-28mesa: fix GLSL program objects with more than 16 samplers combinedMarek Olšák1-9/+18
The problem is the sampler units are allocated from the same pool for all shader stages, so if a vertex shader uses 12 samplers (0..11), the fragment shader samplers start at index 12, leaving only 4 sampler units for the fragment shader. The main cause is probably the fact that samplers (texture unit -> sampler unit mapping, etc.) are tracked globally for an entire program object. This commit adapts the GLSL linker and core Mesa such that the sampler units are assigned to sampler uniforms for each shader stage separately (if a sampler uniform is used in all shader stages, it may occupy a different sampler unit in each, and vice versa, an i-th sampler unit may refer to a different sampler uniform in each shader stage), and the sampler-specific variables are moved from gl_shader_program to gl_shader. This doesn't require any driver changes, and it fixes piglit/max-samplers for gallium and classic swrast. It also works with any number of shader stages. v2: - converted tabs to spaces - added an assertion to _mesa_get_sampler_uniform_value Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2012-12-28glsl: Add a note about a surprising feature of gl_uniform_storage->type.Eric Anholt1-0/+4
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-07-20glsl: Propagate uniform block information into gl_uniform_storage.Eric Anholt1-0/+34
Now we can actually return information on uniforms in uniform blocks in the new queries. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-11-09mesa,glsl,mapi: Put extern "C" { ... } where appropriate.José Fonseca1-3/+6
Probably a several places missing, but enough to cover all headers (in)directly included by uniform_query.cpp, and fix the MSVC build.
2011-11-08glsl: remove trailing comma to silence warningBrian Paul1-1/+1
2011-11-07glsl: Add new structures for tracking uniforms in linked shadersIan Romanick1-0/+125
v2: Update some comments based on feedback from Eric Anholt. v3: Remove gl_uniform_storage::dirty field. Make gl_uniform_storage::initialized be bool, and make gl_uniform_storage::sampler be uint8_t. v4: Include stdbool.h after Tom Stellard noticed a build failure that was introduced by the changes in v2. Oops. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Tested-by: Tom Stellard <thomas.stellard@amd.com>