summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* nir: convert glsl imageSamples into a new intrinsicIlia Mirkin2015-09-102-1/+7
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add support for the imageSamples functionIlia Mirkin2015-09-101-3/+40
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add support for the textureSamples functionIlia Mirkin2015-09-101-0/+31
| | | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add ARB_shader_texture_image_samples infrastructureIlia Mirkin2015-09-103-0/+6
| | | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: add nir_texop_texture_samples and convert from glslIlia Mirkin2015-09-103-1/+11
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add ir_texture_samples texture opcodeIlia Mirkin2015-09-109-6/+19
| | | | | | | | Will be used for textureSamples() Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Resolve GCC sign-compare warning.Rhys Kidd2015-09-103-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mesa/src/glsl/nir/nir_lower_tex_projector.c: In function 'nir_lower_tex_projector_block': mesa/src/glsl/nir/nir_lower_tex_projector.c:63:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < tex->num_srcs; i++) { ^ mesa/src/glsl/nir/nir_lower_tex_projector.c: In function 'nir_lower_tex_projector_block': mesa/src/glsl/nir/nir_lower_tex_projector.c:114:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = proj_index + 1; i < tex->num_srcs; i++) { ^ mesa/src/glsl/nir/nir_lower_tex_projector.c: In function 'nir_lower_tex_projector_block': mesa/src/glsl/nir/nir_lower_tex_projector.c:53:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (proj_index = 0; proj_index < tex->num_srcs; proj_index++) { ^ mesa/src/glsl/nir/nir_lower_tex_projector.c:57:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (proj_index == tex->num_srcs) ^ mesa/src/glsl/nir/nir_search.c: In function 'match_value': mesa/src/glsl/nir/nir_search.c:84:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < num_components; ++i) ^ mesa/src/glsl/nir/nir_search.c: In function 'match_value': mesa/src/glsl/nir/nir_search.c:110:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < num_components; ++i) { ^ mesa/src/glsl/nir/nir_search.c: In function 'match_value': mesa/src/glsl/nir/nir_search.c:139:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (i < num_components) ^ mesa/src/glsl/nir/nir_opt_peephole_ffma.c: In function 'get_mul_for_src': mesa/src/glsl/nir/nir_opt_peephole_ffma.c:130:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (unsigned i = 0; i < num_components; 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: Remove ADD_VARYING macroIan Romanick2015-09-091-15/+12
| | | | | | | | | The purpose of the macro was to create the name_as_gs_input from name. The previous commit removed the name_as_gs_input from add_varying, so the macro is unnecessary. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: Silence unused parameter warningsIan Romanick2015-09-098-26/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/glsl: Use lower_outputs_to_temporaries instead of relying on GLSL IRJason Ekstrand2015-09-091-0/+2
| | | | Reviewed-by: Ian Romanick <[email protected]>
* nir: Add a pass to lower outputs to temporary variablesJason Ekstrand2015-09-093-0/+130
| | | | | | | This pass can be used as a helper for NIR producers so they don't have to worry about creating the temporaries themselves. Reviewed-by: Ian Romanick <[email protected]>
* nir/cursor: Add a constructor for the end of a block but before the jumpJason Ekstrand2015-09-092-6/+12
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: build: remove bogus dependencyEmil Velikov2015-09-092-3/+2
| | | | | | | | | v2: rebase on top of the previous commit - don't touch the LOCAL_PATH prefix for nir_constant_expressions.h Cc: 11.0 <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: build: use makefile.sources variables when possibleEmil Velikov2015-09-093-18/+11
| | | | | | | | | | | Rather than folding one variable within the other only to unwrap them, just use the ones we need. v2: bring back LOCAL_PATH prefix for nir_constant_expressions,h Cc: 11.0 <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]> (v1)
* glsl: automake: reuse $(NIR_GENERATED_FILES) where possibleEmil Velikov2015-09-091-5/+1
| | | | | | Cc: 11.0 <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: automake: rework the sources generation rulesEmil Velikov2015-09-091-16/+22
| | | | | | | | | | | The glsl equivalent of "mesa: automake: rework the source generation rules". Plus let's make things consistent and always explicitly provide the header name. v2: Rebase on top of reverted "remove custom AM_V_LEX/YACC" (Matt) Cc: 11.0 <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* nir: Add a nir_system_value_from_intrinsic() function.Kenneth Graunke2015-09-082-0/+36
| | | | | | | | This converts NIR intrinsics that load system values into Mesa's SYSTEM_VALUE_* enumerations. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* nir: UBO loads no longer use const_index[1]Iago Toral Quiroga2015-09-081-1/+0
| | | | | | | | Commit 2126c68e5cba killed the array elements parameter on load/store intrinsics that was stored in const_index[1]. It looks like that patch missed to remove this assignment in the UBO path. Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: error out on ES 3.1 if VS or FS present but not bothTapani Pälli2015-09-041-4/+25
| | | | | Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: error on linking if no shaders are attached to programTapani Pälli2015-09-041-0/+19
| | | | | | | This applies to OpenGL Core >= 4.5 and OpenGL ES >= 3.1. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: Remove unused total_attribs_size variable.Kenneth Graunke2015-09-031-1/+0
| | | | | | Accidentally left behind by my previous patch. Signed-off-by: Kenneth Graunke <[email protected]>
* glsl: Handle attribute aliasing in attribute storage limit check.Kenneth Graunke2015-09-021-28/+36
| | | | | | | | | | | | | | | | | | | | | | | | | In various versions of OpenGL and GLSL, it's possible to declare multiple VS input variables with aliasing attribute locations. So, when computing the storage requirements for vertex attributes, we can't simply add up the sizes. Instead, we need to look at the enabled slots. This patch begins tracking which attributes are double types that are larger than 128-bits (i.e. take up two vec4 slots). We then count normal attributes once, and count the double-size attributes a second time. Fixes deQP functional.attribute_location.bind_aliasing.max_cond_* tests on i965, which regressed with commit ad208d975a6d3aebe14f7c2c16039ee20. No Piglit changes on llvmpipe (which actually supports dvecs). Cc: "10.6 11.0" <[email protected]> Tested-by: Mark Janes <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]>
* linker: Silence GCC unused parameter warningsIan Romanick2015-09-021-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | linker.cpp:320:55: warning: unused parameter 'ir' [-Wunused-parameter] virtual ir_visitor_status visit_leave(ir_function *ir) ^ linker.cpp:327:53: warning: unused parameter 'ir' [-Wunused-parameter] virtual ir_visitor_status visit_leave(ir_return *ir) ^ linker.cpp:333:49: warning: unused parameter 'ir' [-Wunused-parameter] virtual ir_visitor_status visit_enter(ir_if *ir) ^ linker.cpp:339:49: warning: unused parameter 'ir' [-Wunused-parameter] virtual ir_visitor_status visit_leave(ir_if *ir) ^ linker.cpp:345:51: warning: unused parameter 'ir' [-Wunused-parameter] virtual ir_visitor_status visit_enter(ir_loop *ir) ^ linker.cpp:351:51: warning: unused parameter 'ir' [-Wunused-parameter] virtual ir_visitor_status visit_leave(ir_loop *ir) ^ linker.cpp:2824:53: warning: unused parameter 'ctx' [-Wunused-parameter] link_calculate_subroutine_compat(struct gl_context *ctx, struct gl_shader_program *prog) ^ linker.cpp:2854:47: warning: unused parameter 'ctx' [-Wunused-parameter] check_subroutine_resources(struct gl_context *ctx, struct gl_shader_program *prog) ^ linker.cpp:3368:49: warning: unused parameter 'ctx' [-Wunused-parameter] link_assign_subroutine_types(struct gl_context *ctx, ^ Also make link_assign_subroutine_types static since it is only called from this file. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* mesa: Fix warning about static being in the wrong placeIan Romanick2015-09-022-2/+2
| | | | | | | | | | | | | | | | | | | | Because the compiler already has enough things to complain about. grep -rl 'const static' src/ | while read f do sed --in-place -e 's/const static/static const/g' $f done brw_eu_emit.c: In function 'brw_reg_type_to_hw_type': brw_eu_emit.c:98:7: warning: 'static' is not at beginning of declaration [-Wold-style-declaration] const static int imm_hw_types[] = { ^ brw_eu_emit.c:120:7: warning: 'static' is not at beginning of declaration [-Wold-style-declaration] const static int hw_types[] = { ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* mesa: Move gl_vert_attrib from mtypes.h to shader_enums.hJason Ekstrand2015-09-011-0/+108
| | | | | | It is a shader enum after all... Acked-by: Brian Paul <[email protected]>
* nir/dead_cf: add support for removing useless loopsConnor Abbott2015-09-011-12/+109
| | | | | | | | | | | | v2: fix detecting if the loop has any phi nodes after it. v2: use nir_foreach_ssa_def() instead of nir_foreach_dest() when checking for values live after the loop to catch const_load instructions. v2: fix handling return instructions v2: add some documentation to loop_is_dead() Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* nir: add a helper for iterating over blocks in a cf nodeConnor Abbott2015-09-012-0/+9
| | | | | | | We were already doing this internally for iterating over a function implementation, so just expose it directly. Reviewed-by: Kenneth Graunke <[email protected]>
* nir: add nir_block_get_following_loop() helperConnor Abbott2015-09-012-0/+18
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* nir/dead_cf: delete code that's unreachable due to jumpsConnor Abbott2015-09-011-8/+115
| | | | | | | | v2: use nir_cf_node_remove_after(). v2: use foreach_list_typed() instead of hardcoding a list walk. v3: update to new control flow modification helpers. Reviewed-by: Kenneth Graunke <[email protected]>
* nir: add an optimization for removing dead control flowConnor Abbott2015-09-013-0/+158
| | | | | | | v2: use nir_cf_node_remove_after() instead of our own broken thing. v3: use the new control flow modification helpers. Reviewed-by: Kenneth Graunke <[email protected]>
* nir/builder: Use nir_after_instr to advance the cursorJason Ekstrand2015-08-311-2/+1
| | | | | | | | | | | | This *should* ensure that the cursor gets properly advanced in all cases. We had a problem before where, if the cursor was created using nir_after_cf_node on a non-block cf_node, that would call nir_before_block on the block following the cf node. Instructions would then get inserted in backwards order at the top of the block which is not at all what you would expect from nir_after_cf_node. By just resetting to after_instr, we avoid all these problems. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: remove specical case subroutine type countingTimothy Arceri2015-08-311-3/+2
| | | | | | | Unlike samplers we can get the correct value for subroutines from component_slots() Reviewed-by: Dave Airlie <[email protected]>
* glsl: provide the option of using BFE for unpack builting loweringIlia Mirkin2015-08-284-13/+98
| | | | | | | | | This greatly improves generated code, especially for the snorm variants, since it is able to get rid of the lshift/rshift for sext, as well as replacing each shift + mask with a single op. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: use bitfield_insert instead of and + shift + or for packingIlia Mirkin2015-08-282-4/+27
| | | | | | | | | It is fairly tricky to detect the proper conditions for using bitfield insert, but easy to just use it up front. This removes a lot of instructions on nvc0 when invoking the packing builtins. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: clean up textureSize prototypeIlia Mirkin2015-08-271-4/+1
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* nir: Convert the builder to use the new NIR cursor API.Kenneth Graunke2015-08-276-38/+15
| | | | | | | | | | | | | | | | | | 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]
* nir: Convert the NIR instruction insertion API to use cursors.Kenneth Graunke2015-08-272-97/+89
| | | | | | | | | | | | | | | | | This patch implements a general nir_instr_insert() function that takes a nir_cursor for the insertion point. It then reworks the existing API to simply be a wrapper around that for compatibility. This largely involves moving the existing code into a new function. Suggested by Connor Abbott. v2: Make the legacy functions static inline in nir.h (requested by Connor Abbott). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Acked-by: Connor Abbott <[email protected]>
* nir: Move nir_cursor to nir.h.Kenneth Graunke2015-08-272-89/+97
| | | | | | | | | | | We want to use this for normal instruction insertion too, not just control flow. Generally these functions are going to be extremely useful when working with NIR, so I want them to be widely available without having to include a separate file. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Acked-by: Connor Abbott <[email protected]>
* nir: Strengthen "no jumps" assertions in instruction insertion API.Kenneth Graunke2015-08-271-5/+5
| | | | | | | | | | | | | Jumps must be the last instruction in a block, so inserting another instruction after a jump is illegal. Previously, we only checked this when the new instruction being inserted was a jump. This is a red herring - inserting *any* kind of instruction after a jump is illegal. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Acked-by: Connor Abbott <[email protected]>
* glsl: fix comment typo: s/filed/field/Brian Paul2015-08-271-1/+1
|
* glsl: add support for OES_texture_storage_multisample_2d_arrayTapani Pälli2015-08-276-6/+13
| | | | | | | | | | | v2: use ARB_texture_multisample enable bit Patch adds extension enable bit and enables required keywords and builtin functions for the extension. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Marta Lofstedt <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* nir: Use nir_shader::stage rather than passing it around.Kenneth Graunke2015-08-253-11/+8
| | | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* nir: Store gl_shader_stage in nir_shader.Kenneth Graunke2015-08-253-2/+10
| | | | | | | | | | | | 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]>
* nir/lower_io: Remove assign_var_locations_direct_firstJason Ekstrand2015-08-252-82/+0
| | | | | | This is no longer used so we might as well get rid of it. Reviewed-by: Kenneth Graunke <[email protected]>
* nir/lower_io: Separate driver_location and base offset for uniformsJason Ekstrand2015-08-251-2/+7
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* nir/intrinsics: Add a second const index to load_uniformJason Ekstrand2015-08-251-11/+17
| | | | | | | | | | | In the i965 backend, we want to be able to "pull apart" the uniforms and push some of them into the shader through a different path. In order to do this effectively, we need to know which variable is actually being referred to by a given uniform load. Previously, it was completely flattened by nir_lower_io which made things difficult. This adds more information to the intrinsic to make this easier for us. Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Pass a type_size() function pointer into nir_lower_io().Kenneth Graunke2015-08-252-106/+20
| | | | | | | | | | | | | | | | | | | | | | | | | Previously, there were four type_size() functions in play - the i965 compiler backend defined scalar and vec4 type_size() functions, and nir_lower_io contained its own similar functions. In fact, the i965 driver used nir_lower_io() and then looped over the components using its own type_size - meaning both were in play. The two are /basically/ the same, but not exactly in obscure cases like subroutines and images. This patch removes nir_lower_io's functions, and instead makes the driver supply a function pointer. This gives the driver ultimate flexibility in deciding how it wants to count things, reduces code duplication, and improves consistency. v2 (Jason Ekstrand): - One side-effect of passing in a function pointer is that nir_lower_io is now aware of and properly allocates space for image uniforms, allowing us to drop hacks in the backend Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> v2 Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Use !block_ends_in_jump() in a few places rather than open-coding.Kenneth Graunke2015-08-241-12/+9
| | | | | | | | | Connor introduced this helper recently; we should use it here too. I had to move the function earlier in the file for it to be available. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/cf: reimplement nir_cf_node_remove() using the new APIConnor Abbott2015-08-242-33/+9
| | | | | | | | | This gives us some testing of it. Also, the old nir_cf_node_remove() wasn't handling phi nodes correctly and was calling cleanup_cf_node() too late. Signed-off-by: Connor Abbott <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/cf: add new control modification API'sConnor Abbott2015-08-242-0/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | These will help us do a number of things, including: - Early return elimination. - Dead control flow elimination. - Various optimizations, such as replacing: if (foo) { ... } if (!foo) { ... } with: if (foo) { ... } else { ... } Signed-off-by: Connor Abbott <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>