Commit graph

73561 commits

Author SHA1 Message Date
Brian Paul
cb473c46fe glsl: silence warning about unhandled ast_unsized_array_dim case in switch
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
2015-10-16 11:34:05 -06:00
Brian Paul
afff809fea st/mesa: fix incorrect pointer type arguments in st_new_program()
Silences 5 warnings of the type:
state_tracker/st_cb_program.c: In function 'st_new_program':
state_tracker/st_cb_program.c:108:7: warning: passing argument 1 of
'_mesa_init_gl_program' from incompatible pointer type [enabled by default]
       return _mesa_init_gl_program(&prog->Base, target, id);
       ^
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-10-16 09:15:05 -06:00
Brian Paul
4627e8058e Revert "mesa: remove FLUSH_VERTICES() in _mesa_MatrixMode()"
This reverts commit 0de5e0f3fb.

Michel Dänzer spotted two piglit regressions from the change.  I suspect
that removing the FLUSH_VERTICES() actually exposed a bug elsewhere but
I don't have time to hunt down the root issue at this time.
2015-10-16 09:10:22 -06:00
Samuel Iglesias Gonsalvez
ccbb52ac11 glsl: fix check SSBOs support for builtin functions
has_shader_storage_buffer_objects() returns true also if the OpenGL
context is 4.30 or ES 3.1.

Previously, we were saying that all atomic*() GLSL builtin functions
for SSBOs were not available when OpenGL ES 3.1 context was in use.

Fixes 48 dEQP-GLES31 tests:

dEQP-GLES31.functional.ssbo.atomic.*

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2015-10-16 12:47:58 +02:00
Tapani Pälli
dc8c221e28 mesa: Set api prefix to version string when overriding version
Otherwise there are problems when user overrides version and application
such as Piglit wants to detect used api with glGetString(GL_VERSION).

This makes it currently impossible to run glslparsertest tests for
OpenGL ES when using version override.

Below is example when using MESA_GLES_VERSION_OVERRIDE=3.1.

Before:
	"3.1 Mesa 11.1.0-devel (git-24a1a15)"

After:
	"OpenGL ES 3.1 Mesa 11.1.0-devel (git-78042ff)"

v2: only include api prefix for OpenGL ES (Boyan Ding)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
2015-10-16 12:58:52 +03:00
Iago Toral Quiroga
c8f5274b52 nir: Get the number of SSBOs and UBOs right
Before d31f98a272 and 56e2bdbca3 we had a sigle index space for UBOs
and SSBOs, so NumBufferInterfaceBlocks would contain the combined number of
blocks, not just one kind. This means that for shader programs using both
UBOs and SSBOs, we were setting num_ssbos and num_ubos to a larger number than
we should. Since the above commits  we have separate index spaces for each
so we can just get the right numbers.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-10-16 10:12:44 +02:00
Iago Toral Quiroga
f534f331ca i965/vec4: Use the right number of UBOs
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-10-16 10:12:44 +02:00
Iago Toral Quiroga
6f9ca30266 i965/fs: use the right number of UBOs
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-10-16 10:12:44 +02:00
Rob Clark
ef7a563829 freedreno: add debug option to dirty state after draw
Similar to "dclear", "ddraw" will mark all state dirty after each draw.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-10-15 18:04:18 -04:00
Rob Clark
6206da736c freedreno/a3xx: cache-flush is needed after MEM_WRITE
Otherwise the mem2gmem blit would see potentially bogus texture
coordinates.  Fixes an issue that shows up with glamor.

CC: "11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-10-15 18:04:17 -04:00
Rob Clark
fefffdc2b2 gallium/util: fix debug_get_flags_option on 32-bit harder
(yes, we want PRI?64, but we want the x version rather than the u
version)

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-10-15 18:04:17 -04:00
Chih-Wei Huang
7599f8b167 nv30: include the header of ffs prototype
It fixes a building error of the android 6.0 64-bit target.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
2015-10-15 15:00:14 -04:00
Chih-Wei Huang
d31005e3e5 nv50/ir: use C++11 standard std::unordered_map if possible
Note Android version before Lollipop is not supported.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
2015-10-15 14:59:59 -04:00
Jason Ekstrand
5f106153f5 nir/prog: Don't double-insert the fog-coord variable
nir_variable_create already inserts it in the right list for us so
inserting it again causes a linked list corruption.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-10-15 10:48:21 -07:00
Jason Ekstrand
b705005584 nir/glsl: Use shader_prog->Name for naming the NIR shader
This has the better name to use. Aparently, sh->Name is usually 0.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2015-10-15 07:31:09 -07:00
Jason Ekstrand
eb893c220c nir: Add helpers for creating variables and adding them to lists
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2015-10-15 07:31:09 -07:00
Jason Ekstrand
635daef76e nir/prog: Use nir_foreach_variable
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2015-10-15 07:31:09 -07:00
Brian Paul
5d954fd5cb mesa: wrap a ridiculously long line in es1_conversion.c
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-10-15 07:21:08 -06:00
Brian Paul
d8c23d156d mesa: add num_buffers() helper in blend.c
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-10-15 07:21:08 -06:00
Brian Paul
dfbd62e772 mesa: optimize _UsesDualSrc blend flag setting
For glBlendFunc and glBlendFuncSeparate(), the _UsesDualSrc flag
will be the same for all buffers, so no need to compute it N times.

Reviewed-by: Eric Anholt <eric@anholt.net>
2015-10-15 07:21:08 -06:00
Brian Paul
d21e17f48f mesa: fix incorrect error string in _mesa_BlendEquationiARB()
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-10-15 07:21:07 -06:00
Brian Paul
1d75165501 mesa: move validate_blend_factors() call after no-change check
A redundant call to glBlendFuncSeparateiARB() is more likely than getting
invalid values, so do the no-op check first.

Reviewed-by: Eric Anholt <eric@anholt.net>
2015-10-15 07:21:07 -06:00
Brian Paul
34de3c4c16 mesa: optimize no-change check in _mesa_BlendEquationSeparate()
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-10-15 07:21:07 -06:00
Brian Paul
2dfedf105d mesa: optimize no-change check in _mesa_BlendEquation()
Same story as preceeding change to _mesa_BlendFuncSeparate().

Reviewed-by: Eric Anholt <eric@anholt.net>
2015-10-15 07:21:07 -06:00
Brian Paul
6fd29e6c31 mesa: optimize no-change check in _mesa_BlendFuncSeparate()
Streamline the checking for no state change in _mesa_BlendFuncSeparate()
(and _mesa_BlendFunc()).  If _BlendFuncPerBuffer is false, we only need
to check the 0th buffer state.  Move argument validation after the no-op
check.

I'm looking at an app that issues about 1000 redundant glBlendFunc()
calls per frame!

Reviewed-by: Eric Anholt <eric@anholt.net>
2015-10-15 07:21:07 -06:00
Brian Paul
083b3f5cb4 mesa: short-cut new_state == _NEW_LINE in _mesa_update_state_locked()
We can skip to the end of _mesa_update_state_locked() if only the
_NEW_LINE flag is set since none of the derived state depends on it
(just like _NEW_CURRENT_ATTRIB).  Note that we still call the
ctx->Driver.UpdateState() function, of course.

v2: use bitmask-based test, per Eric.

Reviewed-by: Eric Anholt <eric@anholt.net>
2015-10-15 07:21:07 -06:00
Brian Paul
0de5e0f3fb mesa: remove FLUSH_VERTICES() in _mesa_MatrixMode()
Changing the matrix mode alone has no effect on rendering and does
not need to trigger a flush or state validation.

Reviewed-by: Eric Anholt <eric@anholt.net>
2015-10-15 07:21:07 -06:00
Chih-Wei Huang
67d8518a0e mesa: android: Fix the incorrect path of sse_minmax.c
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Fixes: 669cfc267a (android: mesa: fix the path of the SSE4_1
optimisations)
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-10-15 13:41:02 +01:00
Mauro Rossi
45f0392ceb i965: android: add the i965_compile_FILES sources to the driver
i965_compile_FILES are needed otherwise we'll error out as below:

target SharedLib: i915_dri (out/target/product/x86/obj/SHARED_LIBRARIES/i915_dri_intermediates/LINKED/i915_dri.so)
external/mesa/src/mesa/drivers/dri/i965/brw_ir_fs.h:181: error: undefined reference to 'fs_inst::~fs_inst()'
...
...
external/mesa/src/mesa/drivers/dri/i965/intel_screen.c:1484: error: undefined reference to 'brw_compiler_create'
collect2: error: ld returned 1 exit status
build/core/shared_library.mk:81: recipe for target 'out/target/product/x86/obj/SHARED_LIBRARIES/i965_dri_intermediates/LINKED/i965_dri.so' failed
make: *** [out/target/product/x86/obj/SHARED_LIBRARIES/i965_dri_intermediates/LINKED/i965_dri.so] Error 1

[Emil Velikov: tweak commit message]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-10-15 13:35:19 +01:00
Emil Velikov
bcb56c2c69 program: convert _mesa_init_gl_program() to take struct gl_program *
Rather than accepting a void pointer, only to down and up cast around
it, convert the function to take the base (struct gl_program) pointer.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-10-15 13:30:52 +01:00
Emil Velikov
2034bdd46c nir: include nir_instr_set.h in the tarball
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2015-10-15 13:30:22 +01:00
Timothy Arceri
8da9e154b7 glsl: Allow arrays of arrays in GLSL ES 3.10 and GLSL 4.30
V3: use a check_*_allowed style function for requirements checking
rather than has_* which doesn't encapsulate the error message

V2: add missing 's' to the extension name in error messages
 and add decimal place in version string

Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
2015-10-15 21:42:24 +11:00
Timothy Arceri
f22b7933e2 glsl: allow for AoA in calculating offset to ubo start region
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2015-10-15 21:42:24 +11:00
Timothy Arceri
bb5aeb8549 glsl: build ubo name and indexing offset for AoA
V2: split out unrelated change as suggested by Samuel

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2015-10-15 21:42:24 +11:00
Timothy Arceri
8cf1333b18 glsl: link uniform block arrays of arrays
This adds support for setting up the UniformBlock structures for AoA
and also adds support for resizing AoA blocks with a packed layout.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2015-10-15 21:42:24 +11:00
Timothy Arceri
d9f1f2bbc6 glsl: Add AoA support when checking for non-const index
When checking for non-const indexing of interfaces
take into account arrays of arrays

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2015-10-15 21:42:24 +11:00
Timothy Arceri
082b1ca2fe glsl: Add support for lowering interface block arrays of arrays
V2: make array processing functions static

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2015-10-15 21:42:24 +11:00
Timothy Arceri
132b9e9dd9 glsl: add AoA support for an inteface with unsized array members
Add support for setting the max access of an unsized member
of an interface array of arrays.

For example ifc[j][k].foo[i] where foo is unsized.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-10-15 21:42:24 +11:00
Timothy Arceri
d1d05c0f85 glsl: add AoA support for linking interface blocks with unsized members
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-10-15 21:42:24 +11:00
Timothy Arceri
dd89880dc0 glsl: avoid hitting assert for arrays of arrays
Also add TODO comment about adding proper support

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-10-15 21:21:33 +11:00
Timothy Arceri
2d7a98de18 glsl: add AoA support for atomic counters
This marks all counters in an AoA as active.

For AoA all but the innermost array are treated as separate
counters/uniforms. The Nvidia binary also goes further and
finds inactive counters in the AoA, in future we should do
this too, however this gets things working for the time being.

This change also removes the use of UniformHash for atomic counters,
this avoids having to generate name strings used as hash keys.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-10-15 21:21:27 +11:00
Timothy Arceri
261a434996 glsl: add std140 layout support for AoA
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-10-15 20:44:33 +11:00
Timothy Arceri
176e6930e6 i965: add arrays of arrays support for varyings
V2: get the correct vector elements value for outputs

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2015-10-15 20:44:26 +11:00
Timothy Arceri
be822b89ac glsl: calculate AoA uniform offset correctly for structs
This allows the correct offset to be calculated for use in indirect
indexing of samplers.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2015-10-15 20:44:20 +11:00
Timothy Arceri
410609c968 glsl: remove dead code in a single pass
Currently only one ir assignment is removed for each var in a single
dead code optimisation pass. This means if a var has more than one
assignment, then it requires all the glsl optimisations to be run again
for each additional assignment to be removed.
Another pass is also required to remove the variable itself.

With this change all assignments and the variable are removed in a single
pass.

Some of the arrays of arrays conformance tests that were looping
through 8 dimensions ended up with a var with hundreds of assignments.

This change helps ES31-CTS.arrays_of_arrays.InteractionFunctionCalls1
go from around 3 min 20 sec -> 2 min

ES31-CTS.arrays_of_arrays.InteractionFunctionCalls2 went from
around 9 min 20 sec to 7 min 30 sec

I had difficulty getting the public shader-db to give a consistent result
with or without this change but the results seemed unchanged at between
15-20 seconds.

Thomas Helland measured change with shader-db on his machine from
approx 117 secs to 112 secs.

V3: Simplify freeing of list as suggested by Ian, and spelling fixes.

V2: Add assert to be sure references are counted before assignments.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-By: Thomas Helland <thomashelland90@gmail.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
2015-10-15 20:36:14 +11:00
Timothy Arceri
d337da81f2 glsl: dont allow gl_PerVertex to be redeclared as an array of arrays
V3: move patch after fixes to ast for AoA and add const to helper
as suggested by Ian

V2: move single dimensional array detection into a helper

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-10-15 20:36:01 +11:00
Timothy Arceri
dea0af8f82 glsl: check that only the outermost array is unsized
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2015-10-15 20:35:54 +11:00
Timothy Arceri
3129359ed7 glsl: allow AoA to be sized by initializer or constructor
V2: Split out unsized array validation to its own patch as
suggested by Samuel.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2015-10-15 20:35:45 +11:00
Timothy Arceri
296a7ea471 glsl: add support for initialising sampler AoA
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-10-15 20:35:40 +11:00
Timothy Arceri
db280e951a glsl: Add support for linking uniform arrays of arrays
V3: Fix setting of data.location for struct AoA UBO members

V2: Handle arrays of arrays in the same way structures are handled

The ARB_arrays_of_arrays spec doesn't give very many details on how
AoA uniforms are intended to be implemented. However in the
ARB_program_interface_query spec there are details that show AoA are
intended to be handled in a similar way to structs.

Issues 7 from the ARB_program_interface_query spec:

 We define rules consistent with our enumeration rules for
 other complex types.  For existing one-dimensional arrays, we enumerate
 a single entry if the array is an array of basic types, or separate
 entries for each array element if the array is an array of structures.
 We follow similar rules here.  For a uniform array such as:

   uniform vec4 a[5][4][3];

 we enumerate twenty different entries ("a[0][0][0]" through
 "a[4][3][0]"), each of which is treated as an array with three elements.
 This is morally equivalent to what you'd get if you worked around the
 limitation in current GLSL via:

    struct ArrayBottom { vec4 c[3]; };
    struct ArrayMid    { ArrayBottom b[3]; };
    uniform ArrayMid   a[5];

 which would enumerate "a[0].b[0].c[0]" through "a[4].b[3].c[0]".

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-10-15 20:35:35 +11:00