mesa.git
9 years agofreedreno/a3xx: cache-flush is needed after MEM_WRITE
Rob Clark [Thu, 15 Oct 2015 20:22:23 +0000 (16:22 -0400)]
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>
9 years agogallium/util: fix debug_get_flags_option on 32-bit harder
Rob Clark [Thu, 15 Oct 2015 17:30:24 +0000 (13:30 -0400)]
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>
9 years agonv30: include the header of ffs prototype
Chih-Wei Huang [Thu, 15 Oct 2015 15:46:32 +0000 (23:46 +0800)]
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
9 years agonv50/ir: use C++11 standard std::unordered_map if possible
Chih-Wei Huang [Thu, 15 Oct 2015 15:46:30 +0000 (23:46 +0800)]
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
9 years agonir/prog: Don't double-insert the fog-coord variable
Jason Ekstrand [Thu, 15 Oct 2015 16:20:24 +0000 (09:20 -0700)]
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>
9 years agonir/glsl: Use shader_prog->Name for naming the NIR shader
Jason Ekstrand [Fri, 9 Oct 2015 01:36:27 +0000 (18:36 -0700)]
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>
9 years agonir: Add helpers for creating variables and adding them to lists
Jason Ekstrand [Fri, 9 Oct 2015 14:05:11 +0000 (07:05 -0700)]
nir: Add helpers for creating variables and adding them to lists

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agonir/prog: Use nir_foreach_variable
Jason Ekstrand [Fri, 9 Oct 2015 14:02:57 +0000 (07:02 -0700)]
nir/prog: Use nir_foreach_variable

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agomesa: wrap a ridiculously long line in es1_conversion.c
Brian Paul [Wed, 14 Oct 2015 15:53:53 +0000 (09:53 -0600)]
mesa: wrap a ridiculously long line in es1_conversion.c

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: add num_buffers() helper in blend.c
Brian Paul [Wed, 14 Oct 2015 15:53:26 +0000 (09:53 -0600)]
mesa: add num_buffers() helper in blend.c

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: optimize _UsesDualSrc blend flag setting
Brian Paul [Wed, 14 Oct 2015 16:08:18 +0000 (10:08 -0600)]
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>
9 years agomesa: fix incorrect error string in _mesa_BlendEquationiARB()
Brian Paul [Wed, 14 Oct 2015 15:34:39 +0000 (09:34 -0600)]
mesa: fix incorrect error string in _mesa_BlendEquationiARB()

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: move validate_blend_factors() call after no-change check
Brian Paul [Wed, 14 Oct 2015 15:35:53 +0000 (09:35 -0600)]
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>
9 years agomesa: optimize no-change check in _mesa_BlendEquationSeparate()
Brian Paul [Wed, 14 Oct 2015 15:45:36 +0000 (09:45 -0600)]
mesa: optimize no-change check in _mesa_BlendEquationSeparate()

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: optimize no-change check in _mesa_BlendEquation()
Brian Paul [Wed, 14 Oct 2015 15:41:11 +0000 (09:41 -0600)]
mesa: optimize no-change check in _mesa_BlendEquation()

Same story as preceeding change to _mesa_BlendFuncSeparate().

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: optimize no-change check in _mesa_BlendFuncSeparate()
Brian Paul [Wed, 14 Oct 2015 15:31:41 +0000 (09:31 -0600)]
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>
9 years agomesa: short-cut new_state == _NEW_LINE in _mesa_update_state_locked()
Brian Paul [Wed, 14 Oct 2015 15:10:19 +0000 (09:10 -0600)]
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>
9 years agomesa: remove FLUSH_VERTICES() in _mesa_MatrixMode()
Brian Paul [Wed, 14 Oct 2015 15:08:50 +0000 (09:08 -0600)]
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>
9 years agomesa: android: Fix the incorrect path of sse_minmax.c
Chih-Wei Huang [Mon, 12 Oct 2015 15:36:59 +0000 (23:36 +0800)]
mesa: android: Fix the incorrect path of sse_minmax.c

Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Fixes: 669cfc267a1 (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>
9 years agoi965: android: add the i965_compile_FILES sources to the driver
Mauro Rossi [Sun, 11 Oct 2015 11:49:38 +0000 (13:49 +0200)]
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>
9 years agoprogram: convert _mesa_init_gl_program() to take struct gl_program *
Emil Velikov [Tue, 13 Oct 2015 10:26:09 +0000 (11:26 +0100)]
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>
9 years agonir: include nir_instr_set.h in the tarball
Emil Velikov [Sat, 10 Oct 2015 15:13:38 +0000 (16:13 +0100)]
nir: include nir_instr_set.h in the tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
9 years agoglsl: Allow arrays of arrays in GLSL ES 3.10 and GLSL 4.30
Timothy Arceri [Fri, 5 Jun 2015 23:10:55 +0000 (09:10 +1000)]
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>
9 years agoglsl: allow for AoA in calculating offset to ubo start region
Timothy Arceri [Fri, 9 Oct 2015 11:00:20 +0000 (22:00 +1100)]
glsl: allow for AoA in calculating offset to ubo start region

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: build ubo name and indexing offset for AoA
Timothy Arceri [Fri, 9 Oct 2015 10:54:09 +0000 (21:54 +1100)]
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>
9 years agoglsl: link uniform block arrays of arrays
Timothy Arceri [Tue, 25 Aug 2015 04:15:25 +0000 (14:15 +1000)]
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>
9 years agoglsl: Add AoA support when checking for non-const index
Timothy Arceri [Thu, 4 Jun 2015 01:19:05 +0000 (11:19 +1000)]
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>
9 years agoglsl: Add support for lowering interface block arrays of arrays
Timothy Arceri [Mon, 16 Mar 2015 04:31:11 +0000 (15:31 +1100)]
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>
9 years agoglsl: add AoA support for an inteface with unsized array members
Timothy Arceri [Sun, 19 Jul 2015 04:08:44 +0000 (14:08 +1000)]
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>
9 years agoglsl: add AoA support for linking interface blocks with unsized members
Timothy Arceri [Thu, 12 Mar 2015 08:52:47 +0000 (19:52 +1100)]
glsl: add AoA support for linking interface blocks with unsized members

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: avoid hitting assert for arrays of arrays
Timothy Arceri [Mon, 12 May 2014 10:25:26 +0000 (20:25 +1000)]
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>
9 years agoglsl: add AoA support for atomic counters
Timothy Arceri [Sun, 30 Aug 2015 11:08:22 +0000 (21:08 +1000)]
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>
9 years agoglsl: add std140 layout support for AoA
Timothy Arceri [Fri, 18 Sep 2015 12:51:40 +0000 (22:51 +1000)]
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>
9 years agoi965: add arrays of arrays support for varyings
Timothy Arceri [Sat, 18 Jul 2015 07:24:22 +0000 (17:24 +1000)]
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>
9 years agoglsl: calculate AoA uniform offset correctly for structs
Timothy Arceri [Thu, 17 Sep 2015 04:17:17 +0000 (14:17 +1000)]
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>
9 years agoglsl: remove dead code in a single pass
Timothy Arceri [Sat, 11 Jul 2015 11:38:54 +0000 (21:38 +1000)]
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>
9 years agoglsl: dont allow gl_PerVertex to be redeclared as an array of arrays
Timothy Arceri [Mon, 23 Jun 2014 21:43:05 +0000 (07:43 +1000)]
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>
9 years agoglsl: check that only the outermost array is unsized
Timothy Arceri [Thu, 15 Oct 2015 03:35:41 +0000 (14:35 +1100)]
glsl: check that only the outermost array is unsized

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: allow AoA to be sized by initializer or constructor
Timothy Arceri [Thu, 15 Oct 2015 03:32:41 +0000 (14:32 +1100)]
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>
9 years agoglsl: add support for initialising sampler AoA
Timothy Arceri [Wed, 29 Jul 2015 01:57:44 +0000 (11:57 +1000)]
glsl: add support for initialising sampler AoA

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: Add support for linking uniform arrays of arrays
Timothy Arceri [Sun, 5 Jul 2015 05:18:10 +0000 (15:18 +1000)]
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>
9 years agoi965: Don't hardcode FS in "validation failed!" message.
Kenneth Graunke [Tue, 13 Oct 2015 22:15:57 +0000 (15:15 -0700)]
i965: Don't hardcode FS in "validation failed!" message.

Instead, print "Scalar VS" or "Scalar FS".  Otherwise it's really
confusing which stage is broken.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: Support uint index in lower_vector_insert
Jordan Justen [Tue, 13 Oct 2015 03:28:28 +0000 (20:28 -0700)]
glsl: Support uint index in lower_vector_insert

The ES31-CTS.compute_shader.pipeline-compute-chain test case generates
an unsigned index by using gl_LocalInvocationID.x and
gl_LocalInvocationID.y as array indices.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agoglsl: Support uint index in do_vec_index_to_cond_assign
Jordan Justen [Tue, 13 Oct 2015 03:22:14 +0000 (20:22 -0700)]
glsl: Support uint index in do_vec_index_to_cond_assign

The ES31-CTS.compute_shader.pipeline-compute-chain test case generates
an unsigned index by using gl_LocalInvocationID.x and
gl_LocalInvocationID.y as array indices.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agoi965/fs: Ignore compute shaders in brw_nir_lower_inputs
Jordan Justen [Wed, 14 Oct 2015 18:33:03 +0000 (11:33 -0700)]
i965/fs: Ignore compute shaders in brw_nir_lower_inputs

The commit shown below caused compute shaders to hit the unreachable
in the default of the switch block. Since compute shaders don't have
any inputs, we can make brw_nir_lower_inputs a no-op for CS.

commit 2953c3d76178d7589947e6ea1dbd902b7b02b3d4
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Fri Aug 14 15:15:11 2015 -0700

    i965/vs: Map scalar VS input locations properly; avoid tons of MOVs.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Simplify FS in brw_nir_lower_inputs to only support scalar mode
Jordan Justen [Tue, 13 Oct 2015 00:18:51 +0000 (17:18 -0700)]
i965/fs: Simplify FS in brw_nir_lower_inputs to only support scalar mode

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: remove unused functions in program.c
Brian Paul [Wed, 14 Oct 2015 02:12:56 +0000 (20:12 -0600)]
mesa: remove unused functions in program.c

replace_registers() and adjust_param_indexes() were unused.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: minor indentation fix in _mesa_BindTextureUnit()
Brian Paul [Tue, 13 Oct 2015 15:34:53 +0000 (09:34 -0600)]
mesa: minor indentation fix in _mesa_BindTextureUnit()

9 years agomesa: remove unused texUnit local in _mesa_BindTextureUnit()
Brian Paul [Tue, 13 Oct 2015 15:32:34 +0000 (09:32 -0600)]
mesa: remove unused texUnit local in _mesa_BindTextureUnit()

The texture unit is error-checked before this and the texUnit var
is unused, so remove it.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agost/fbo: use pipe_surface_release instead of pipe_surface_reference
Krzysztof Sobiecki [Wed, 14 Oct 2015 16:03:00 +0000 (10:03 -0600)]
st/fbo: use pipe_surface_release instead of pipe_surface_reference

pipe_surface_reference have problems with deleted contexts,
so use of pipe_surface_release might be more appropriate.

Fixes Wasteland 2 Director's Cut crash on start.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoglsl: Enable split of lower UBOs and SSBO also for compute shaders
Marta Lofstedt [Wed, 14 Oct 2015 11:35:32 +0000 (13:35 +0200)]
glsl: Enable split of lower UBOs and SSBO also for compute shaders

The split of Uniform blocks and shader storage block only loops
up to MESA_SHADER_FRAGMENT and igonres compute shaders.
This cause segfault when running the OpenGL ES 3.1 CTS tests
with GL_ARB_compute_shader enabled.

V2: Changed to use MESA_SHADER_STAGES instead of
MESA_SHADER_COMPUTE

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Marta Lofstedt <marta.lofstedt@linux.intel.com>
9 years agoglsl: Include util/strndup.h.
Jose Fonseca [Wed, 14 Oct 2015 10:50:06 +0000 (11:50 +0100)]
glsl: Include util/strndup.h.

Fixes Windows builds.

Trivial.

9 years agoglsl: calculate TOP_LEVEL_ARRAY_SIZE and STRIDE when adding resources
Tapani Pälli [Wed, 14 Oct 2015 08:01:29 +0000 (11:01 +0300)]
glsl: calculate TOP_LEVEL_ARRAY_SIZE and STRIDE when adding resources

Patch moves existing calculation code from shader_query.cpp to happen
during program resource list creation.

No Piglit or CTS regressions were observed during testing.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: add top level array size and stride to gl_uniform_storage
Tapani Pälli [Tue, 13 Oct 2015 11:17:49 +0000 (14:17 +0300)]
glsl: add top level array size and stride to gl_uniform_storage

Patch adds 2 new fields to gl_uniform_storage so that we don't need to
calculate these values during runtime shader queries. This is required by
upcoming changes to free GLSL IR after linking.

Patch moves 3 booleans inside structure so that structure size stays the
same after this change.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoi965: Adapt SSBOs to work with their own separate index space
Iago Toral Quiroga [Fri, 9 Oct 2015 12:41:21 +0000 (14:41 +0200)]
i965: Adapt SSBOs to work with their own separate index space

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl/lower_ubo_reference: lower UBOs and SSBOs to separate index spaces
Iago Toral Quiroga [Fri, 9 Oct 2015 11:54:41 +0000 (13:54 +0200)]
glsl/lower_ubo_reference: lower UBOs and SSBOs to separate index spaces

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agomesa: Add {Num}UniformBlocks and {Num}ShaderStorageBlocks to gl_shader{_program}
Iago Toral Quiroga [Thu, 1 Oct 2015 08:17:30 +0000 (10:17 +0200)]
mesa: Add {Num}UniformBlocks and {Num}ShaderStorageBlocks to gl_shader{_program}

These arrays provide backends with separate index spaces for UBOS and SSBOs.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agomesa: Rename {Num}UniformBlocks to {Num}BufferInterfaceBlocks
Iago Toral Quiroga [Thu, 1 Oct 2015 07:08:20 +0000 (09:08 +0200)]
mesa: Rename {Num}UniformBlocks to {Num}BufferInterfaceBlocks

Currently, these arrays in gl_shader and gl_shader_program hold both
UBOs and SSBOs, so this looks like a better name. We were already
using NumBufferInterfaceBlocks in gl_shader_program, so this makes
things more consistent as well.

In a later patch we will add {Num}UniformBlocks and
{Num}ShaderStorageBlocks which will contain only references to
UBOs and SSBOs respectively that will provide backends with
a separate index space for both types of objects.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: Fix variable_referenced() for vector_{extract,insert} expressions
Iago Toral Quiroga [Mon, 5 Oct 2015 09:42:43 +0000 (11:42 +0200)]
glsl: Fix variable_referenced() for vector_{extract,insert} expressions

We get these when we operate on vector variables with array accessors
(i.e. things like a[0] where 'a' is a vec4). When we call variable_referenced()
on these expressions we want to return a reference to 'a' instead of NULL.

This fixes a problem where we pass a[0] as the first argument to an atomic
SSBO function that expects a buffer variable. In order to check this, we use
variable_referenced(), but that is currently returning NULL in this case, since
the underlying rvalue is a vector_extract expression.

Tested-by: Markus Wick <markus@selfnet.de>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agonir: split SSBO min/max atomic instrinsics into signed/unsigned versions
Iago Toral Quiroga [Mon, 28 Sep 2015 08:47:22 +0000 (10:47 +0200)]
nir: split SSBO min/max atomic instrinsics into signed/unsigned versions

NIR is typeless so this is the only way to keep track of the
type to select the proper atomic to use.

v2:
  - Use imin,imax,umin,umax for the intrinsic names (Connor Abbott)
  - Change message for unreachable paths (Michael Schellenberger)

Tested-by: Markus Wick <markus@selfnet.de>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/vec4: fix indentation in vec4_visitor::calculate_live_intervals
Iago Toral Quiroga [Tue, 13 Oct 2015 09:59:59 +0000 (11:59 +0200)]
i965/vec4: fix indentation in vec4_visitor::calculate_live_intervals

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoi965/fs: Fix indentation in fs_live_variables::compute_start_end
Iago Toral Quiroga [Tue, 13 Oct 2015 09:26:21 +0000 (11:26 +0200)]
i965/fs: Fix indentation in fs_live_variables::compute_start_end

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agomesa: clean up comments for gl_current_attrib struct
Brian Paul [Mon, 12 Oct 2015 20:50:17 +0000 (14:50 -0600)]
mesa: clean up comments for gl_current_attrib struct

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agovbo: make void vbo_exec_BeginVertices() static
Brian Paul [Mon, 12 Oct 2015 20:16:37 +0000 (14:16 -0600)]
vbo: make void vbo_exec_BeginVertices() static

Not called from any other file.  Rename and move before use.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agovbo: document vbo_exec_context fields
Brian Paul [Mon, 12 Oct 2015 17:01:23 +0000 (11:01 -0600)]
vbo: document vbo_exec_context fields

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agovbo: minor clean-ups for vbo_exec_fixup_vertex()
Brian Paul [Mon, 12 Oct 2015 16:58:49 +0000 (10:58 -0600)]
vbo: minor clean-ups for vbo_exec_fixup_vertex()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agovbo: add assertion in ATTR_UNION macro
Brian Paul [Mon, 12 Oct 2015 16:53:59 +0000 (10:53 -0600)]
vbo: add assertion in ATTR_UNION macro

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agovbo: add comments, braces in ATTR_UNION() in vbo_exec_api.c
Brian Paul [Mon, 12 Oct 2015 16:52:58 +0000 (10:52 -0600)]
vbo: add comments, braces in ATTR_UNION() in vbo_exec_api.c

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agovbo: fix whitespace in vbo_exec_draw.c
Brian Paul [Mon, 12 Oct 2015 16:47:26 +0000 (10:47 -0600)]
vbo: fix whitespace in vbo_exec_draw.c

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agovbo: move 'tmp' var initialization
Brian Paul [Mon, 12 Oct 2015 16:43:36 +0000 (10:43 -0600)]
vbo: move 'tmp' var initialization

Improve readability a bit.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agovbo: improve fprintf() formatting
Brian Paul [Mon, 12 Oct 2015 16:43:11 +0000 (10:43 -0600)]
vbo: improve fprintf() formatting

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agovbo: simplify vertex array initializations in vbo_context.c
Brian Paul [Mon, 12 Oct 2015 15:55:57 +0000 (09:55 -0600)]
vbo: simplify vertex array initializations in vbo_context.c

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agovbo: get rid of needless NR_MAT_ATTRIBS constant
Brian Paul [Mon, 12 Oct 2015 17:26:16 +0000 (11:26 -0600)]
vbo: get rid of needless NR_MAT_ATTRIBS constant

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agovbo: fix incorrect switch statement in init_mat_currval()
Brian Paul [Mon, 12 Oct 2015 17:32:35 +0000 (11:32 -0600)]
vbo: fix incorrect switch statement in init_mat_currval()

The variable 'i' is a value in [0, MAT_ATTRIB_MAX-1] so subtracting
VERT_ATTRIB_GENERIC0 gave a bogus value and we executed the default
switch clause for all loop iterations.

This doesn't fix any known issues but was clearly incorrect.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agomesa: pass caller name to create_textures()
Brian Paul [Thu, 8 Oct 2015 20:45:28 +0000 (14:45 -0600)]
mesa: pass caller name to create_textures()

Simpler than the dsa flag approach.

9 years agoglsl: fix matrix stride calculation for std430's row_major matrices with two columns
Samuel Iglesias Gonsalvez [Thu, 1 Oct 2015 14:46:55 +0000 (16:46 +0200)]
glsl: fix matrix stride calculation for std430's row_major matrices with two columns

This is the result of applying several rules:

From OpenGL 4.3 spec, section 7.6.2.2 "Standard Uniform Block Layout":

"2. If the member is a two- or four-component vector with components
consuming N basic machine units, the base alignment is 2N or 4N,
respectively."
[...]
"4. If the member is an array of scalars or vectors, the base alignment
and array stride are set to match the base alignment of a single array
element, according to rules (1), (2), and (3), and rounded up to the
base alignment of a vec4."
[...]
"7. If the member is a row-major matrix with C columns and R rows, the
matrix is stored identically to an array of R row vectors with C
components each, according to rule (4)."
[...]
"When using the std430 storage layout, shader storage blocks will be
laid out in buffer storage identically to uniform and shader storage
blocks using the std140 layout, except that the base alignment and
stride of arrays of scalars and vectors in rule 4 and of structures in
rule 9 are not rounded up a multiple of the base alignment of a vec4."

In summary: vec2 has a base alignment of 2*N, a row-major mat2xY is
stored like an array of Y row vectors with 2 components each. Because
of std430 storage layout, the base alignment of the array of vectors
is not rounded up to vec4, so it is still 2*N.

Fixes 15 dEQP tests:

dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_lowp_mat2
dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_mediump_mat2
dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_highp_mat2
dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_lowp_mat2x3
dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_mediump_mat2x3
dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_highp_mat2x3
dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_lowp_mat2x4
dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_mediump_mat2x4
dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_highp_mat2x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std430.row_major_mat2
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std430.row_major_mat2x3
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std430.row_major_mat2x4
dEQP-GLES31.functional.ssbo.layout.instance_array_basic_type.std430.row_major_mat2
dEQP-GLES31.functional.ssbo.layout.instance_array_basic_type.std430.row_major_mat2x3
dEQP-GLES31.functional.ssbo.layout.instance_array_basic_type.std430.row_major_mat2x4

v2:
- Add spec quote in both commit log and code (Timothy)

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
9 years agor600/vce: enable VCE for trinity/richland
Christian König [Sun, 11 Oct 2015 18:13:25 +0000 (20:13 +0200)]
r600/vce: enable VCE for trinity/richland

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agor600/uvd: disable UVD tiling by default
Christian König [Sun, 11 Oct 2015 18:09:52 +0000 (20:09 +0200)]
r600/uvd: disable UVD tiling by default

It has only minimal advantages for post processing and doesn't work with VCE.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agor600g: Enable GL_ARB_gpu_shader5 extension
Glenn Kennard [Wed, 7 Oct 2015 15:17:34 +0000 (17:17 +0200)]
r600g: Enable GL_ARB_gpu_shader5 extension

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agor600g/sb: SB support for UBO indexing
Glenn Kennard [Wed, 7 Oct 2015 15:17:33 +0000 (17:17 +0200)]
r600g/sb: SB support for UBO indexing

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agor600g/sb: Support gs5 sampler indexing (v2)
Glenn Kennard [Mon, 21 Sep 2015 14:21:37 +0000 (16:21 +0200)]
r600g/sb: Support gs5 sampler indexing (v2)

[airlied: v2 cayman fixups]

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoi965/vs: Simplify fs_visitor's ATTR file.
Kenneth Graunke [Fri, 14 Aug 2015 23:01:33 +0000 (16:01 -0700)]
i965/vs: Simplify fs_visitor's ATTR file.

Previously, ATTR was indexed by VERT_ATTRIB_* slots; at the end of
compilation, assign_vs_urb_setup() translated those into GRF units,
and converted ATTR to HW_REGs.

This patch moves the transslation earlier, making ATTR work in terms of
GRF units from the beginning.  assign_vs_urb_setup() simply has to add
the number of payload registers and push constants to obtain the final
hardware GRF number.  (We can't do this earlier as those values aren't
known.)

ATTR still supports reg_offset; however, it's simply added to reg.
It's not clear whether this is valuable or not.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonouveau: avoid double-emitting fence
Ilia Mirkin [Mon, 12 Oct 2015 21:15:32 +0000 (17:15 -0400)]
nouveau: avoid double-emitting fence

The act of ensuring that there is space can cause a flush to happen,
which will emit the current screen fence. If that is the fence we're
trying to wait on, then it will have been emitted as a result of doing
the PUSH_SPACE. Don't attempt to emit it a second time.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Fixes: 8053c9208f (nouveau: avoid emitting new fences unnecessarily)
Cc: mesa-stable@lists.freedesktop.org
9 years agoglsl: Never allow the sequence operator anywhere in an array size
Ian Romanick [Fri, 9 Oct 2015 22:26:20 +0000 (15:26 -0700)]
glsl: Never allow the sequence operator anywhere in an array size

Fixes:

    spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence-in-parenthesis.vert
    spec/glsl-es-1.00/compiler/array-sized-by-sequence-in-parenthesis.vert
    spec/glsl-es-3.00/compiler/array-sized-by-sequence-in-parenthesis.vert

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: In later GLSL versions, sequence operator is cannot be a constant expression
Ian Romanick [Wed, 7 Oct 2015 21:26:29 +0000 (14:26 -0700)]
glsl: In later GLSL versions, sequence operator is cannot be a constant expression

Fixes:
    ES3-CTS.shaders.negative.constant_sequence

    spec/glsl-es-3.00/compiler/global-initializer/from-sequence.vert
    spec/glsl-es-3.00/compiler/global-initializer/from-sequence.frag

v2: Fix a couple copy-and-paste mistake in the spec quotations.
Suggested by Matt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoglsl: Add method to determine whether an expression contains the sequence operator
Ian Romanick [Wed, 7 Oct 2015 20:03:53 +0000 (13:03 -0700)]
glsl: Add method to determine whether an expression contains the sequence operator

This will be used in the next patch to enforce some language sematics.

v2: Fix inverted logic in
ast_function_expression::has_sequence_subexpression.  The method
originally had a different name and a different meaning.  I fixed the
logic in ast_to_hir.cpp, but I only changed the names in
ast_function.cpp.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com> [v1]
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoglsl: Restrict initializers for global variables to constant expression in ES
Ian Romanick [Wed, 7 Oct 2015 00:05:55 +0000 (17:05 -0700)]
glsl: Restrict initializers for global variables to constant expression in ES

v2: Combine this check with the existing const and uniform checks.  This
change depends on the previous patch (glsl: Only set
ir_variable::constant_value for const-decorated variables).

Fixes:

    ES2-CTS.shaders.negative.initialize
    ES3-CTS.shaders.negative.initialize

    spec/glsl-es-1.00/compiler/global-initializer/from-attribute.vert
    spec/glsl-es-1.00/compiler/global-initializer/from-uniform.vert
    spec/glsl-es-1.00/compiler/global-initializer/from-uniform.frag
    spec/glsl-es-1.00/compiler/global-initializer/from-global.vert
    spec/glsl-es-1.00/compiler/global-initializer/from-global.frag
    spec/glsl-es-1.00/compiler/global-initializer/from-varying.frag
    spec/glsl-es-3.00/compiler/global-initializer/from-uniform.vert
    spec/glsl-es-3.00/compiler/global-initializer/from-uniform.frag
    spec/glsl-es-3.00/compiler/global-initializer/from-in.vert
    spec/glsl-es-3.00/compiler/global-initializer/from-in.frag
    spec/glsl-es-3.00/compiler/global-initializer/from-global.vert
    spec/glsl-es-3.00/compiler/global-initializer/from-global.frag

Note: spec/glsl-es-3.00/compiler/global-initializer/from-sequence.*
still fail because the result of a sequence operator is still considered
to be a constant expression.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92304
Reviewed-by: Tapani Pälli <tapani.palli@intel.com> [v1]
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> [v1]
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoglsl: Only set ir_variable::constant_value for const-decorated variables
Ian Romanick [Wed, 7 Oct 2015 19:52:58 +0000 (12:52 -0700)]
glsl: Only set ir_variable::constant_value for const-decorated variables

Right now we're also setting for uniforms, and that doesn't seem to hurt
things.  The next patch will make general global variables in GLSL ES,
and those definitely should not have constant_value set!

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoglsl: Use constant_initializer instead of constant_value to determine whether to...
Ian Romanick [Fri, 9 Oct 2015 00:32:41 +0000 (17:32 -0700)]
glsl: Use constant_initializer instead of constant_value to determine whether to keep an unused uniform

This even matches the comment "uniform initializers are precious, and
could get used by another stage."

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoglsl/linker: Use constant_initializer instead of constant_value to initialize uniforms
Ian Romanick [Thu, 8 Oct 2015 21:24:25 +0000 (14:24 -0700)]
glsl/linker: Use constant_initializer instead of constant_value to initialize uniforms

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoff_fragment_shader: Use binding to set the sampler unit
Ian Romanick [Thu, 8 Oct 2015 18:13:00 +0000 (11:13 -0700)]
ff_fragment_shader: Use binding to set the sampler unit

This is the way layout(binding=xxx) works from GLSL.  The old method
just happened to work (and significantly predated support for
layout(binding=xxx)), but future changes will break this.

v2: Remove some stale comments.  Suggested by Matt and Chris Forbes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoglsl: Allow built-in functions as constant expressions in OpenGL ES 1.00
Ian Romanick [Fri, 9 Oct 2015 21:17:32 +0000 (14:17 -0700)]
glsl: Allow built-in functions as constant expressions in OpenGL ES 1.00

In d4a24745 (August 2012), Paul made functions calls not be constant
expressions in GLSL ES 1.00.  Since this feature was added in desktop
GLSL 1.20, we believed that it was added in GLSL ES 3.00.  That turns
out to be completely wrong.  Built-in functions have always been allowed
as constant expressions in GLSL ES, and the patch adds the (many) spec
quotations to prove it.

While we never previously encountered this, a later patch enforces a GLSL
ES 1.00 rule that global variable initializers must be constant
expressions.  Without this fix, several dEQP tests fail.

Fixes:

    tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.frag
    tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.vert
    tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.frag
    tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.vert

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.0 10.1 10.2 10.3 10.4 10.5 10.6 11.0" <mesa-stable@lists.freedesktop.org>
Yes, I know we don't maintain stable branches that far back, but that
*is* how far back this bug goes!

9 years agou_vbuf: fix vb slot assignment for translated buffers
Nicolai Hähnle [Sat, 3 Oct 2015 22:44:00 +0000 (00:44 +0200)]
u_vbuf: fix vb slot assignment for translated buffers

Vertex attributes of different categories (constant/per-instance/
per-vertex) go into different buffers for translation, and this is now
properly reflected in the vertex buffers passed to the driver.

Fixes e.g. piglit's point-vertex-id divisor test.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoglsl: include variable name in error messages about initializers
Iago Toral Quiroga [Wed, 7 Oct 2015 07:28:43 +0000 (09:28 +0200)]
glsl: include variable name in error messages about initializers

Also fix style / wrong indentation along the way and make the messages
more uniform.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: shader outputs cannot have initializers
Iago Toral Quiroga [Wed, 7 Oct 2015 07:21:36 +0000 (09:21 +0200)]
glsl: shader outputs cannot have initializers

GLSL Spec 4.20.8, 4.3 Storage Qualifiers:

"Initializers in global declarations may only be used in declarations of
 global variables with no storage qualifier, with a const qualifier or
 with a uniform qualifier."

We do this for input variables, but not for output variables. AMD and NVIDIA
proprietary drivers don't allow this either.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Fix unsafe pointer when dumping VS/FS IR
Iago Toral Quiroga [Fri, 9 Oct 2015 05:57:19 +0000 (07:57 +0200)]
i965: Fix unsafe pointer when dumping VS/FS IR

For the VS and FS stages that use ARB_vertex_program or
ARB_fragment_program we don't have a shader program, however,
when debuging is enabled, we call brw_dump_ir like this:

brw_dump_ir("vertex", prog, &vs->base, &vp->program.Base);

where vs will be NULL (since prog is NULL).

As pointed out by Chris, this &vs->base is not really a dereference,
it simply computes a new address that just happens to be 0x0 because
the offset of base in brw_shader is 0. Then brw_dump_ir will see a
NULL pointer and not do anything. This is why this does not crash at
the moment. However, this does not look very safe (it would crash
for any location of base that is not the first in brw_shader), so
patch it to prevent a potential (even if unlikely) problem in the
future.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agomesa/uniforms: fix get_uniform for doubles (v2)
Dave Airlie [Wed, 30 Sep 2015 07:48:38 +0000 (17:48 +1000)]
mesa/uniforms: fix get_uniform for doubles (v2)

The initial glGetUniformdv support didn't cover all the
casting cases that are apparantly legal, and cts seems to
test for them.

I've updated the piglit test to cover these cases now.

v2: fix indentation - it's all broken in this file (Ilia)
fix src/dst index tracking in light of fp64 support (Ilia)

cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoilo: improve Gen8 defines based on its PRMs
Chia-I Wu [Thu, 8 Oct 2015 08:51:50 +0000 (16:51 +0800)]
ilo: improve Gen8 defines based on its PRMs

9 years agoi965/vec4: Implement b2f and b2i using negation.
Matt Turner [Fri, 9 Oct 2015 19:27:04 +0000 (12:27 -0700)]
i965/vec4: Implement b2f and b2i using negation.

Curro added this in commit 3ee2daf23d (before the vec4/NIR backend was
added) but it was missed in the new NIR backend. Add it there as well.

instructions in affected programs:     1857 -> 1810 (-2.53%)
helped:                                15

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agonv50,nvc0: don't base decisions on available pushbuf space
Ilia Mirkin [Sat, 10 Oct 2015 08:29:39 +0000 (04:29 -0400)]
nv50,nvc0: don't base decisions on available pushbuf space

We still have to push everything out, might as well kick earlier and
flip pushbufs when we know we'll need it. This resolves some issues with
the new policy of making sure that we always leave a bit of room at the
end for fences.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: 47d11990b (nouveau: make sure there's always room to emit a fence)
Cc: mesa-stable@lists.freedesktop.org