platform/upstream/mesa.git
8 years agoglsl: Parse the allowed image format qualifiers in GLSL ES 3.1.
Francisco Jerez [Sun, 16 Aug 2015 22:47:50 +0000 (01:47 +0300)]
glsl: Parse the allowed image format qualifiers in GLSL ES 3.1.

This includes the minimum required desktop/ES GLSL version in the
format qualifier table in anticipation of new GLSL versions extending
the set of supported image formats.  According to section 4.4.7 of the
GLSL ES 3.1 spec:

"The format layout qualifier identifiers for image variable
 declarations are:
 [...]
 rgba32f
 rgba16f
 r32f
 rgba8
 rgba8_snorm
 [...]
 rgba32i
 rgba16i
 rgba8i
 r32i
 [...]
 rgba32ui
 rgba16ui
 rgba8ui
 r32ui"

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Recognise image memory qualifiers in GLSL ES 3.1.
Francisco Jerez [Mon, 17 Aug 2015 16:12:00 +0000 (19:12 +0300)]
glsl: Recognise image memory qualifiers in GLSL ES 3.1.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Define image-related built-in constants required by GLSL ES 3.1.
Francisco Jerez [Mon, 17 Aug 2015 14:42:30 +0000 (17:42 +0300)]
glsl: Define image-related built-in constants required by GLSL ES 3.1.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Remove duplicate definition of gl_MaxTess*ImageUniforms built-in constants.
Francisco Jerez [Sun, 16 Aug 2015 22:39:38 +0000 (01:39 +0300)]
glsl: Remove duplicate definition of gl_MaxTess*ImageUniforms built-in constants.

These seem to have been re-added at some point during the
ARB_tessellation_shader implementation work.  AFAICT the second
(correct) definition of each constant would have had no effect because
the symbols were already defined.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Accept atomic_uint type in GLSL ES 3.1.
Francisco Jerez [Sun, 16 Aug 2015 22:38:00 +0000 (01:38 +0300)]
glsl: Accept atomic_uint type in GLSL ES 3.1.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Accept supported image types in GLSL ES 3.1.
Francisco Jerez [Sun, 16 Aug 2015 22:37:12 +0000 (01:37 +0300)]
glsl: Accept supported image types in GLSL ES 3.1.

These are a subset of the image types supported by desktop GL,
excluding 1D, 1D array, rectangle, buffer, cube array, 2D MS and 2D
MS array texture targets.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Expose image load and store built-ins in GLSL ES 3.1.
Francisco Jerez [Sun, 16 Aug 2015 22:34:41 +0000 (01:34 +0300)]
glsl: Expose image load and store built-ins in GLSL ES 3.1.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Use a separate availability class for image atomic built-ins.
Francisco Jerez [Sun, 16 Aug 2015 22:34:13 +0000 (01:34 +0300)]
glsl: Use a separate availability class for image atomic built-ins.

These are not part of unextended GLSL ES 3.1.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Allow precision qualifiers on general opaque types.
Francisco Jerez [Sun, 16 Aug 2015 22:28:57 +0000 (01:28 +0300)]
glsl: Allow precision qualifiers on general opaque types.

From the GLSL ES 3.1 spec, section 4.7.3:
 "Any floating point, integer, opaque type declaration can have the
  type preceded by one of these precision qualifiers: [...] highp
  [...], mediump [...], lowp [...]."

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Implement GLSL ES restriction on images being either readonly or writeonly.
Francisco Jerez [Sun, 16 Aug 2015 22:27:43 +0000 (01:27 +0300)]
glsl: Implement GLSL ES restriction on images being either readonly or writeonly.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Require that all image uniforms have a format qualifier in GLSL ES.
Francisco Jerez [Sun, 16 Aug 2015 22:26:40 +0000 (01:26 +0300)]
glsl: Require that all image uniforms have a format qualifier in GLSL ES.

Note that this is slightly more permissive than the spec language
requires: "Any image variable must specify a format layout qualifier."

The GLSL ES spec seems really sketchy regarding format layout
qualifiers on function formal parameters -- On the one hand they are
required, but on the other hand it doesn't provide any syntax to
specify them (see section 6.1.1), they don't participate in parameter
type matching for overload resolution, and are in fact explictly
forbidden ("Layout qualifiers cannot be used on formal function
parameters").  Of course none of the image built-in functions defined
by the spec specify format layout qualifiers (and they probably
couldn't sensibly), to contradict its own requirement.

This probably qualifies for a spec bug, but in the meantime do the
sensible thing and require layout qualifiers on uniforms *only*.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
8 years agoglsl: Add support for image binding qualifiers.
Francisco Jerez [Sun, 16 Aug 2015 22:25:11 +0000 (01:25 +0300)]
glsl: Add support for image binding qualifiers.

Support for binding an image to an image unit explicitly in the shader
source is required by both GLSL 4.2 and GLSL ES 3.1, but not by the
original ARB_shader_image_load_store extension.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
8 years agoglsl: Forbid non-constant image array indexing in GLSL ES 3.1.
Francisco Jerez [Sun, 16 Aug 2015 22:21:01 +0000 (01:21 +0300)]
glsl: Forbid non-constant image array indexing in GLSL ES 3.1.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
8 years agomesa: Refuse to bind image uniforms using glUniform in GLES.
Francisco Jerez [Sun, 16 Aug 2015 23:05:43 +0000 (02:05 +0300)]
mesa: Refuse to bind image uniforms using glUniform in GLES.

The GLES 3.1 spec removed support for updating the image unit bound to
an image uniform using glUniform1i() calls.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Refuse to bind a mutable texture object to an image unit in GLES.
Francisco Jerez [Sun, 16 Aug 2015 23:02:17 +0000 (02:02 +0300)]
mesa: Refuse to bind a mutable texture object to an image unit in GLES.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
8 years agomesa: Initialize image unit state to different defaults in GLES.
Francisco Jerez [Sun, 16 Aug 2015 23:01:40 +0000 (02:01 +0300)]
mesa: Initialize image unit state to different defaults in GLES.

There is no GL_R8 image format in GLES, according to the state table
20.32 of the GLES 3.1 spec the default value should be GL_R32UI.  The
ES31-CTS.shader_image_load_store.basic-api-bind Khronos conformance
test checks that this is the case.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Reset image unit state to the default values when a bound image is deleted.
Francisco Jerez [Sun, 16 Aug 2015 23:00:48 +0000 (02:00 +0300)]
mesa: Reset image unit state to the default values when a bound image is deleted.

The ES31-CTS.shader_image_load_store.basic-api-bind conformance test
expects the whole image unit state to be reset when the bound texture
object is deleted.  The ARB_shader_image_load_store extension is
rather vague regarding what should happen with image unit state other
than the texture object in that case, but the GL 4.2 and GLES 3.1
specifications (section "Automatic Unbinding of Deleted Objects")
explicitly require it to be reset to the default values.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Reject image formats not supported by GLES.
Francisco Jerez [Sun, 16 Aug 2015 22:58:53 +0000 (01:58 +0300)]
mesa: Reject image formats not supported by GLES.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Don't lose track of the shader image layer originally specified by the user.
Francisco Jerez [Sun, 16 Aug 2015 22:53:48 +0000 (01:53 +0300)]
mesa: Don't lose track of the shader image layer originally specified by the user.

The spec requires that all layers of the image starting from the 0-th
are bound to the image unit regardless of the Layer parameter when
Layered is true, so I was setting gl_image_unit::Layer to zero in that
case for the convenience of the driver back-end.  However the
ES31-CTS.shader_image_load_store.basic-api-bind conformance test
checks that the layer value returned by glGetInteger is the same that
was originally specified, regardless of the value of layered.  Rename
Layer to _Layer as is usual for other derived state and keep track of
the original layer value as gl_image_unit::Layer.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Rename MaxCombinedImageUnitsAndFragmentOutputs to MaxCombinedShaderOutputResources.
Francisco Jerez [Mon, 17 Aug 2015 16:10:46 +0000 (19:10 +0300)]
mesa: Rename MaxCombinedImageUnitsAndFragmentOutputs to MaxCombinedShaderOutputResources.

The name of both the GLSL built-in variable and the glGetInteger param
with the same value changed in GLSL ES 3.1 and GL 4.5.  Its semantics
also changed slightly, since the limit now also takes into account the
number of SSBs in use.  Switch our internal data structures to the
up-to-date name.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoGL: update glext to svn 31811
Dave Airlie [Sat, 15 Aug 2015 21:37:37 +0000 (07:37 +1000)]
GL: update glext to svn 31811

This brings in the new ARB extensions.

Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agonir: Use nir_builder in nir_lower_io's get_io_offset().
Kenneth Graunke [Wed, 12 Aug 2015 18:26:34 +0000 (11:26 -0700)]
nir: Use nir_builder in nir_lower_io's get_io_offset().

Much more readable.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agonir: Pull nir_lower_io's load_op selection into a helper function.
Kenneth Graunke [Wed, 12 Aug 2015 17:57:31 +0000 (10:57 -0700)]
nir: Pull nir_lower_io's load_op selection into a helper function.

Makes the function a bit smaller.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agomesa/formats: refactor by collapsing cases in switch statement by type
Nanley Chery [Tue, 11 Aug 2015 18:56:35 +0000 (11:56 -0700)]
mesa/formats: refactor by collapsing cases in switch statement by type

Combine the adjacent cases which have the same GL type in the switch statemnt.

Reviewed-by: Chad Versace <chad.versace@intel.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
8 years agomesa/formats: add more MESA_FORMAT_LAYOUTs
Nanley Chery [Fri, 7 Aug 2015 21:36:23 +0000 (14:36 -0700)]
mesa/formats: add more MESA_FORMAT_LAYOUTs

Add the classes of compressed formats as layouts. This allows the detection
of compressed formats belonging to a certain category of compressed formats.

v2. simplify layout name construction (Ilia).

Reviewed-by: Chad Versace <chad.versace@intel.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
8 years agoglsl: Fix up GL_ARB_compute_shader for GLSL ES 3.1
Marta Lofstedt [Mon, 10 Aug 2015 11:04:42 +0000 (13:04 +0200)]
glsl: Fix up GL_ARB_compute_shader for GLSL ES 3.1

GL_ARB_compute_shader is limited for GLSL version 430.
This enables for GLSL ES version 310.

V2: Updated error string to also include GLSL 3.10

Signed-off-by: Marta Lofstedt <marta.lofstedt@linux.intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agomesa/main: Add GL_IMAGE_FORMAT_COMPATIBILITY_TYPE to glGetTexParameterfv
Marta Lofstedt [Wed, 12 Aug 2015 09:57:39 +0000 (11:57 +0200)]
mesa/main: Add GL_IMAGE_FORMAT_COMPATIBILITY_TYPE to glGetTexParameterfv

According to Open GL ES 3.1 specification, section 8.10.2
GL_IMAGE_FORMAT_COMPATIBILITY_TYPE should be supported by
glGetTexParameterfv.

Signed-off-by: Marta Lofstedt <marta.lofstedt@linux.intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoradeonsi: fix a typo as_es -> as_ls in a string
Marek Olšák [Tue, 18 Aug 2015 22:56:33 +0000 (00:56 +0200)]
radeonsi: fix a typo as_es -> as_ls in a string

Trivial.

8 years agowinsys/amdgpu: fix the type of memory usage counters
Marek Olšák [Mon, 17 Aug 2015 17:55:57 +0000 (19:55 +0200)]
winsys/amdgpu: fix the type of memory usage counters

If the 32-bit types overflowed, the driver could submit an IB that uses much
more memory than is available.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: fix indirect indexing of MSAA textures
Marek Olšák [Sat, 15 Aug 2015 09:51:48 +0000 (11:51 +0200)]
radeonsi: fix indirect indexing of MSAA textures

FMASK wasn't handled correctly.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agost/mesa: add fake ARB_copy_image support in Gallium
Ilia Mirkin [Mon, 20 Jul 2015 19:19:53 +0000 (15:19 -0400)]
st/mesa: add fake ARB_copy_image support in Gallium

This support should be removed in favor of something that actually works
in all the weird cases. However this is simple and is enough to allow
Bioshock Infinite to render properly on nvc0.

Since the functionality is not implemented correctly, the extension will
not appear in the extension string and mesa will still return
INVALID_OPERATION for any glCopyImageSubData calls. In order to make use
of this functionality, run with
MESA_EXTENSION_OVERRIDE=GL_ARB_copy_image

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: enable textureSize and texelFetch on GLSL ES 3.10 with MS samplers
Tapani Pälli [Mon, 17 Aug 2015 09:11:03 +0000 (12:11 +0300)]
glsl: enable textureSize and texelFetch on GLSL ES 3.10 with MS samplers

Patch separates array samplers from the texture_multisample check so that we
can enable only [iu]sampler2DMS, [iu]sampler2DMSArray are not supported.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
8 years agomesa: validate size parameters for glTexStorage*Multisample
Tapani Pälli [Mon, 17 Aug 2015 07:14:35 +0000 (10:14 +0300)]
mesa: validate size parameters for glTexStorage*Multisample

v2: code cleanup
v3: check only dimensions, samples is checked separately later

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
8 years agomesa: expose dimension check for glTex*Storage functions
Tapani Pälli [Mon, 10 Aug 2015 07:50:06 +0000 (10:50 +0300)]
mesa: expose dimension check for glTex*Storage functions

This is done so that following patch can use it to verify dimensions
for multisample variants of glTex*Storage.

v2: move function to header, use bool instead GLboolean
v3: small changes, cleanup

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
8 years agoutil/ra: (trivial) fix c99 loop variable initialization
Roland Scheidegger [Wed, 19 Aug 2015 02:17:49 +0000 (04:17 +0200)]
util/ra: (trivial) fix c99 loop variable initialization

Fails with old msvc otherwise.

8 years agoutil: (trivial) include c99_math.h in rounding.h
Roland Scheidegger [Wed, 19 Aug 2015 02:17:36 +0000 (04:17 +0200)]
util: (trivial) include c99_math.h in rounding.h

Needed for rint/rintf.

8 years agoi965/bdw: Fix setting the instancing state for the SGVS element
Neil Roberts [Mon, 13 Jul 2015 17:01:13 +0000 (18:01 +0100)]
i965/bdw: Fix setting the instancing state for the SGVS element

When gl_VertexID or gl_InstanceID is used a 3DSTATE_VF_SGVS
instruction is sent to create a sort of element to store the generated
values. The last instruction in this chunk of code looks like it was
trying to set the instancing state for the element using the
3DSTATE_VF_INSTANCING instruction. However it was sending
brw->vb.nr_buffers instead of the element index. This instruction is
supposed to take an element index and that is how it is used further
down in the function so the previous code looks wrong. Perhaps
previously the number of buffers coincidentally matched the number of
enabled elements so the value was generally correct anyway. In a
subsequent patch I want to change a bit how it chooses the SGVS
element index so this needs to be fixed.

v2 [by Ben]
Remove stable 10.5 stable tag (it's too late now)
Commit update as follows:
The number of vertex buffers emitted is always <= the number of vertex elements.
To maximize reuse (actually, to minimize relocations - according to the code
comments), a vertex buffer is only emitted once, even when we setup multiple
components (3DSTATE_VERTEX_ELEMENT) from that buffer. This meant that the
previous code would use the wrong indexed element for these reuse cases. This
patch by itself prevents hangs on BSW in the linked bug. It doesn't make the
test pass, the remaining patches are needed for that.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91610
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Tested-by: Mark Janes <mark.a.janes@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
8 years agoutil/ra: Make allocating conflict lists optional
Jason Ekstrand [Sat, 15 Aug 2015 16:58:32 +0000 (09:58 -0700)]
util/ra: Make allocating conflict lists optional

Since i965 is now using make_reg_conflicts_transitive and doesn't need
q-value computations, they are disabled on i965.  They are enabled
everywhere else so that they get the old behavior.  This reduces the time
spent in eglInitialize() on BDW by around 10-15%.

Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoi965/reg_allocate: Use make_reg_conflicts_transitive
Jason Ekstrand [Sat, 15 Aug 2015 16:50:11 +0000 (09:50 -0700)]
i965/reg_allocate: Use make_reg_conflicts_transitive

Instead of adding transitive conflicts as we go, we now add regular
conflicts and them make them all transitive at the end.  This reduces
screen creation time substantially on BDW.  The time spent in eglInitialize
is reduced from 27.78 ms/call to 9.92 ms/call in debug mode and from 13.15
ms/call to 4.54 ms/call in release mode (about 65% in either case).

Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoutil/ra: Add a function for making all conflicts on a register transitive
Jason Ekstrand [Sat, 15 Aug 2015 16:43:05 +0000 (09:43 -0700)]
util/ra: Add a function for making all conflicts on a register transitive

Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoutil/bitset: Add a BITSET_FOREACH_SET macro
Jason Ekstrand [Sat, 15 Aug 2015 16:30:40 +0000 (09:30 -0700)]
util/bitset: Add a BITSET_FOREACH_SET macro

Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agomesa: Move varying slots and FS output names to shader_enums.h
Eric Anholt [Tue, 4 Aug 2015 17:43:58 +0000 (10:43 -0700)]
mesa: Move varying slots and FS output names to shader_enums.h

They're used by glsl_to_nir.cpp, and I want to use them in TGSI-to-NIR as
well (our use of the var->index slot to store slot properties no longer
works since it got truncated).

The *_MAX defines are left in mtypes.h, because they depend on config.h.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: undo split out of create shader code
Timothy Arceri [Thu, 13 Aug 2015 13:26:01 +0000 (23:26 +1000)]
mesa: undo split out of create shader code

This code was split out into a separate function to be used also
by GL_EXT_separate_shader_objects which has since been removed from
Mesa, so move it back.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agofreedreno: use fd_pipe_wait_timeout()
Rob Clark [Tue, 18 Aug 2015 19:07:02 +0000 (15:07 -0400)]
freedreno: use fd_pipe_wait_timeout()

To properly support the case of waiting on a fence with a 0 timeout, we
still need to call down to the kernel.  Which requires the use of the
new fd_pipe_wait_timeout() API.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: fence fix
Rob Clark [Sun, 16 Aug 2015 23:18:22 +0000 (19:18 -0400)]
freedreno: fence fix

Don't take current timestamp/fence from current ring, as we might have
already rolled over to new rb.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agoAdd mesa.icd to the .gitignore
Neil Roberts [Mon, 10 Aug 2015 16:31:02 +0000 (17:31 +0100)]
Add mesa.icd to the .gitignore

Since 4d7e0fa8c731776 this file is generated by the configure script.
Reviewed-by: Tapani Palli <tapani.palli@intel.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
8 years agodrirc: Add "Unigine Oil Rush" quirk (allow_glsl_extension_directive_midshader).
Richard Yao [Wed, 12 Aug 2015 16:48:22 +0000 (12:48 -0400)]
drirc: Add "Unigine Oil Rush" quirk (allow_glsl_extension_directive_midshader).

Appears to fix shader compilation. Tested by starting the client and observing
that the screen was correct after the trailers ran when previously, it was
blank. Play tested on amd64.

This was suggested by "Kuuchan" on the Steam forums:

https://steamcommunity.com/app/200390/discussions/0/540731690861139279/?insideModal=1#c594820656479479870

Acked-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Richard Yao <ryao@gentoo.org>
8 years agonir: Simplify feq(fneg(a), a)) -> feq(a, 0.0)
Thomas Helland [Thu, 6 Aug 2015 11:36:05 +0000 (13:36 +0200)]
nir: Simplify feq(fneg(a), a)) -> feq(a, 0.0)

The positive and negative value of a float can only
be equal to each other if it is -0.0f and 0.0f.
This is safe for Nan and Inf, as -Nan != Nan, and -Inf != Inf
This gives no changes in my shader-db

Signed-off-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir: Simplify fne(fneg(a), a) -> fne(a, 0.0)
Thomas Helland [Thu, 6 Aug 2015 11:36:04 +0000 (13:36 +0200)]
nir: Simplify fne(fneg(a), a) -> fne(a, 0.0)

-NaN != NaN, and -Inf != Inf, so this should be safe.
Found while working on my VRP pass.

Shader-db results on my IVB:
total instructions in shared programs: 1698267 -> 1698067 (-0.01%)
instructions in affected programs:     15785 -> 15585 (-1.27%)
helped:                                36
HURT:                                  0
GAINED:                                0
LOST:                                  0

Some shaders was found to have the following pattern in NIR:
vec1 ssa_26 = fneg ssa_21
vec1 ssa_27 = fne ssa_21, ssa_26

Make that:
vec1 ssa_27 = fne ssa_21, 0.0f

This is found in Dota2 and Brutal Legend.
One shader is cut by 8%, from 323 -> 296 instructons in SIMD8

Signed-off-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965/gen7: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:17 +0000 (16:34 +1000)]
i965/gen7: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/gen7_sol_state.c: In function 'gen7_upload_3dstate_so_decl_list':
mesa/src/mesa/drivers/dri/i965/gen7_sol_state.c:119:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < linked_xfb_info->NumOutputs; i++) {
                      ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965/gen6: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:16 +0000 (16:34 +1000)]
i965/gen6: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/gen6_vs_state.c: In function 'gen6_upload_push_constants':
mesa/src/mesa/drivers/dri/i965/gen6_vs_state.c:85:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (i = 0; i < prog_data->nr_params; i++) {
                     ^
mesa/src/mesa/drivers/dri/i965/gen6_vs_state.c:92:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (i = 0; i < prog_data->nr_params; i++) {
                 ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:15 +0000 (16:34 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/brw_vs_surface_state.c: In function 'brw_upload_pull_constants':
mesa/src/mesa/drivers/dri/i965/brw_vs_surface_state.c:84:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < prog_data->nr_pull_params; i++) {
                  ^
mesa/src/mesa/drivers/dri/i965/brw_vs_surface_state.c:89:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (i = 0; i < ALIGN(prog_data->nr_pull_params, 4) / 4; i++) {
                     ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:14 +0000 (16:34 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/brw_wm_surface_state.c: In function 'brw_upload_abo_surfaces':
mesa/src/mesa/drivers/dri/i965/brw_wm_surface_state.c:961:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < prog->NumAtomicBuffers; i++) {
                      ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:13 +0000 (16:34 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/brw_wm_surface_state.c: In function 'brw_upload_ubo_surfaces':
mesa/src/mesa/drivers/dri/i965/brw_wm_surface_state.c:901:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < shader->NumUniformBlocks; i++) {
                      ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:12 +0000 (16:34 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/brw_tex_layout.c: In function 'brw_miptree_layout_texture_array':
mesa/src/mesa/drivers/dri/i965/brw_tex_layout.c:560:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int q = 0; q < mt->level[level].depth; q++) {
                         ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:11 +0000 (16:34 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/brw_state_cache.c: In function 'brw_try_upload_using_copy':
mesa/src/mesa/drivers/dri/i965/brw_state_cache.c:216:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < cache->size; i++) {
                  ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:10 +0000 (16:34 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/brw_primitive_restart.c: In function 'can_cut_index_handle_prims':
mesa/src/mesa/drivers/dri/i965/brw_primitive_restart.c:94:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < nr_prims; i++) {
                      ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:09 +0000 (16:34 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/brw_draw_upload.c: In function 'brw_prepare_vertices':
mesa/src/mesa/drivers/dri/i965/brw_draw_upload.c:434:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = j = 0; i < brw->vb.nr_enabled; i++) {
                      ^
mesa/src/mesa/drivers/dri/i965/brw_draw_upload.c:557:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (i = 0; i < nr_uploads; i++) {
                 ^
mesa/src/mesa/drivers/dri/i965/brw_draw_upload.c:569:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < nr_uploads; i++) {
                  ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:08 +0000 (16:34 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/brw_draw.c: In function 'brw_draw_destroy':
mesa/src/mesa/drivers/dri/i965/brw_draw.c:630:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < brw->vb.nr_buffers; i++) {
                  ^
mesa/src/mesa/drivers/dri/i965/brw_draw.c:636:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < brw->vb.nr_enabled; i++) {
                  ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agomesa/egl: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:07 +0000 (16:34 +1000)]
mesa/egl: Resolve GCC sign-compare warning.

mesa/src/egl/drivers/dri2/platform_drm.c: In function 'release_buffer':
mesa/src/egl/drivers/dri2/platform_drm.c:73:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
                  ^
mesa/src/egl/drivers/dri2/platform_drm.c: In function 'has_free_buffers':
mesa/src/egl/drivers/dri2/platform_drm.c:87:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
                  ^
mesa/src/egl/drivers/dri2/platform_drm.c: In function 'dri2_drm_destroy_surface':
mesa/src/egl/drivers/dri2/platform_drm.c:199:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
                  ^
mesa/src/egl/drivers/dri2/platform_drm.c: In function 'get_back_bo':
mesa/src/egl/drivers/dri2/platform_drm.c:224:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
                     ^
mesa/src/egl/drivers/dri2/platform_drm.c: In function 'dri2_drm_swap_buffers':
mesa/src/egl/drivers/dri2/platform_drm.c:425:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
                        ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agomesa/gbm: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:06 +0000 (16:34 +1000)]
mesa/gbm: Resolve GCC sign-compare warning.

mesa/src/gbm/main/backend.c: In function 'find_backend':
mesa/src/gbm/main/backend.c:70:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ARRAY_SIZE(backends); ++i) {
                  ^
mesa/src/gbm/main/backend.c: In function '_gbm_create_device':
mesa/src/gbm/main/backend.c:95:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ARRAY_SIZE(backends) && dev == NULL; ++i) {
                  ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agomesa/glx: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:05 +0000 (16:34 +1000)]
mesa/glx: Resolve GCC sign-compare warning.

mesa/src/glx/dri_common_query_renderer.c: In function 'dri2_convert_glx_query_renderer_attribs':
mesa/src/glx/dri_common_query_renderer.c:61:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ARRAY_SIZE(query_renderer_map); i++)
                  ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agomesa/glx: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:04 +0000 (16:34 +1000)]
mesa/glx: Resolve GCC sign-compare warning.

mesa/src/glx/dri_common.c: In function 'scalarEqual':
mesa/src/glx/dri_common.c:259:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ARRAY_SIZE(attribMap); i++)
                  ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:03 +0000 (16:34 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/intel_screen.c: In function 'intel_screen_make_configs':
mesa/src/mesa/drivers/dri/i965/intel_screen.c:1222:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < ARRAY_SIZE(formats); i++) {
                      ^
mesa/src/mesa/drivers/dri/i965/intel_screen.c:1259:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < ARRAY_SIZE(formats); i++) {
                      ^
mesa/src/mesa/drivers/dri/i965/intel_screen.c:1291:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < ARRAY_SIZE(formats); i++) {
                      ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:02 +0000 (16:34 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/intel_fbo.c: In function 'intel_validate_framebuffer':
mesa/src/mesa/drivers/dri/i965/intel_fbo.c:734:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ARRAY_SIZE(fb->Attachment); i++) {
                  ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agomesa: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:01 +0000 (16:34 +1000)]
mesa: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/common/utils.c: In function 'driGetConfigAttrib':
mesa/src/mesa/drivers/dri/common/utils.c:457:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < ARRAY_SIZE(attribMap); i++)
                   ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:34:00 +0000 (16:34 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/intel_screen.c: In function 'aub_dump_bmp':
mesa/src/mesa/drivers/dri/i965/intel_screen.c:125:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < fb->_NumColorDrawBuffers; i++) {
                      ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:33:59 +0000 (16:33 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/intel_fbo.c: In function 'intel_blit_framebuffer_with_blitter':
mesa/src/mesa/drivers/dri/i965/intel_fbo.c:836:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (i = 0; i < drawFb->_NumColorDrawBuffers; i++) {
                     ^
V2 (Thomas Helland):
  -Use unsigned instead of GLuint (trivial)

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:33:58 +0000 (16:33 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/brw_wm_state.c: In function 'brw_color_buffer_write_enabled':
mesa/src/mesa/drivers/dri/i965/brw_wm_state.c:53:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
                  ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Thu, 6 Aug 2015 06:33:57 +0000 (16:33 +1000)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/brw_draw.c: In function 'brw_postdraw_set_buffers_need_resolve':
mesa/src/mesa/drivers/dri/i965/brw_draw.c:390:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < fb->_NumColorDrawBuffers; i++) {
                      ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
8 years agoglx: Fix __glXWireToEvent for BufferSwapComplete
Adam Jackson [Fri, 31 Jul 2015 15:32:58 +0000 (11:32 -0400)]
glx: Fix __glXWireToEvent for BufferSwapComplete

In the DRI2 path this event is magically synthesized from the
corresponding DRI2 event, but with Present, the server sends us the
event itself. The DRI2 path fills in the serial number, send_event, and
display fields of the XEvent struct that the app sees, but the Present
path did not.

This is likely related to a class of crashes seen in gtk/clutter apps:

https://bugzilla.redhat.com/attachment.cgi?id=1032631

Note that the crashing instruction is looking up the lock_fns slot in
the Display *, and %rdi (holding the Display *) is 0x1.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoradeon/uvd: remove unused variables
Grazvydas Ignotas [Mon, 17 Aug 2015 23:51:58 +0000 (02:51 +0300)]
radeon/uvd: remove unused variables

Recent commits introduced new unused variable warnings, fix them.

Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agonouveau: recognize tess stages in nouveau_compiler
Marcos Paulo de Souza [Sun, 16 Aug 2015 16:31:58 +0000 (13:31 -0300)]
nouveau: recognize tess stages in nouveau_compiler

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agotgsi: fix parsing of tessellation shader inputs/outputs
Marcos Paulo de Souza [Sun, 16 Aug 2015 16:31:57 +0000 (13:31 -0300)]
tgsi: fix parsing of tessellation shader inputs/outputs

Tessellation control shaders write to outputs as OUT[ADDR[0].x][0], make
sure to parse the indirect dimension on outputs.

Also tess control inputs/outputs and tess eval input declarations need
to receive the same treatment as geometry shader inputs.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agotgsi: set implicit array size for tess stages
Marcos Paulo de Souza [Sun, 16 Aug 2015 16:31:56 +0000 (13:31 -0300)]
tgsi: set implicit array size for tess stages

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: move non-generic samples validation
Timothy Arceri [Thu, 13 Aug 2015 08:44:51 +0000 (18:44 +1000)]
mesa: move non-generic samples validation

The previous patch replaces the other use case.

V2: remove the validation from it old location.

Cc: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa: check samples > 0 for glTex*Multisample
Timothy Arceri [Mon, 17 Aug 2015 11:33:49 +0000 (21:33 +1000)]
mesa: check samples > 0 for glTex*Multisample

The GL 4.5 spec says its an GL_INVALID_VALUE error if samples equals 0 for
glTexImage*Multisample and an GL_INVALID_VALUE error if samples < 1 for
glTexStorage*Multisample.

The spec says its undefined what happens if glTexImage*Multisample is passed
a samples value < 0 but we currently already produced a GL_INVALID_VALUE error
in this case, this is also consistent with the Nvidia binary.

Cc: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoi965/vec4/nir: Emit single MOV to generate a scalar constant.
Matt Turner [Wed, 12 Aug 2015 18:35:17 +0000 (11:35 -0700)]
i965/vec4/nir: Emit single MOV to generate a scalar constant.

If an immediate is written to multiple channels, we can load it in a
single writemasked MOV.

total instructions in shared programs: 6285144 -> 6261991 (-0.37%)
instructions in affected programs:     718991 -> 695838 (-3.22%)
helped:                                5762

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agofreedreno/a3xx: add s3tc texture format support
Ilia Mirkin [Wed, 3 Dec 2014 08:29:38 +0000 (03:29 -0500)]
freedreno/a3xx: add s3tc texture format support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a3xx: fix up logic for handling block formats
Ilia Mirkin [Sun, 16 Aug 2015 17:15:55 +0000 (13:15 -0400)]
freedreno/a3xx: fix up logic for handling block formats

This only appears in cubemaps which have have packed layers, so are very
sensitive to any layout disagreement between sw and hw.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a3xx: double the polygon offset value
Ilia Mirkin [Sun, 16 Aug 2015 19:26:38 +0000 (15:26 -0400)]
freedreno/a3xx: double the polygon offset value

A few other drivers do this, fixes the gl-1.4-polygon-offset piglit test

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: implement the color buffer 0 is integer rule for alpha-to-one/cov
Ilia Mirkin [Mon, 17 Aug 2015 08:08:01 +0000 (04:08 -0400)]
nvc0: implement the color buffer 0 is integer rule for alpha-to-one/cov

The hardware checks for multisampling being enabled, but does not have
the rule about cbuf0 being an integer format. Only enable
alpha-to-one/alpha-to-coverage if cbuf0 is not an integer format.

Fixes piglits
  ext_framebuffer_multisample-int-draw-buffers-alpha-to-one
  ext_framebuffer_multisample-int-draw-buffers-alpha-to-coverage

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: Raise INVALID_VALUE from glCreateShaderProgramv if count < 0
Marta Lofstedt [Thu, 13 Aug 2015 12:38:14 +0000 (14:38 +0200)]
mesa: Raise INVALID_VALUE from glCreateShaderProgramv if count < 0

According to OpenGL version 4.5 and OpenGL ES 3.1 standards, section 7.3:
GL_INVALID_VALUE should be generated, if count is less than 0.

V2: Changed title, eased Open GL ES 3.1 restriction and added comments.

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
8 years agomesa: AtomicBufferBindings should be initialized to zero.
Marta Lofstedt [Thu, 13 Aug 2015 10:59:40 +0000 (12:59 +0200)]
mesa: AtomicBufferBindings should be initialized to zero.

According to OpenGL specification version 4.5 table 23.46
and OpenGL ES specification version 3.1 table 20.31:
ATOMIC_COUNTER_BUFFER_START and ATOMIC_COUNTER_BUFFER_SIZE
should have the initial value of zero.

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
8 years agomesa: fix target error checking in glGetTexLevelParameter
Tapani Pälli [Thu, 13 Aug 2015 14:03:44 +0000 (17:03 +0300)]
mesa: fix target error checking in glGetTexLevelParameter

With non-dsa functions we need to do target error checking before
_mesa_get_current_tex_object which would just call _mesa_problem without
raising GL_INVALID_ENUM error. In other places of Mesa, target gets checked
before this call.

Fixes failures in:
   ES31-CTS.texture_storage_multisample.APIGLGetTexLevelParameterifv.*

v2: do the target check also for dsa functions (Timothy)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
8 years agogk110/ir: fix sched calculator to consider all registers in the ISA
Ilia Mirkin [Mon, 17 Aug 2015 06:11:55 +0000 (02:11 -0400)]
gk110/ir: fix sched calculator to consider all registers in the ISA

GK110/GK208 have 256 registers, not 64. Find out the number of registers
from the target to avoid unnecessary iteration for pre-GK110.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: rename texture function now that its static
Timothy Arceri [Sat, 15 Aug 2015 03:29:19 +0000 (13:29 +1000)]
mesa: rename texture function now that its static

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoglsl: add missing MS sampler builtin types for GLSL ES 3.10
Tapani Pälli [Fri, 14 Aug 2015 10:36:40 +0000 (13:36 +0300)]
glsl: add missing MS sampler builtin types for GLSL ES 3.10

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Implement glMemoryBarrierByRegion
Marta Lofstedt [Fri, 14 Aug 2015 11:30:45 +0000 (13:30 +0200)]
mesa: Implement glMemoryBarrierByRegion

The function glMemoryBarrierByRegion is part of OpenGL ES 3.1
and OpenGL 4.5 core and compatibility profiles.

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agonvc0: program smooth line width when multisampling is enabled
Ilia Mirkin [Mon, 17 Aug 2015 04:53:04 +0000 (00:53 -0400)]
nvc0: program smooth line width when multisampling is enabled

There are separate line widths for smooth and aliased lines. The smooth
one is selected when multisampling is enabled even if line smoothing
isn't explicitly turned on.

Fixes the ext_framebuffer_multisample-line-smooth piglits

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: bind a fake tess control program when there isn't one available
Ilia Mirkin [Sun, 26 Jul 2015 04:56:34 +0000 (00:56 -0400)]
nvc0: bind a fake tess control program when there isn't one available

Apparently this is necessary in order for tess factors to work in a tess
eval program without a tess control program bound. Probably because it
uses the fake program's shader header to work out the number of patch
constants.

Fixes vs-tes-tessinner-tessouter-inputs

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogm107/ir: avoid letting the lowering pass get out of sync
Ilia Mirkin [Fri, 24 Jul 2015 05:25:13 +0000 (01:25 -0400)]
gm107/ir: avoid letting the lowering pass get out of sync

There's a lot of functionality duplicated in the gm107 lowering pass
from the nvc0 pass. As that one gets updated, the gm107 one falls
behind. Avoid this by sharing the code.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonv50,nvc0: take level into account when doing eng2d multi-layer blits
Ilia Mirkin [Sun, 16 Aug 2015 02:05:15 +0000 (22:05 -0400)]
nv50,nvc0: take level into account when doing eng2d multi-layer blits

This fixes arb_get_texture_sub_image-get, and any situation where the 2d
engine was being used for multi-layer blits to a non-0 level.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
8 years agost/mesa: also move yoffset to zoffset for 1d array textures
Ilia Mirkin [Sun, 16 Aug 2015 01:42:02 +0000 (21:42 -0400)]
st/mesa: also move yoffset to zoffset for 1d array textures

Do the same as in st_TexSubImage. This fixes
arb_get_texture_sub_image-get on llvmpipe when it is set to prefer
blits, and nouveau when it uses the 3d engine for blits.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agonir: Add a glsl_uint_type() wrapper.
Kenneth Graunke [Tue, 12 May 2015 08:12:46 +0000 (01:12 -0700)]
nir: Add a glsl_uint_type() wrapper.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
8 years agofreedreno/a3xx: add per-texture seamless cubemap control
Ilia Mirkin [Sat, 8 Aug 2015 03:11:45 +0000 (23:11 -0400)]
freedreno/a3xx: add per-texture seamless cubemap control

The default is to enable seamless cubemap filtering, but there's a bit
to turn it off.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a4xx: add cube map array support
Ilia Mirkin [Mon, 3 Aug 2015 06:13:33 +0000 (02:13 -0400)]
freedreno/a4xx: add cube map array support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a4xx: fix srgb render targets
Rob Clark [Thu, 13 Aug 2015 17:53:43 +0000 (13:53 -0400)]
freedreno/a4xx: fix srgb render targets

Also fixes mipmap level generation for srgb textures.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: update generated headers
Rob Clark [Fri, 14 Aug 2015 00:38:01 +0000 (20:38 -0400)]
freedreno: update generated headers

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agoscons: Always define __STDC_LIMIT_MACROS.
Vinson Lee [Fri, 14 Aug 2015 22:19:49 +0000 (15:19 -0700)]
scons: Always define __STDC_LIMIT_MACROS.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91591
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>