summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Unify ir_constant::const_elements and ::componentsIan Romanick2017-09-191-1/+2
| | | | | | | | | | There was no reason to treat array types and record types differently. Unifying them saves a bunch of code and saves a few bytes in every ir_constant. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Elie Tournier <[email protected]>
* glsl: Rename ir_constant::array_elements to ::const_elementsIan Romanick2017-09-191-1/+1
| | | | | | | | | | | The next patch will unify ::array_elements and ::components, so the name ::array_elements wouldn't be appropriate. A lot of things use the names array_elements and components, so grepping for either is pretty useless. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Elie Tournier <[email protected]>
* gallium: add PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVENicolai Hähnle2017-09-181-1/+4
| | | | | | | | | | | | | | | | | To be able to properly distinguish between GL_ANY_SAMPLES_PASSED and GL_ANY_SAMPLES_PASSED_CONSERVATIVE. This patch goes through all drivers, having them treat the two query types identically, except: 1. radeon incorrectly enabled conservative mode on PIPE_QUERY_OCCLUSION_PREDICATE. We now do it correctly, only on PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE. 2. st/mesa uses the new query type. Fixes dEQP-GLES31.functional.fbo.no_attachments.* Reviewed-by: Marek Olšák <[email protected]>
* st/glsl_to_tgsi: fix theoretical memory leakNicolai Hähnle2017-09-181-2/+5
| | | | | | | | It can't *really* happen since we don't use subroutines. CID: 1417491 Reviewed-by: Timothy Arceri <[email protected]> Reviewed-By: Gert Wollny <[email protected]>
* mesa/st/tests: Correct build flags and force -std=c++11Gert Wollny2017-09-151-9/+5
| | | | | | | | | | | | Include src/gallium/Automake.inc, correct the build flags accordingly. Force -std=c++11 (extensively used by the test) as otherwise it gets defined only when building against llvm >= 3.9. Fixes: 7be6d8fe12 ("mesa/st: glsl_to_tgsi: add tests for the new temporary lifetime tracker") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102665 Reviewed-by: Emil Velikov <[email protected]> (v1)
* st/mesa: set UseSTD430AsDefaultPacking const based on CAPTimothy Arceri2017-09-151-0/+3
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa/st: add LOAD support for UBOsTimothy Arceri2017-09-151-79/+119
| | | | | | | This will allow us to use STD430 packing by default if the driver supports it. Reviewed-by: Marek Olšák <[email protected]>
* mesa/st: create add_buffer_to_load_and_stores() helperTimothy Arceri2017-09-151-19/+27
| | | | | | Will be used to add LOAD support to UBOs. Reviewed-by: Marek Olšák <[email protected]>
* st/glsl->tgsi: fix u64 to bool comparisons.Dave Airlie2017-09-151-1/+15
| | | | | | | | | | | Otherwise we end up using a 32-bit comparison which didn't end well. Timothy caught this while playing around with some opt passes. Fixes: 278580729a (st/glsl_to_tgsi: add support for 64-bit integers) Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_tgsi: remove unused code in temprenameNicolai Hähnle2017-09-131-15/+1
| | | | | Reviewed-By: Gert Wollny <[email protected]> Tested-by: Dieter Nützel <[email protected]>
* st/glsl_to_tgsi: be precise about merging scopesNicolai Hähnle2017-09-131-2/+2
| | | | | | | | | | enclosing_scope already contains enclosing_scope_first_read. What we really want to check here -- not for correctness, but for speed -- is whether last_read_scope already contains enclosing_scope. Reviewed-By: Gert Wollny <[email protected]> Tested-by: Dieter Nützel <[email protected]>
* mesa/st: Include builddir/src/compiler/glsl to fix make checkAaron Watry2017-09-111-0/+1
| | | | | | | | | | | | | | | | | | | | | Otherwise, when doing an out-of-tree build you can expect the following: make[6]: Entering directory \ '${MESA_SRC}/build/src/mesa/state_tracker/tests' CXX test_glsl_to_tgsi_lifetime.o In file included from \ ${MESA_SRC}/src/mesa/src/mesa/state_tracker/st_glsl_to_tgsi_private.h:31:0, from \ ${MESA_SRC}/src/mesa/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.h:27, from \ ${MESA_SRC}/src/mesa/src/mesa/state_tracker/tests/test_glsl_to_tgsi_lifetime.cpp:24: ${MESA_SRC}/src/compiler/glsl/ir.h:1502:37: \ fatal error: ir_expression_operation.h: No such file or directory #include "ir_expression_operation.h" Signed-off-by: Aaron Watry <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Tested-by: Gert Wollny <[email protected]>
* st/glsl_to_tgsi: only the first (inner-most) array reference can be a 2D indexNicolai Hähnle2017-09-111-1/+1
| | | | | | | | | Don't get distracted by record dereferences between array references. Fixes dEQP-GLES31.functional.tessellation.user_defined_io.per_vertex_block.* Cc: [email protected] Reviewed-by: Marek Olšák <[email protected]>
* mesa/st: Fix frontbuffer rendering regressionThomas Hellstrom2017-09-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | This fixes a regression introduced with commit "mesa/st: Reduce the number of frontbuffer flush calls" where we, after flushing the front buffer marked it as not-rendered-to, the idea being that it should be marked as "rendered-to" again as soon as any rendering was touching the front. Now the latter part never happened, because it was part of a state validation and we never marked that part of the state as dirty. So mark the framebuffer state dirty after a frontbuffer flush. (fdo bugzilla 102496) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102496 Fixes: eceb671002 (mesa/st: Reduce the number of frontbuffer flush calls) Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Bruce Cherniak <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Tested-by: Dieter Nützel <[email protected]> Tested-by: Bruce Cherniak <[email protected]> Tested-By: Gert Wollny <[email protected]>
* mesa/st/tests: Fix regressions with libunwind enabled introduced with 7be6d8fe12Gert Wollny2017-09-071-0/+1
| | | | | | | | Add the according flags to link with libunwind. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=102565 Tested-by: Michel Dänzer <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* st/mesa: skip draw calls with pipe_draw_info::count == 0Marek Olšák2017-09-071-1/+6
| | | | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102502 Cc: 17.2 <[email protected]> Tested-by: Alexandre Demers <[email protected]> Tested-by: Dieter Nützel <[email protected]> Acked-by: Timothy Arceri <[email protected]>
* mesa/st/st_glsl_to_tgsi_temprename.cpp: Fix compilation with MSVCGert Wollny2017-09-061-1/+9
| | | | | | | | | | If <windows.h> is included then max is a macro that clashes with std::numeric_limits::max, hence undefine it. For some reason the struct access_record is not recognizes outside the anonymouse namespace, make it a class. The patch successfully was tested on AppVeyor. Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/st: glsl_to_tgsi: tie in new temporary register merge approachGert Wollny2017-09-061-50/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces the old register lifetime estiamtion and rename mapping evaluation with the new one. Performance to compare between the current and the new implementation were measured by running the shader-db in one thread. ----------------------------------------------------------- old new(std::sort) ---------------- time ./run -j1 shaders -------------------- real 5.80s 5.75s user 5.75s 5.70s sys 0.05s 0.05s ---- valgrind --tool=callgrind --dump-instr=yes------------ merge 0.08% 0.18% estimate lifetime 0.02% 0.11% evaluate mapping (incl=0.3%) 0.04% apply mapping 0.03% 0.02% --- perf (approximate because of statistic sampling) ---- merge (total) 0.09% 0.16% estimate lifetime 0.03% 0.10% evaluate mapping (incl=0.02%) 0.04% apply mapping 0.04% 0.04% Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/st: glsl_to_tgsi: Add test set for evaluation of rename mappingGert Wollny2017-09-061-0/+169
| | | | | | | The patch adds tests for the register rename mapping evaluation and combined life time estimation and renaming. Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/st: glsl_to_tgsi: add register rename mapping evaluatorGert Wollny2017-09-063-5/+137
| | | | | | | | | | | | | | | The remapping evaluator first sorts the temporary registers ascending based on their first life time instruction, and then uses a binary search to find merge canidates. For the initial sorting it uses std::sort because qsort is quite slow in comparison. By removing the define USE_STL_SORT in src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp one can enable the alternative code path that uses qsort. Registers that are not written to are not considered for renaming since in glsl_to_tgsi_visitor::renumber_registers they are eliminated anyway. Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/st: glsl_to_tgsi: add tests for the new temporary lifetime trackerGert Wollny2017-09-064-3/+1481
| | | | | | This patch adds a set of unit tests for the new lifetime tracker. Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/st: glsl_to_tgsi: implement new temporary register lifetime trackerGert Wollny2017-09-062-0/+941
| | | | | | | | | | | | | | | | | | This patch adds a class for tracking the life times of temporary registers in the glsl to tgsi translation. The algorithm runs in three steps: First, in order to minimize the number of needed memory allocations the program is scanned to evaluate the number of scopes. Then, the program is scanned second time to record the important register access time points: first and last reads and writes and their link to the execution scope (loop, if/else branch, switch case). In the third step for each register the actual minimal life time is evaluated. In addition, when compiled in debug mode (i.e. NDEBUG is not defined) the shaders and estimated temporary life times can be logged to stderr by setting the environment variable GLSL_TO_TGSI_RENAME_DEBUG. Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/st: glsl_to_tgsi move some helper classes to extra filesGert Wollny2017-09-063-287/+366
| | | | | | | | | | | | | | | | | | | | | | | To prepare the implementation of a temp register lifetime tracker some of the classes are moved into seperate header/implementation files to make them accessible from other files. Specifically these are: class st_src_reg; class st_dst_reg; class glsl_to_tgsi_instruction; struct rename_reg_pair; int swizzle_for_type(const glsl_type *type, int component); as inline: bool is_resource_instruction(unsigned opcode); unsigned num_inst_dst_regs(const glsl_to_tgsi_instruction *op); unsigned num_inst_src_regs(const glsl_to_tgsi_instruction *op); Reviewed-by: Nicolai Hähnle <[email protected]>
* st_glsl_to_tgsi: rewrite rename registers to use array fully.Dave Airlie2017-09-061-29/+26
| | | | | | | | | | Instead of having to search the whole array, just use the whole thing and store a valid bit in there with the rename. Removes this from the profile on some of the fp64 tests Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* st/glsl_to_tgsi: inline src_register into translate_srcNicolai Hähnle2017-09-041-75/+77
| | | | | | | | | | | src_register has no meaningful standalone use, it only makes sense when called from translate_src. v2: fix input array handling Acked-by: Roland Scheidegger <[email protected]> (v1) Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* st/glsl_to_tgsi: ir_load_ubo always has a second indexNicolai Hähnle2017-09-041-2/+1
| | | | | | Acked-by: Roland Scheidegger <[email protected]> Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* st/drawpixels: always use two-dimensional constant referencesNicolai Hähnle2017-09-041-0/+2
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* st/mesa: fix view template initialization in try_pbo_readpixelsRoland Scheidegger2017-09-031-1/+1
| | | | | | | | | | | | I think this is what the code was meant to do, albeit as far as I can tell the redundant initialization some analyzers complain about should work as well just fine (only the first layer will be used, if the view contains one or more layers doesn't really matter). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102467 Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Cc: [email protected]
* st/mesa: only try to create 1x msaa surfaces for "fake" msaa driversBrian Paul2017-08-313-14/+24
| | | | | | | | | | | | | | | | | | | | For software drivers where we want "fake" msaa support for GL 3.x, we treat 1 sample as being msaa. For drivers with real msaa support, start format probing at 2x msaa. For drivers with fake msaa support, start format probing at 1x msaa. This also tweaks the MaxSamples code in st_init_extensions() so that we use MaxSamples=1 for fake msaa. This allows the format proble loops to run at least one iteration. This fixes a llvmpipe/VTK regression from commit 6839d3369905eb02151. And for drivers with fake msaa support, calls such as glTexImage2DMultisample(samples=1) will now succeed. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102038 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102125 Reviewed-by: Roland Scheidegger <[email protected]>
* mesa/st: remove unwanted backup fileEric Engestrom2017-08-301-479/+0
| | | | | | | Fixes: 0ac78dc92582a59d4319 "util: move string_to_uint_map to glsl" Cc: Emil Velikov <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* util: move string_to_uint_map to glslEmil Velikov2017-08-292-1/+480
| | | | | | | | | | | | | | | | | | The functionality is used by glsl and mesa. With the latter already depending on the former. With this in place the src/util/ static library libmesautil.la no longer has a C++ dependency. Thus objects which use it (like libEGL) don't need the C++ link. Cc: "17.2" <[email protected]> Fixes: 02cc35937277 ("egl/wayland: Use linux-dmabuf interface for buffers") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101851 Signed-off-by: Emil Velikov <[email protected]> Suggested-by: Jason Ekstrand <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Tested-by: Mike Lothian <[email protected]> Tested-by: James Harvey <[email protected]>
* st/mesa: fix XPD lowering - don't read dstMarek Olšák2017-08-291-3/+6
| | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102461 Reviewed-by: Brian Paul <[email protected]>
* st/mesa: fix handling of vertex array double inputsIlia Mirkin2017-08-281-1/+3
| | | | | | | | | | | | | The is_double_vertex_input needs to be set for arrays of doubles as well. Fixes KHR-GL45.enhanced_layouts.varying_array_locations Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: [email protected]
* mesa: Implement GL_ARB_polygon_offset_clampAdam Jackson2017-08-251-1/+1
| | | | | | | | | | | Semantically identical to the EXT version (whose string is still valid for GLES), so rename the bit but expose both extension strings. (Suggested by Ilia Mirkin and Ian Romanick.) v3: Fix the entrypoint alias in GL4x.xml (Ilia) Signed-off-by: Adam Jackson <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* mesa: Implement GL_ARB_texture_filter_anisotropicAdam Jackson2017-08-251-0/+4
| | | | | | | | | | | The only difference from the EXT version is bumping the minmax to 16, so just hit all the drivers at once. v2: Fix driver names, add to 17.3 release notes (Ilia Mirkin) Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Adam Jackson <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: pass shader source keys to the disk cacheTimothy Arceri2017-08-251-1/+1
| | | | | | | We don't actually write them to disk here. That will happen in the following commit. Reviewed-by: Nicolai Hähnle <[email protected]>
* st/mesa: add const qualifiers in st_extensions.cBrian Paul2017-08-241-5/+5
| | | | Trivial.
* st/mesa: whitespace/indentation fixes in st_init_extensions()Brian Paul2017-08-241-5/+6
|
* gallium: remove TGSI opcode SCSMarek Olšák2017-08-222-12/+4
| | | | | | | use COS+SIN instead. Reviewed-by: Roland Scheidegger <[email protected]> Acked-by: Jose Fonseca <[email protected]>
* st/glsl_to_tgsi: fix getting the image type for array of structs (again)Samuel Pitoiset2017-08-221-5/+3
| | | | | | | | | | | We want the type of the field, not of the struct. This fixes a regression in the following piglit test: arb_bindless_texture/compiler/images/arrays-of-struct.frag Fixes: 49d9286a3f ("glsl: stop copying struct and interface member names") Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* gallium: remove TGSI opcode XPDMarek Olšák2017-08-221-7/+11
| | | | | | use MUL+MAD+MOV instead. Reviewed-by: Roland Scheidegger <[email protected]>
* gallium: remove TGSI opcode DPHMarek Olšák2017-08-221-2/+11
| | | | | | use DP4 or DP3 + ADD. Reviewed-by: Roland Scheidegger <[email protected]>
* gallium: remove TGSI opcode DP2AMarek Olšák2017-08-221-1/+0
| | | | | | use DP3 instead. Reviewed-by: Roland Scheidegger <[email protected]>
* glsl_to_tgsi: clean up opcode translationMarek Olšák2017-08-221-62/+30
| | | | | | An island of beauty in the middle of chaos. Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: pass ctx to add_uniform_to_shader constructorTimothy Arceri2017-08-222-2/+2
| | | | | | Fixes: 4c2422067b5c ("glsl: pass UseSTD430AsDefaultPacking to where it will be used") Reviewed-by: Samuel Pitoiset <[email protected]>
* mesa/st: simplify some UBO index logicTimothy Arceri2017-08-221-3/+2
| | | | Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: remove Windows hack for glFinishBrian Paul2017-08-161-12/+0
| | | | | | | | | | | | | | I see no evidence that opengl32.dll's wglSwapBuffers calls glFinish. It looks like Jose removed that dependency years ago, but this hack remained. Removing this code also fixes the Piglit sync_api test since commit eceb6710024716. No piglit regressions. No glretrace regressions, per Charmaine. Fixes VMware bug 1937990. Reviewed-by: Charmaine Lee <[email protected]>
* st/mesa: fix a null pointer accessFrank Richter2017-08-161-1/+1
| | | | | | | | Fixes crash with llvmpipe on Windows. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102148 Cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* st/mesa: correctly calculate the storage offsetTimothy Arceri2017-08-153-2/+163
| | | | | | | | | | When generating the storage offset for struct members we need to skip opaque types as they no longer have backing storage. Fixes: fcbb93e86024 ("mesa: stop assigning unused storage for non-bindless opaque types") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101983 Reviewed-by: Dave Airlie <[email protected]>
* glsl: pass mem_ctx to constant_expression_value(...) and friendsTimothy Arceri2017-08-111-2/+5
| | | | | | | | | | | | | | | | | | | | The main motivation for this is that threaded compilation can fall over if we were to allocate IR inside constant_expression_value() when calling it on a builtin. This is because builtins are shared across the whole OpenGL context. f81ede469910d worked around the problem by cloning the entire builtin before constant_expression_value() could be called on it. However cloning the whole function each time we referenced it lead to a significant reduction in the GLSL IR compiler performance. This change along with the following patch helps fix that performance regression. Other advantages are that we reduce the number of calls to ralloc_parent(), and for loop unrolling we free constants after they are used rather than leaving them hanging around. Reviewed-by: Kenneth Graunke <[email protected]>