aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_set_program_inouts.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: use separate varying slots for patch varyingsMarek Olšák2015-07-231-3/+24
| | | | | | | The idea is to allow 32 normal varyings and 32 patch varyings, a total of 64. Previously, only a total of 32 was allowed. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add the patch in/out qualifier (v2)Fabian Bieler2015-07-231-8/+61
| | | | | | v2: Dropped some unrelated reordering in glsl_parser.yy as Ken suggested. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: track which program inputs are doublesDave Airlie2015-05-081-13/+3
| | | | | | | | instead of doing the attempts at dual slot handling here, let the backend do it. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: Support double inoutsDave Airlie2015-02-191-4/+24
| | | | | Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: Mark program as using dFdy if coarse/fine variant is usedChris Forbes2014-08-151-1/+3
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Make more use of gl_shader_stage enum in ir_set_program_inouts.cpp.Paul Berry2014-01-081-14/+15
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* glsl: move variables in to ir_variable::data, part IITapani Pälli2013-12-121-2/+4
| | | | | | | | | | | | | This patch moves following bitfields and variables to the data structure: explicit_location, explicit_index, explicit_binding, has_initializer, is_unmatched_generic_inout, location_frac, from_named_ifc_block_nonarray, from_named_ifc_block_array, depth_layout, location, index, binding, max_array_access, atomic Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: move variables in to ir_variable::data, part ITapani Pälli2013-12-121-11/+11
| | | | | | | | | | This patch moves following bitfields in to the data structure: used, assigned, how_declared, mode, interpolation, origin_upper_left, pixel_center_integer Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: introduce data section to ir_variableTapani Pälli2013-12-121-2/+2
| | | | | | | | Data section helps serialization and cloning of a ir_variable. This patch includes the helper bits used for read only ir_variables. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Populate gl_fragment_program::IsSample bitfieldChris Forbes2013-12-071-1/+4
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* glsl: flag shaders which use gather4 at allChris Forbes2013-10-031-0/+9
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Hide many classes local to individual .cpp files in anon namespaces.Eric Anholt2013-09-231-0/+4
| | | | | | | | This gives the compiler the chance to inline and not export class symbols even in the absence of LTO. Saves about 60kb on disk. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Fix incorrect pattern matching in ir_set_program_inoutsPaul Berry2013-08-141-2/+2
| | | | | | | | | | | | | | | | | | | | In commit 8fc41df (glsl: Modify ir_set_program_inouts to handle geometry shaders), when attempting to pattern match the "foo" part of expressions such as: foo[i][j] foo[i] I incorrectly called as_dereference_variable() on the subexpression foo[i] instead of foo. As a result, the pattern never matched, so ir_set_program_inouts would fall back on marking the entire variable as used, rather than just the portion indexed by the array. This didn't result in incorrect behaviour, but it could have resulted in inefficiency by causing the back-end to allocate resources for unused parts of an input or output array. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Modify ir_set_program_inouts to handle geometry shaders.Paul Berry2013-08-011-12/+75
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: In ir_set_program_inouts, handle indexing outside array/matrix bounds.Paul Berry2013-08-011-5/+26
| | | | | | | | | | | | | | | According to GLSL, indexing into an array or matrix with an out-of-range constant results in a compile error. However, indexing with an out-of-range value that isn't constant merely results in undefined results. Since optimization passes (e.g. loop unrolling) can convert non-constant array indices into constant array indices, it's possible that ir_set_program_inouts will encounter a constant array index that is out of range; if this happens, just mark the whole array as used. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fallback gracefully if ir_set_program_inouts sees unexpected indexing.Paul Berry2013-08-011-0/+23
| | | | | | | | | | | | | | | | | | | | | | | The code in ir_set_program_inouts that marks just a portion of a variable as used (rather than the whole variable) only works on a few kinds of indexing operations: - Indexing into matrices - Indexing into arrays of matrices, vectors, or scalars. Fortunately these are the only kinds of indexing operations that we expect to see; everything else is either handled by a previously-executed lowering pass or prohibited by GLSL. However, that could conceivably change in the future (the GLSL rules might change, or we might modify the lowering passes). To avoid mysterious bugs in the future, let's have ir_set_program_inouts report an assertion failure if it ever encounters an unexpected kind of indexing operation (and in release builds, fall back to just marking the whole variable as used). Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Extract marking functions from ir_set_program_inouts.Paul Berry2013-08-011-14/+45
| | | | | | | | | | This patch extracts the functions mark_whole_variable() and try_mark_partial_variable() from the ir_set_program_inouts visitor functions. This will make the code easier to follow when we add geometry shader support. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Use count_attribute_slots() in ir_set_program_inouts.Paul Berry2013-08-011-8/+2
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Change do_set_program_inouts' is_fragment_shader arg to shader_type.Paul Berry2013-08-011-12/+12
| | | | | | | | This will allow us to add geometry shader support without having to add another boolean argument. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Remove hash table from ir_set_program_inouts pass.Kenneth Graunke2013-02-031-24/+14
| | | | | | | | | | | Back when ir_var_in and ir_var_out signified both function parameters and shader input/outputs, we had trouble distinguishing the two when looking at a dereference. Now that we have separate ir_var_shader_in and ir_var_shader_out modes, we can determine this easily. Removing the hash table saves memory and CPU overhead. Signed-off-by: Kenneth Graunke <[email protected]>
* glsl: Eliminate ambiguity between function ins/outs and shader ins/outsPaul Berry2013-01-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces the three ir_variable_mode enums: - ir_var_in - ir_var_out - ir_var_inout with the following five: - ir_var_shader_in - ir_var_shader_out - ir_var_function_in - ir_var_function_out - ir_var_function_inout This eliminates a frustrating ambiguity: it used to be impossible to tell whether an ir_var_{in,out} variable was a shader in/out or a function in/out without seeing where the variable was declared in the IR. This complicated some optimization and lowering passes, and would have become a problem for implementing varying structs. In the lisp-style serialization of GLSL IR to strings performed by ir_print_visitor.cpp and ir_reader.cpp, I've retained the names "in", "out", and "inout" for function parameters, to avoid introducing code churn to the src/glsl/builtins/ir/ directory. Note: a couple of comments in the code seemed to indicate that we were planning for a possible future in which geometry shaders could have shader-scope inout variables. Our GLSL grammar rejects shader-scope inout variables, and I've been unable to find any evidence in the GLSL standards documents (or extensions) that this will ever be allowed, so I've eliminated these comments. Reviewed-by: Carl Worth <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Set gl_fragment_program::UsesKill in do_set_program_inouts.Paul Berry2012-07-201-0/+14
| | | | | | | | | | | | | | | | | | | | | Previously, the code for setting this flag for GLSL programs was duplicated in three places: brw_link_shader(), glsl_to_tgsi_visitor, and ir_to_mesa_visitor. In addition to the unnecessary duplication, there was a performance problem on i965: brw_link_shader() set the flag before doing its final round of optimizations, which meant that if the optimizations managed to eliminate all the discard operations, the flag would still be set, resulting (at least in theory) in slower performance. This patch consolidates all of the code that sets UsesKill for GLSL programs into do_set_program_inouts(), which already is doing a similar job for UsesDFdy, and which occurs after i965's final round of optimizations. Non-GLSL programs (ARB programs and the state tracker's glBitmap program) are unaffected. Reviewed-by: Eric Anholt <[email protected]>
* glsl: Set UsesDFdy appropriately for GLSL shaders.Paul Berry2012-07-191-5/+17
| | | | | | | | | | | | | | | | This patch updates the ir_set_program_inouts_visitor so that it also sets gl_fragment_program::UsesDFdy. This is a bit of a hack (since dFdy() isn't an input or an output), but there's no other obvious visitor to squeeze this functionality into, and it would be silly to create a brand new visitor just for this purpose. v2: use local 'fprog' var to avoid repeated casting. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add IsCentroid bitfield to gl_fragment_program.Paul Berry2012-06-251-1/+5
| | | | | | | | | This bitfield tells the back-ends which of a fragment shader's inputs require centroid interpolation. It is only set for GLSL fragment shaders, since assembly fragment shaders don't support centroid interpolation. Reviewed-by: Eric Anholt <[email protected]>
* glsl: add support for ARB_blend_func_extended (v3)Dave Airlie2012-04-131-2/+2
| | | | | | | | | | | | | | | | | | | This adds index support to the GLSL compiler. I'm not 100% sure of my approach here, esp without how output ordering happens wrt location, index pairs, in the "mark" function. Since current hw doesn't ever have a location > 0 with an index > 0, we don't have to work out if the output ordering the hw requires is location, index, location, index or location, location, index, index. But we have no hw to know, so punt on it for now. v2: index requires layout - catch and error setup explicit index properly. v3: drop idx_offset stuff, assume index follow location Signed-off-by: Dave Airlie <[email protected]>
* mesa: Expose GLSL interpolation qualifiers in gl_fragment_program.Paul Berry2011-10-271-13/+34
| | | | | | | | | | | | | | | | | This patch makes GLSL interpolation qualifiers visible to drivers via the array InterpQualifier[] in gl_fragment_program, so that they can easily be used by driver back-ends to select the correct interpolation mode. Previous to this patch, the GLSL compiler was using the enum ir_variable_interpolation to represent interpolation types. Rather than make a duplicate enum in core mesa to represent the same thing, I moved the enum into mtypes.h and renamed it to be more consistent with the other enums defined there. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* ir_to_mesa: Move some things outside the 'extern "C"' blocksIan Romanick2011-10-181-2/+0
| | | | | | | | | | | Having a few of these includes or forward declarations inside the 'extern "C"' block can cause problems later. Specifically, it prevents C++ linkage functions from being added to ir_to_mesa.h and makes G++ angry if 'struct foo' is seen both inside and outside an 'extern "C"'. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix setting of OutputsWritten for whole array dereference.Eric Anholt2011-09-081-4/+2
| | | | | | | | We just want to mark the whole thing used, not mark from each element the whole size in use. Fixes undefined URB entry writes on i965, which blew up with debugging enabled. Reviewed-by: Ian Romanick <[email protected]>
* Merge branch 'draw-instanced'Brian Paul2011-01-151-1/+5
|\ | | | | | | | | | | | | | | Conflicts: src/gallium/auxiliary/draw/draw_llvm.c src/gallium/drivers/llvmpipe/lp_state_fs.c src/glsl/ir_set_program_inouts.cpp src/mesa/tnl/t_vb_program.c
| * glsl: add support for system values and GL_ARB_draw_instancedBrian Paul2010-12-081-2/+7
| |
* | glsl: Correct the marking of InputsRead/OutputsWritten on in/out matrices.Eric Anholt2010-12-091-20/+15
|/ | | | | | | | If you used a constant array index to access the matrix, we'd flag a bunch of wrong inputs/outputs as being used because the index was multiplied by matrix columns and the actual used index was left out. Fixes glsl-mat-attribute.
* glsl: Include main/core.h.Chia-I Wu2010-08-241-1/+1
| | | | Make glsl include only main/core.h from core mesa.
* glsl: Fix leak-causing typo in destructor that made it another constructor.Eric Anholt2010-08-181-1/+1
|
* glsl2: Move gl_program->InputsRead/OutputsWritten setting to an ir pass.Eric Anholt2010-08-061-0/+167
This lets us handle arrays much better than trying to work backwards from assembly. Fixes fbo-drawbuffers-maxtargets on swrast (i965 needs loop unrolling)