summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* android: glcpp: fix abuse of yylexNegreanu Marius Adrian2012-10-021-3/+3
| | | | | | | | | | | | | | Port the 'glcpp: fix abuse of yylex' commit to Android.mk Also, since the Android.*.mk are sourced in a global namespace, the local-y-to-c-and-h is prefixed with the LOCAL_MODULE name, The initial fix commit is 53d46bc787318ccf9911fdd1d5fe99ee4db7f41a There's also a bugzilla for this: 54947 Signed-off-by: Negreanu Marius Adrian <[email protected]> Reviewed-by: Oliver McFadden <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* build: Build src/glsl with visibility CFLAGSMatt Turner2012-10-011-3/+3
|
* build: Use PTHREAD_LIBS and PTHREAD_CFLAGSMatt Turner2012-10-011-3/+5
|
* scons: Use full path of texture_builtins.py.Vinson Lee2012-09-291-1/+1
| | | | | | | | | | Fixes this build error on Cygwin. Explicit dependency `src/glsl/builtins/tools/texture_builtins.py' not found, needed by target `build/cygwin-x86-debug/glsl/builtin_function.cpp'. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* glsl: Rename variable_entry2 back to variable_entry in struct splitting.Kenneth Graunke2012-09-291-21/+17
| | | | | | | | The anonymous namespace should keep these private classes to file scope, preventing clashes with other symbols of the same name elsewhere. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: make _mesa_builtin_uniform_desc staticDave Airlie2012-09-181-1/+1
| | | | | | | I can't see any reason this is global (unless for debugging) Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* scons: add new -p (prefix) options for yaccBrian Paul2012-09-151-1/+1
| | | | These were recently added to the Makefiles.
* glsl: make tex_opcode_strs staticDave Airlie2012-09-151-1/+1
| | | | | | | | No reason for this to be global from what I can see Reviewed-by: Matt Turner <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: make builtin_mem_ctx a staticDave Airlie2012-09-151-1/+1
| | | | | | | This isn't used outside the generated file. Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* mesa/glsl: rename preprocess to glcpp_preprocessDave Airlie2012-09-156-6/+6
| | | | | | | | | | This symbol with dricore escapes into the namespace, its too generic, we should prefix it with something just to be nice. Should be applied to stable + 9.0 Acked-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glcpp: fix abuse of yylexDave Airlie2012-09-152-9/+1
| | | | | | | | | | | | So glcpp tried to workaround yylex its own way, but failed, do it properly. This fixes another crash found after fixing the first crash. this is a candidate for 9.0 and stable branches Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: Generate compile errors for explicit blend indices < 0 or > 1.Kenneth Graunke2012-09-101-2/+17
| | | | | | | | | | | | | | According to the GLSL 4.30 specification, this is a compile time error. Earlier specifications don't specify a behavior, but since 0 and 1 are the only valid indices for dual source blending, it makes sense to generate the error. Fixes (the fixed version of) piglit's layout-12.frag. NOTE: This is a candidate for the 9.0 branch. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Count builtin uniforms against uniform component limits.Eric Anholt2012-09-071-1/+4
| | | | | | | | We don't fully process the builtin uniforms, but at least num_uniform_components reflects reality now. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: s/class/struct/ for ast_type_qualifierBrian Paul2012-08-291-1/+1
| | | | | | To silence an MSVC compiler warning about class vs. struct. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/linker: Avoid buffer over-run in parcel_out_uniform_storage::visit_fieldStéphane Marchesin2012-08-231-1/+1
| | | | | | | | | | | When too may uniforms are used, the error will be caught in check_resources (src/glsl/linker.cpp). NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Stéphane Marchesin <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Tested-by: Benoit Jacob <[email protected]>
* build/glsl: fix android build v2Tapani Pälli2012-08-231-1/+1
| | | | | | | | | | Commit 77a3efc6b907943903190b385fdf107c4acfcdca broke android build that sets its own value for GLSL_SRCDIR before including Makefile.sources. Patch moves overriding the value after include, this works as GLSL_SRCDIR variable gets expanded only later. Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Tapani Pälli <[email protected]>
* build: Fix out-of-tree generation of builtin_function.cppMatt Turner2012-08-141-2/+2
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* build/glsl: fix location of generated files.Christopher James Halse Rogers2012-08-133-15/+8
| | | | | | | | Like in src/mesa, use GLSL_BUILDDIR/GLSL_SRCDIR to unambiguously distinguish between in-tree and generated files. Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Christopher James Halse Rogers <[email protected]>
* glsl: Refuse to parse uniform block declarations when UBOs aren't available.Eric Anholt2012-08-071-0/+20
| | | | | | | Fixes piglit GL_ARB_uniform_buffer_object/compiler/extension-disabled-block.frag Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Align GL_UNIFORM_BLOCK_DATA_SIZE according to std140 rules.Eric Anholt2012-08-071-1/+13
| | | | | | Fixes piglit GL_ARB_uniform_buffer_object/data-size test. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Only flag RowMajor on matrix-type variables.Eric Anholt2012-08-071-5/+9
| | | | | | | | We were only propagating it to the API when the variable was a matrix type, but we were still tripping over it in lower_ubo_reference when it was set on a vector. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix calculation of std140 offset alignment for mat2s.Eric Anholt2012-08-071-4/+9
| | | | | | | | | We were getting the base offset of a vec2, not of a vec2[2] like the quoted spec text says we should. v2: Fix swapped then/else cases. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix glGetActiveUniformsiv(GL_UNIFORM_BLOCK_INDEX).Eric Anholt2012-08-071-3/+13
| | | | | | | | | Previously, we were returning the index into the UniformBlocks of one of the linked shaders, when it's supposed to be the program global index. Fixes piglit getactiveuniformsiv-uniform_block_index. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add a lowering pass to turn complicated UBO references to vector loads.Eric Anholt2012-08-073-0/+315
| | | | | | | | | | | v2: Reduce the impenetrable code in emit_ubo_loads() by 23 lines by keeping the ir_variable as the variable part of the offset from handle_rvalue(), and track the constant offsets from that with a plain old integer value, avoiding a bunch of temporary variables in the array and struct handling. Also, fix file description doxygen. v3: Fix a row vs col typo, and fix spelling in a comment. Reviewed-by: Eric Anholt <[email protected]>
* glsl: Add a variant of the rvalue visitor for handle_rvalue() on the way down.Eric Anholt2012-08-072-11/+147
| | | | | | | For the UBO lowering pass, I want to see the whole dereference chain for replacing, not the innermost ir_dereference_variable. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add a "ubo_load" expression type for fetches from UBOs.Eric Anholt2012-08-073-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drivers will probably want to be able to take UBO references in a shader like: uniform ubo1 { float a; float b; float c; float d; } void main() { gl_FragColor = vec4(a, b, c, d); } and generate a single aligned vec4 load out of the UBO. For intel, this involves recognizing the shared offset of the aligned loads and CSEing them out. Obviously that involves breaking things down to loads from an offset from a particular UBO first. Thus, the driver doesn't want to see variable_ref(ir_variable("a")), and even more so does it not want to see array_ref(record_ref(variable_ref(ir_variable("a")), "field1"), variable_ref(ir_variable("i"))). where a.field1[i] is a row_major matrix. Instead, we're going to make a lowering pass to break UBO references down to expressions that are obvious to codegen, and amenable to merging through CSE. v2: Fix some partial thoughts in the ir_binop comment (review by Kenneth) Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix a reference to UniformBlocks during uniform linking.Eric Anholt2012-08-071-3/+3
| | | | | | | | | | | | | When converting var->location from pointing at the program's UniformBlocks to pointing at the linked shader's UniformBlocks, I missed this change. It usually worked out in the end because the two lists happen to be the same in many testcases. Fixes a valgrind complaint on oglconform ubo-compile.cpp advanced.std140.2stage Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Update the notes on adding a new expression type.Eric Anholt2012-08-071-1/+0
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* scons: set YACCHXXFILESUFFIX to stop needless rebuilding of the parserJosé Fonseca2012-08-021-0/+4
| | | | | | | | Before, the GLSL parser was getting rebuilt every time that scons was run. The problem was scons was expecting a glsl_parser.hpp file but we were generating a glsl_parser.h file. Signed-off-by: Brian Paul <[email protected]>
* glsl: Add support for OES_standard_derivatives in GLSL ES.Tomeu Vizoso2012-08-013-0/+23
| | | | | | | | | | | Previously, we advertised the extension but the builtin functions were enabled only for GLSL and not for ES. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=52003 Signed-off-by: Tomeu Vizoso <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Reject linking shaders with too many uniform blocks.Eric Anholt2012-07-311-0/+34
| | | | | | | Part of fixing piglit maxblocks. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Assign array and matrix stride values according to std140 layout.Eric Anholt2012-07-311-4/+15
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add support for default layout qualifiers for uniforms.Eric Anholt2012-07-315-38/+99
| | | | | | | | | | | I ended up having to add rallocing of the ast_type_qualifier in order to avoid pulling in ast.h for glsl_parser_extras.h, because I wanted to track an ast_type_qualifier in the state. Fixes piglit ARB_uniform_buffer_object/row-major. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Merge UBO layout qualifiers in a qualifier list.Eric Anholt2012-07-311-1/+23
| | | | | | | | | | Yes, you get to say things like "layout(row_major, column_major)" and get column major. Part of fixing piglit ARB_uniform_buffer_object/row_major. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Incorporate all UBO language changes into GLSL 1.40.Eric Anholt2012-07-311-0/+4
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Refactor #version validation to be more future-proof.Kenneth Graunke2012-07-313-38/+16
| | | | | | | | | | | | | | | | | The previous implementation required a flag in _mesa_glsl_parse_state and line of code to initialize it for every version of the shading language we intend to support. As we look to add 150, 330, 400, 410, 420, and beyond, this gets rather unwieldy. This patch retains the switch statement (to reject, say, #version 111), but removes all the bits. Code to check for ctx->API == API_OPENGL_CORE could easily be added to the 110 and 120 cases to reject those. v2: Use _mesa_is_desktop_gl to preserve the existing behavior in the presence of the new API_OPENGL_CORE enumeration. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> [v1]
* glsl: Fix #pragma invariant(all) language version check.Kenneth Graunke2012-07-311-1/+1
| | | | | | | | | | | | | It was using state->Const.GLSL_100ES, which is set if the driver supports ARB_ES2_compatibility or we're in ES2 mode. Instead, it should use state->language_version, as that represents the actual GLSL version of the shader being compiled. Since the correct logic is < 120 && !100, just make it == 110. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: add support for using API_OPENGL_COREJordan Justen2012-07-301-8/+7
| | | | | | | Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Fix ir_last_opcode value.Ian Romanick2012-07-301-1/+1
| | | | | | | | | | Now that ir_quadop_vector exists, ir_last_binop and ir_last_opcode are no longer the same. Only one place currently uses this enumeration, and already handles ir_quadop_vector correctly. Signed-off-by: Ian Romanick <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Olivier Galibert <[email protected]>
* glsl: Request an Nx1 type instance in ir_quadop_vector lowering pass.Ian Romanick2012-07-301-1/+1
| | | | | | | | | | | | | No types have 0 columns. The glsl_type::get_instance method contains if ((rows < 1) || (rows > 4) || (columns < 1) || (columns > 4)) return error_type; To get a vector, use columns = 1. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Olivier Galibert <[email protected]>
* glsl: Make bvec and ivec types accessible without using get_instance.Kenneth Graunke2012-07-302-0/+10
| | | | | | | | | It's more convenient to use shortcuts like glsl_type::bvec2_type than the longwinded glsl_type::get_instance(GLSL_TYPE_BOOL, 2, 1). Signed-off-by: Ian Romanick <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Olivier Galibert <[email protected]>
* glcpp: Add a newline to expanded #line directives.Kenneth Graunke2012-07-281-2/+2
| | | | | | | | | | | | | | | | | | | | Otherwise, the preprocessor happily outputs #line 2 4 <your next line of code> and the main compiler gets horribly confused and fails to compile. This is not the right solution (line numbers in error messages will likely be off-by-one in certain circumstances), but until Carl comes up with a proper fix, this gets programs running again. Fixes regressions in Regnum Online, Overgrowth, Piglit, and others since commit aac78ce8234d96932c38b3f48b1d828077bc0027. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51802 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51506 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41152 Signed-off-by: Kenneth Graunke <[email protected]>
* glsl: warning: pragma `invariant(all)' not supported in GLSL ES 1.00Oliver McFadden2012-07-261-1/+1
| | | | | | | | | | | | The OpenGL(R) ES Shading Language Version 1.00 Revision 17 (12 May, 2009) > 4.6.1 The Invariant Qualifier > ... To force all output variables to be invariant, use the pragma > #pragma STDGL invariant(all) Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* Fix compile time errors when building against uclibcAnthony G. Basile2012-07-241-1/+1
| | | | | | | | | | Mesa misses a few checks when compiling on a uclibc system which cause it to fall back on glibc-ism. This patch addresses those issues. Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Anthony G. Basile <[email protected]>
* glsl: Assign locations for uniforms in UBOs using the std140 rules.Eric Anholt2012-07-205-2/+270
| | | | | | Fixes piglit layout-std140. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Don't resize arrays in uniform blocks.Eric Anholt2012-07-201-0/+7
| | | | | | | This is a requirement for std140 uniform blocks, and optional for packed/shared blocks. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Don't dead-code eliminiate uniforms declared in uniform blocks.Eric Anholt2012-07-201-1/+7
| | | | | | | This is a requirement for std140 uniform blocks, and optional for packed/shared blocks. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Propagate uniform block information into gl_uniform_storage.Eric Anholt2012-07-202-1/+74
| | | | | | | Now we can actually return information on uniforms in uniform blocks in the new queries. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Set the uniform_block index for the linked shader variables.Eric Anholt2012-07-201-0/+45
| | | | | | | | | | | | At this point in the linking, we've totally lost track of the struct gl_uniform_buffer that this pointed to in the original unlinked shader, so we do a nasty n^2 walk to find it the new one based on the variable name. Note that these point into the shader's list of gl_uniform_buffers, not the linked program's. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Merge the lists of uniform blocks into the linked shader program.Eric Anholt2012-07-203-4/+145
| | | | | | This attempts error-checking, but the layout isn't done yet. Reviewed-by: Ian Romanick <[email protected]>