aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: store read vector in a temp in vec_index_to_condVincent Lejeune2012-11-111-4/+12
| | | | | | | | | | | | | | | | | | | | | Vector indexing on matrixes generates several copy of the constant matrix, for instance vec=mat4[i][j] generates : vec=mat4[i].x; vec=(j==1)?mat4[i].y; vec=(j==2)?mat4[i].z; vec=(j==3)?mat4[i].w; In the case of constant matrixes, the mat4[i] expression generates copy of the 16 elements of the matrix 4 times ; indirect addressing also prevents some conservative CSE algorithms (like the one in LLVM) from factoring the mat4[i] expression. This patch will make the vec_index_to_cond pass generates : temp = mat4[i]; vec=temp.x; vec=(j==1)?temp.y; vec=(j==2)?temp.z; vec=(j==3)?temp.w; Reviewed-by: Kenneth Graunke <[email protected]>
* Fix use of glsl_parser.{cc,h} where source dir != build dir.Darren Salt2012-11-091-1/+2
| | | | | | | | Fixes a regression caused by commit 9948a3365. https://bugs.freedesktop.org/show_bug.cgi?id=56787 https://bugs.freedesktop.org/show_bug.cgi?id=56685 Reviewed-by: Matt Turner <[email protected]>
* glcpp: wire up glcpp-test to make checkMatt Turner2012-11-092-4/+14
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp/tests: Add tests for multiline #elifMatt Turner2012-11-092-0/+15
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp/tests: Add test for multiline #ifMatt Turner2012-11-092-0/+13
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp/tests: Add test for multiline #lineMatt Turner2012-11-092-0/+11
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp/tests: Add test to check #line followed by codeMatt Turner2012-11-092-0/+5
| | | | | | | 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 Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: don't push #line directives into next lineFabian Bieler2012-11-092-9/+9
| | | | | | | | | | | | | | By moving the HASH_LINE rule out of control_line: and into line:, we avoid adding control_line's additional \n (as seen in the first hunk). mattst88: Carl and I determined independently of Fabian that the 091 test needed to be modified identically to this, and our patch to fix the test was more complicated. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51506 Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Carl Worth <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Reject garbage after #else and #endif tokensMatt Turner2012-11-095-4/+15
| | | | | | | | | | | | | | | | | | | | | | Previously we were accepting garbage after #else and #endif tokens when the previous preprocessor conditional evaluated to false (eg, #if 0). When the preprocessor hits a false conditional, it switches the lexer into the SKIP state, in which it ignores non-control tokens. The parser pops the SKIP state off the stack when it reaches the associated #elif, #else, or #endif. Unfortunately, that meant that it only left the SKIP state after the lexing the entire line containing the #token and thus would accept garbage after the #token. To fix this we use a mid-rule, which is executed immediately after the #token is parsed. NOTE: This is a candidate for the stable branch Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56442 Fixes: preprocess17_frag.test from oglconform Reviewed-by: Carl Worth <[email protected]> (glcpp-parse.y) Acked-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add ARB_texture_cube_map_array support (v2)Dave Airlie2012-11-0912-7/+114
| | | | | | | | | | | | This adds all the new builtins + the new sampler types, and hooks them up if the extension is supported. v2: fix missing signatures for grad/lod fix missing textureSize clarifications fix compare vs starts with usage Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: fix signed/unsigned comparision warnings on MSVCBrian Paul2012-11-063-7/+7
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* glsl: remove incorrect 'struct' keywordBrian Paul2012-11-061-1/+1
| | | | | | ir_variable is a class, not a struct. Fixes an MSVC warning. Reviewed-by: Jose Fonseca <[email protected]>
* glsl: add 'f' suffix to floats to silence MSVC warningsBrian Paul2012-11-061-1/+1
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* glsl: change int->unsigned to silence MSVC warningsBrian Paul2012-11-062-2/+2
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* android: Update for builtin_stubs.cpp moveThierry Reding2012-11-021-1/+1
| | | | | | | | This fixes the Android build after the move of builtin_stubs.cpp into the builtin_compiler subdirectory. This patch is untested. Signed-off-by: Thierry Reding <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix builtin_compiler build by -I $(top_srcdir)/include.Johannes Obermayr2012-11-021-0/+1
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56664
* scons: Update for builtin_stubs.cppJosé Fonseca2012-11-021-3/+4
| | | | | | | | | | | | Note this by itself is not enough to fix scons build -- it will fail until you remove: rm -rf build/*/glsl/builtin_compiler because that node was a filei before, but it will be now a directory. This also means that bisecting across this change will require wiping the build directory..
* build: Don't cross-compile GLSL builtin compilerThierry Reding2012-11-015-36/+86
| | | | | | | | | | | | | | | | | | | | | | The builtin_compiler binary is used during the build process to generate code for the builtin GLSL functions. Since this binary needs to be run on the build host, it must not be cross-compiled. This patch fixes the build system to compile a second version of the source files and the builtin_compiler binary itself for the build system. It does so by defining the CC_FOR_BUILD and CXX_FOR_BUILD variables, which are searched for by the configure script and point to the location of native C and C++ compilers. In order for this to work properly, builtin_function.cpp is removed from BUILT_SOURCES, otherwise the build system would try to generate it before having had a chance to descend into the builtin_compiler subdirectory. With the builtin_compiler and glsl_compiler now being generated at different stages, the build instructions for glsl_compiler can be simplified a bit. Signed-off-by: Thierry Reding <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* mesa: don't always enable OES_standard_derivativesMarek Olšák2012-10-311-0/+1
| | | | | | | | For Intel, expose it only if gen >= 4. For Gallium, expose it only if PIPE_CAP_SM3 is advertised. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Allow ir_if in the linker's move_non_declarations function.Kenneth Graunke2012-10-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Global initializers using the ?: operator with at least one non-constant operand generate ir_if statements. For example, float foo = some_boolean ? 0.0 : 1.0; becomes: (declare (temporary) float conditional_tmp) (if (var_ref some_boolean) ((assign (x) (var_ref conditional_tmp) (constant float (0.0)))) ((assign (x) (var_ref conditional_tmp) (constant float (1.0))))) This pattern is necessary because the second or third arguments could be function calls, which create statements (not expressions). The linker moves these global initializers into the main() function. However, it incorrectly had an assertion that global initializer statements were only assignments, calls, or temporary variable declarations. As demonstrated above, they can be if statements too. Other than the assertion, everything works fine. So remove it. Fixes new Piglit test condition-08.vert, as well as an upcoming game that will be released on Steam. NOTE: This is a candidate for stable release branches. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glcpp: Don't use infinite lookhead for #define differentiation.Kenneth Graunke2012-10-252-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we used lookahead patterns to differentiate: #define FOO(x) function macro #define FOO (x) object macro Unfortunately, our rule for function macros: {HASH}define{HSPACE}+/{IDENTIFIER}"(" relies on infinite lookahead, and apparently triggers a Flex bug where the generated code overflows a state buffer (see YY_STATE_BUF_SIZE). There's no need to use infinite lookahead. We can simply change state, match the identifier, and use a single character lookahead for the '('. This apparently makes Flex not generate the giant state array, which avoids the buffer overflow, and should be more efficient anyway. Fixes piglit test 17000-consecutive-chars-identifier.frag. NOTE: This is a candidate for every release branch ever. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Carl Worth <[email protected]>
* src/glsl/tests/Makefile.am: Specify -I... in AM_CPPFLAGSMatt Turner2012-10-251-4/+1
| | | | | | | | | | | | | When specifying per-target CFLAGS (e.g., ralloc_test_CFLAGS) AM_CFLAGS are not used. AM_CPPFLAGS should be used for includes anyway. Fixes a build problem since 41b14d125: CC ralloc_test-ralloc.o In file included from ../../../src/glsl/ralloc.c:42:0: ../../../src/glsl/ralloc.h:57:27: fatal error: main/compiler.h: No such file or directory Acked-by: Paul Berry <[email protected]>
* ralloc: Annotate printf functions with PRINTFLIKE(...)Matt Turner2012-10-252-11/+6
| | | | | | | | | | | | | | | Catches problems such as (in the gles3 branch) glcpp-parse.y: In function '_glcpp_parser_handle_version_declaration': glcpp-parse.y:1990:39: warning: format '%lli' expects argument of type 'long long int', but argument 4 has type 'int' [-Wformat] As a side-effect, remove ralloc.c's likely/unlikely macros and just use the ones from main/compiler.h. NOTE: This is a candidate for the release branches. Reviewed-by: Ian Romanick <[email protected]>
* 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]>