summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
Commit message (Collapse)AuthorAgeFilesLines
* mesa/program: remove dead function declarationsEmil Velikov2015-11-292-5/+0
| | | | | | | | | | | | Dead since 5e9aa9926b9 (2011) - _mesa_ir_compile_shader 69e07bdeb42 (2009) - _mesa_get_program_register Cc: Kenneth Graunke <[email protected]> Cc: Brian Paul <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Add ir_samples_identical opcodeIan Romanick2015-11-191-0/+2
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
* nir/info: Add a few bits of info for fragment shadersJason Ekstrand2015-10-191-0/+6
| | | | Reviewed-by: Topi Pohjolainen <[email protected]>
* nir: remove dependency on glslRob Clark2015-10-163-2/+3
| | | | | | | | | | | | | | | Move glsl_types into NIR, now that the dependency on glsl_symbol_table has been split out. Possibly makes sense to rename things at this point, but if we do that I'd like to keep it split out into a separate patch to make git history easier to follow (IMHO). v2: fix android build v3: I f***ing hate scons.. but at least it builds Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Rob Clark <[email protected]>
* nir/prog: Don't double-insert the fog-coord variableJason Ekstrand2015-10-151-3/+2
| | | | | | | nir_variable_create already inserts it in the right list for us so inserting it again causes a linked list corruption. Reviewed-by: Matt Turner <[email protected]>
* nir: Add helpers for creating variables and adding them to listsJason Ekstrand2015-10-151-12/+7
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* nir/prog: Use nir_foreach_variableJason Ekstrand2015-10-151-1/+1
| | | | | Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* program: convert _mesa_init_gl_program() to take struct gl_program *Emil Velikov2015-10-152-30/+27
| | | | | | | | Rather than accepting a void pointer, only to down and up cast around it, convert the function to take the base (struct gl_program) pointer. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: remove unused functions in program.cBrian Paul2015-10-141-51/+0
| | | | | | replace_registers() and adjust_param_indexes() were unused. Reviewed-by: Matt Turner <[email protected]>
* program: remove _mesa_init_*_program wrappersMarek Olšák2015-10-092-143/+19
| | | | | | | They didn't do anything useful. Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* program: remove other unused functionsMarek Olšák2015-10-092-143/+0
| | | | | Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* program: remove unused cloning and combining functionsMarek Olšák2015-10-092-294/+0
| | | | | Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* program: remove unused function _mesa_find_line_columnMarek Olšák2015-10-092-48/+0
| | | | | Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* glsl: reduce memory footprint of uniform_storage structTimothy Arceri2015-10-052-4/+5
| | | | | | | | The uniform will only be of a single type so store the data for opaque types in a single array. Cc: Francisco Jerez <[email protected]> Cc: Ilia Mirkin <[email protected]>
* nir: Add a a nir_shader_info structJason Ekstrand2015-10-021-0/+13
| | | | | | This commit also adds code to glsl_to_nir and prog_to_nir to fill it out. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: avoid leaking closure when iterating over a string_to_uint_mapIlia Mirkin2015-10-021-0/+1
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* mesa: clean up #includes in sampler.cppBrian Paul2015-10-011-6/+5
| | | | Reviewed-by: Tapani Pälli <[email protected]>
* mesa: clean up #includes in ir_to_mesa.cppBrian Paul2015-10-011-12/+10
| | | | Reviewed-by: Tapani Pälli <[email protected]>
* mesa: Add locking to programs.Matt Turner2015-09-251-8/+11
| | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Remove debugging code from _mesa_reference_*.Matt Turner2015-09-251-14/+0
| | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* glsl: Add parser/compiler support for unsized array's length()Samuel Iglesias Gonsalvez2015-09-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The unsized array length is computed with the following formula: array.length() = max((buffer_object_size - offset_of_array) / stride_of_array, 0) Of these, only the buffer size needs to be provided by the backends, the frontend already knows the values of the two other variables. This patch identifies the cases where we need to get the length of an unsized array, injecting ir_unop_ssbo_unsized_array_length expressions that will be lowered (in a later patch) to inject the formula mentioned above. It also adds the ir_unop_get_buffer_size expression that drivers will implement to provide the buffer length. v2: - Do not define a triop that will force backends to implement the entire formula, they should only need to provide the buffer size since the other values are known by the frontend (Curro). v3: - Call state->has_shader_storage_buffer_objects() in ast_function.cpp instead of using state->ARB_shader_storage_buffer_object_enable (Tapani). Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* prog_to_nir: Use nir_op_dphJason Ekstrand2015-09-221-2/+1
| | | | | | | | | Shader-db results on HSW: instructions in affected programs: 72 -> 56 (-22.22%) Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add ir_texture_samples texture opcodeIlia Mirkin2015-09-101-0/+2
| | | | | | | | Will be used for textureSamples() Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Resolve GCC sign-compare warning.Rhys Kidd2015-09-101-1/+1
| | | | | | | | | | | | mesa/src/mesa/program/prog_to_nir.c: In function 'setup_registers_and_variables': /mesa/src/mesa/program/prog_to_nir.c:1059:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < c->prog->NumTemporaries; i++) { ^ Signed-off-by: Rhys Kidd <[email protected]> Reviewed-by: Thomas Helland <[email protected]> Reviewed-by: Jan Vesely <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glsl: Silence unused parameter warningsIan Romanick2015-09-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | builtin_variables.cpp:1062:53: warning: unused parameter 'name_as_gs_input' [-Wunused-parameter] const char *name_as_gs_input) ^ builtin_functions.cpp:4774:47: warning: unused parameter 'intrinsic_name' [-Wunused-parameter] const char *intrinsic_name, ^ builtin_functions.cpp:4907:66: warning: unused parameter 'state' [-Wunused-parameter] _mesa_glsl_find_builtin_function_by_name(_mesa_glsl_parse_state *state, ^ builtin_functions.cpp:4915:49: warning: unused parameter 'num_arguments' [-Wunused-parameter] unsigned num_arguments, ^ builtin_functions.cpp:4916:49: warning: unused parameter 'flags' [-Wunused-parameter] unsigned flags) ^ ir_print_visitor.cpp:589:37: warning: unused parameter 'ir' [-Wunused-parameter] ir_print_visitor::visit(ir_barrier *ir) ^ linker.cpp:3212:48: warning: unused parameter 'ctx' [-Wunused-parameter] build_program_resource_list(struct gl_context *ctx, ^ standalone_scaffolding.cpp:65:57: warning: unused parameter ‘id’ [-Wunused-parameter] _mesa_shader_debug(struct gl_context *, GLenum, GLuint *id, ^ v2: Rebase on top of GL_ARB_shader_image_size work (especially 58a86897). Silence more warnings added by that work. v3: Remove mention of the removed parameter from comments. Suggested by Iago. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> [v1] Reviewed-by: Iago Toral Quiroga <[email protected]> Cc: "Martin Peres <[email protected]>"
* nir: Convert the builder to use the new NIR cursor API.Kenneth Graunke2015-08-271-1/+1
| | | | | | | | | | | | | | | | | | The NIR cursor API is exactly what we want for the builder's insertion point. This simplifies the API, the implementation, and is actually more flexible as well. This required a bit of reworking of TGSI->NIR's if/loop stack handling; we now store cursors instead of cf_node_lists, for better or worse. v2: Actually move the cursor in the after_instr case. v3: Take advantage of nir_instr_insert (suggested by Connor). v4: vc4 build fixes (thanks to Eric). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> [v1] Reviewed-by: Jason Ekstrand <[email protected]> [v4] Acked-by: Connor Abbott <[email protected]> [v4]
* prog_to_nir: Use nir_builder_insert() rather than poking at cf_list.Kenneth Graunke2015-08-251-11/+11
| | | | | | | | | I intend to remove nir_builder::cf_node_list, so I can't have this code poking at it directly. The proper way is to set the insertion point and then simply insert things there. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* nir: Store gl_shader_stage in nir_shader.Kenneth Graunke2015-08-251-1/+3
| | | | | | | | | | | | This makes it easy for NIR passes to inspect what kind of shader they're operating on. Thanks to Michel Dänzer for helping me figure out where TGSI stores the shader stage information. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* prog_to_nir: Don't allocate nir_variable with type vec4[0] for uniforms.Kenneth Graunke2015-08-251-7/+11
| | | | | | | | | | | If there are no parameters, we don't need to create a nir_variable to hold them...and allocating an array of length 0 is pretty bogus. Should avoid i965 backend assertions in future patches Jason and I are working on. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* program: Avoid double promotion.Matt Turner2015-07-291-15/+15
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* program: Use exp2(x) instead of pow(2.0, x).Matt Turner2015-07-291-2/+2
|
* program: add subroutine uniform support (v1.1)Dave Airlie2015-07-231-0/+3
| | | | | | | | | Add support for the subroutine uniform type ir->mesa.cpp v1.1: add subroutine to int to switch Acked-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: don't lower variable indexing on non-patch tessellation inputs/outputsMarek Olšák2015-07-231-1/+1
| | | | | | | | | | | | There is no way to lower them, because the array sizes are unknown at compile time. Based on a patch from: Fabian Bieler <[email protected]> v2: add comments Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: add tessellation shader defines and built-in variables.Fabian Bieler2015-07-231-0/+4
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: add misc tessellation shader supportFabian Bieler2015-07-232-1/+88
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: add tessellation shader init functions.Fabian Bieler2015-07-232-0/+42
| | | | | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: add tessellation shader enumsFabian Bieler2015-07-232-0/+14
| | | | | | | Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* program: Allow redundant OPTION ARB_fog_* directives.Kenneth Graunke2015-07-161-13/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A fragment program from "Pixel Piracy" contains redundant OPTION directives: !!ARBfp1.0 OPTION ARB_precision_hint_fastest; OPTION ARB_fog_exp2; OPTION ARB_precision_hint_fastest; OPTION ARB_fog_exp2; ... We already allow redundant ARB_precision_hint_fastest directives, but disallow the redundant (yet consistent) ARB_fog_exp2 directives, failing to compile the program. The specification seems to contradict itself - the main text says that only one fog application option may be specified, but then backpedals, indicating the intent is to disallow /contradictory/ flags. One of the issues suggests that specifying contradictory ones is stupid, but allowed, and only the last one should take effect. Accepting multiple redundant (but consistent) directives seems harmless, and like a reasonable interpretation of the specification. It also fixes a fragment program found in the wild. Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: rename is_in_uniform_block to is_in_buffer_blockIago Toral Quiroga2015-07-141-1/+1
| | | | | | | Since this now checks if a variable is inside a uniform or a shader storage block. Reviewed-by: Jordan Justen <[email protected]>
* mesa/prog: relative offsets into constbufs are not constantIlia Mirkin2015-07-021-0/+2
| | | | | | | | | | | The optimization logic relies on being able to read out constbuf values from program parameters. However that only works if there's no relative addressing involved. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91173 Signed-off-by: Ilia Mirkin <[email protected]> Cc: "10.5 10.6" <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
* glsl: create program resource list after LinkShaderTapani Pälli2015-07-011-0/+2
| | | | | | | | | Resource list can be created properly only after LinkShader hook has been called to make sure all dead variables have been removed. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Martin Peres <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90925
* glsl: Add ir node for barrierChris Forbes2015-06-121-0/+7
| | | | | | | | | v2: * Changes suggested by mattst88 [[email protected]: Add nir support] Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ben Widawsky <[email protected]>
* mesa; add a dummy _mesa_error_no_memory() symbol to libglsl_utilEmil Velikov2015-06-121-0/+30
| | | | | | | | | | | | Rather than forcing everyone to provide their own definition of the symbol provide a common (dummy) one. This helps us resolve the build of the standalone pipe-drivers (amongst others), which are missing the symbol. Cc: Rob Clark <[email protected]> Cc: "10.6" <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* prog_to_nir: Fix fragment depth writes.Kenneth Graunke2015-06-061-3/+19
| | | | | | | | | | | | | | | | | | | In the ARB_fragment_program specification, the result.depth output variable is treated as a vec4, where the fragment depth is stored in the .z component, and the other three components are undefined. This is different than GLSL, which uses a scalar value (gl_FragDepth). To make this consistent for driver backends, this patch makes prog_to_nir use a scalar output variable for FRAG_RESULT_DEPTH, moving result.depth.z into the first component. Fixes Glean's fragProg1 "Z-write test" subtest. Cc: [email protected] Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90000 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: use GL_GEOMETRY_PROGRAM_NV instead of MESA_GEOMETRY_PROGRAMMarek Olšák2015-06-052-7/+7
| | | | | | | | There's no reason to use our own definition. Tessellation will use the NV definitions too. Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove useless gl_compute_program_state::CurrentMarek Olšák2015-06-051-3/+0
| | | | | | | This is for user assembly shaders only (not GLSL). We won't support those. Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove unused geometry shader variablesMarek Olšák2015-06-051-9/+0
| | | | | | | These states are for GS assembly shaders only. We don't support those. Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* prog_to_nir: Make RSQ properly take the absolute value of its argument.Kenneth Graunke2015-06-041-1/+2
| | | | | | | | | | | | | | | | | I just botched this when writing the original code. From the ARB_vertex_program specification: "The RSQ instruction approximates the reciprocal of the square root of the absolute value of the scalar operand and replicates it to all four components of the result vector." Fixes a Glean vertProg1 subtest: RSQ test 2 (reciprocal square root of negative value) Cc: [email protected] Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90547 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* main: fix a regression in uniform handling introduced by 87a4bc5Martin Peres2015-06-041-1/+1
| | | | | | | | The comment was accurate but the condition was reversed... Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Signed-off-by: Martin Peres <[email protected]>
* mesa: reference built-in uniforms into gl_uniform_storageMartin Peres2015-06-041-2/+7
| | | | | | | | | | | | | | | This change introduces a new field in gl_uniform_storage to explicitely say that a uniform is built-in. In the case where it is, no storage is defined to make it clear that it is read-only from the mesa side. I fixed all the places in the code that made use of the structure that I changed. Any place making a wrong assumption and using the storage straight away will just crash. This patch seems to implement the path of least resistance towards listing built-in uniforms in GL_ACTIVE_UNIFORM (and other APIs). Reviewed-by: Tapani Pälli <[email protected]> Signed-off-by: Martin Peres <[email protected]>