mesa.git
8 years agomesa: expose EXT_polygon_offset_clamp in ES contexts
Ilia Mirkin [Sun, 3 Apr 2016 06:28:53 +0000 (02:28 -0400)]
mesa: expose EXT_polygon_offset_clamp in ES contexts

The extension spec was extended to also support ES. This functionality
is provided all the way back to ES 1.0.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: Print "precise" on ir_variable nodes.
Kenneth Graunke [Sun, 3 Apr 2016 08:25:03 +0000 (01:25 -0700)]
glsl: Print "precise" on ir_variable nodes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
8 years agogallivm: Introduce lp_format_intrinsic.
Jose Fonseca [Sun, 3 Apr 2016 21:52:53 +0000 (22:52 +0100)]
gallivm: Introduce lp_format_intrinsic.

For adding .v4f32 like suffixes to intrinsics, taking special care for
scalar case, which was being often neglected.

This fixes invalid IR when doing mipmap filtering on SSE2 (the only
case where we'd use intrinsics with scalars.)

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agoglsl: make *sampler2DMSArray available in ESSL 3.20
Ilia Mirkin [Sun, 3 Apr 2016 02:56:49 +0000 (22:56 -0400)]
glsl: make *sampler2DMSArray available in ESSL 3.20

Also avoid double-adding the *sampler2DMS types when the array ext is
enabled.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: make ssbo predicate return true when in a GLSL 430 or ESSL 310 shader
Ilia Mirkin [Sun, 3 Apr 2016 01:50:22 +0000 (21:50 -0400)]
glsl: make ssbo predicate return true when in a GLSL 430 or ESSL 310 shader

I can't tell whether this actually matters, but we're creating function
signatures with this predicate, so it should probably match when SSBO's
are available.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: allow conservative depth qualifiers in GLSL 420
Ilia Mirkin [Sun, 3 Apr 2016 01:08:25 +0000 (21:08 -0400)]
glsl: allow conservative depth qualifiers in GLSL 420

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agomesa: add always-false-for-now enables for GL 4.3, 4.4, 4.5.
Ilia Mirkin [Fri, 8 Jan 2016 20:48:44 +0000 (15:48 -0500)]
mesa: add always-false-for-now enables for GL 4.3, 4.4, 4.5.

As the relevant extensions get implemented, the lines should be
uncommented. I believe this is (almost) everything needed for those GL
versions though.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add ARB_ES3_1_compatibility support
Ilia Mirkin [Fri, 19 Feb 2016 19:03:39 +0000 (14:03 -0500)]
glsl: add ARB_ES3_1_compatibility support

Oddly a bunch of the features it adds are actually from ESSL 3.20. But
the spec is quite clear, oh well.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agomesa: add ES3_1_compatibility extension enable
Ilia Mirkin [Fri, 19 Feb 2016 18:26:43 +0000 (13:26 -0500)]
mesa: add ES3_1_compatibility extension enable

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agogallivm: Use llvm.fabs.
Jose Fonseca [Fri, 1 Apr 2016 10:51:27 +0000 (11:51 +0100)]
gallivm: Use llvm.fabs.

Exactly the same code.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallivm: Prefer backend agnostic intrinsic for rounding.
Jose Fonseca [Fri, 1 Apr 2016 10:50:28 +0000 (11:50 +0100)]
gallivm: Prefer backend agnostic intrinsic for rounding.

We could unconditionally use these instrinsics, but performance with SSE2
would suck, as LLVM falls back to calling libm.

lp_test_arit.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallivm: Add debug option to force SSE2.
Jose Fonseca [Fri, 1 Apr 2016 10:06:30 +0000 (11:06 +0100)]
gallivm: Add debug option to force SSE2.

For simulating less capable machines.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agollvmpipe: Test abs.
Jose Fonseca [Fri, 1 Apr 2016 10:50:43 +0000 (11:50 +0100)]
llvmpipe: Test abs.

Trivial.

8 years agollvmpipe: Build lp_test_arit on MSVC too.
Jose Fonseca [Sun, 3 Apr 2016 10:09:35 +0000 (11:09 +0100)]
llvmpipe: Build lp_test_arit on MSVC too.

It builds fine now.  Probably due to C99 support.

Trivial.

8 years agogallivm: Fix performance regressions due to vector selects.
Jose Fonseca [Sat, 2 Apr 2016 14:13:38 +0000 (15:13 +0100)]
gallivm: Fix performance regressions due to vector selects.

LLVM often can't determine the mask elements are all ones/zeros, and
there doesn't seem to be a good way to hint that.

Thanks to Roland Scheidegger for spotting and analyzing the issue.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallivm: Remove lp_build_load_volatile.
Jose Fonseca [Sat, 2 Apr 2016 13:33:33 +0000 (14:33 +0100)]
gallivm: Remove lp_build_load_volatile.

No longer needed.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallivm: Use standard LLVMSetAlignment from LLVM 3.4 onwards.
Jose Fonseca [Sat, 2 Apr 2016 13:31:16 +0000 (14:31 +0100)]
gallivm: Use standard LLVMSetAlignment from LLVM 3.4 onwards.

Only provide a fallback for LLVM 3.3.

One less dependency on LLVM C++ interface.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agomesa: remove unrequired else
Timothy Arceri [Sat, 2 Apr 2016 10:07:50 +0000 (21:07 +1100)]
mesa: remove unrequired else

The if always returns so no need for an else.

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agogm107/ir: add OP_SELP emission, used in DSQRT lowering
Ilia Mirkin [Sat, 2 Apr 2016 23:25:59 +0000 (19:25 -0400)]
gm107/ir: add OP_SELP emission, used in DSQRT lowering

The current DSQRT lowering code emits an OP_SELP, so we have to handle
its emission. This will eventually go away, but no harm supporting this
op.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonv50/ir: we can't load local memory directly into an output
Ilia Mirkin [Sat, 2 Apr 2016 21:46:58 +0000 (17:46 -0400)]
nv50/ir: we can't load local memory directly into an output

This fixes piglit tests like

tests/spec/glsl-1.10/execution/variable-indexing/vs-output-array-float-index-wr.shader_test

and related ones.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agost/nine: specify WINAPI only for i386 and amd64
Christian Schmidbauer [Sun, 13 Mar 2016 21:50:31 +0000 (22:50 +0100)]
st/nine: specify WINAPI only for i386 and amd64

Currently mesa fails building with the x32 abi as ms_abi is not defined
in such a case.

The patch uses ms_abi only for amd64 targets and stdcall only for i386
targets to be sure that those are defined.

This patch additionally checks for __GNUC__ to guarantee that
__attribute__ is available.

CC: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Christian Schmidbauer <ch.schmidbauer@gmail.com>
Acked-by: Axel Davy <axel.davy@ens.fr>
8 years agonv50/ir: fix envyas variants when building the code lib
Samuel Pitoiset [Sat, 2 Apr 2016 17:55:30 +0000 (19:55 +0200)]
nv50/ir: fix envyas variants when building the code lib

nvc0 and nve4 have been respectively replaced by gf100 and gk104.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agosvga: remove unused svga_compile_key::texture_msaa field
Brian Paul [Thu, 31 Mar 2016 20:23:34 +0000 (14:23 -0600)]
svga: remove unused svga_compile_key::texture_msaa field

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agosvga: check TXF instruction's target to determine MSAA
Brian Paul [Thu, 31 Mar 2016 20:19:17 +0000 (14:19 -0600)]
svga: check TXF instruction's target to determine MSAA

Rather than the currently bound texture.  This goes along with the
earlier patch to get away from examining bound textures and sampler
views during shader translation.

Fixes VMware bug 1632739.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agotgsi: add simple tgsi_is_msaa_target() helper
Brian Paul [Thu, 31 Mar 2016 20:17:26 +0000 (14:17 -0600)]
tgsi: add simple tgsi_is_msaa_target() helper

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoglsl: rename var and simplify if
Timothy Arceri [Sat, 2 Apr 2016 02:59:46 +0000 (13:59 +1100)]
glsl: rename var and simplify if

is_ubo_var is true for both UBOs and SSBOs

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: store ubo or ssbo index in block index
Timothy Arceri [Sat, 2 Apr 2016 02:54:06 +0000 (13:54 +1100)]
glsl: store ubo or ssbo index in block index

Previously we store the buffer block index i.e the index of a combined
ubo/ssbo list.

Fixes several dEQP-GLES31.functional tests:
- program_interface_query.uniform.block_index.block_array
- program_interface_query.uniform.block_index.named_block
- program_interface_query.uniform.block_index.unnamed_block
- program_interface_query.uniform.random.10
- program_interface_query.uniform.random.15
- program_interface_query.uniform.random.22
- program_interface_query.uniform.random.24
- program_interface_query.uniform.random.26
- program_interface_query.uniform.random.28
- program_interface_query.uniform.random.3
- program_interface_query.uniform.random.31
- program_interface_query.uniform.random.38
- program_interface_query.uniform.random.5

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94116
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: store stage reference in gl_uniform_block
Timothy Arceri [Sat, 2 Apr 2016 01:51:12 +0000 (12:51 +1100)]
glsl: store stage reference in gl_uniform_block

This allows us to simplify the code and drop InterfaceBlockStageIndex
which is a per stage array of integers the size of all blocks in the
program combined including duplicates across stages. Adding a stage
ref per block will use less memory.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: simplify buffer block resource limit checking
Timothy Arceri [Sat, 2 Apr 2016 01:16:01 +0000 (12:16 +1100)]
glsl: simplify buffer block resource limit checking

This changes the code to use the buffer counts stored for each stage
rather than counting from scratch. It also moves the checks outside
of the for loop which means we now just get a single link error
message if we go over the max rather than X error messages where X
is the number we have exceeded the max by.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: simplify SSBO resources check
Timothy Arceri [Sat, 2 Apr 2016 00:48:27 +0000 (11:48 +1100)]
glsl: simplify SSBO resources check

We already have a count of active SSBOs per stage so use it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: split buffer block arrays earlier
Timothy Arceri [Sat, 2 Apr 2016 01:12:10 +0000 (12:12 +1100)]
glsl: split buffer block arrays earlier

This will allow us to use them when checking resources in a
following patch and clean up a bunch of code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: only set buffer block binding once during initialisation
Timothy Arceri [Sat, 2 Apr 2016 00:06:39 +0000 (11:06 +1100)]
glsl: only set buffer block binding once during initialisation

Since 8683d54d2be825 there is now a single instance of the buffer
block information that needs to be updated rather than one instance
for each stage.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: Fix prorgram interface query locations biasing for SSO.
Kenneth Graunke [Tue, 29 Mar 2016 21:15:14 +0000 (14:15 -0700)]
glsl: Fix prorgram interface query locations biasing for SSO.

With SSO, the GL_PROGRAM_INPUT and GL_PROGRAM_OUTPUT interfaces refer to
the first and last shader stage linked into a program.  This may not be
the vertex and fragment shader stages.

So, subtracting VERT_ATTRIB_GENERIC0 and FRAG_RESULT_DATA0 is bogus.
We need to subtract VERT_ATTRIB_GENERIC0 for VS inputs,
FRAG_RESULT_DATA0 for FS outputs, and VARYING_SLOT_VAR0 for other cases.

Note that built-in variables get a location of -1.

Fixes 4 dEQP-GLES31.functional.program_interface_query tests:
- program_input.location.separable_fragment.var_explicit_location
- program_input.location.separable_fragment.var_array_explicit_location
- program_output.location.separable_vertex.var_array_explicit_location
- program_output.location.separable_vertex.var_array_explicit_location

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Return -1 for program interface query locations in many cases.
Kenneth Graunke [Tue, 29 Mar 2016 20:21:48 +0000 (13:21 -0700)]
glsl: Return -1 for program interface query locations in many cases.

We were recording locations for all variables, even ones without an
explicit location set.  Implement the rules from the spec, and record
-1 in the resource list accordngly.  Make program_resource_location
stop doing math on negative values.  Remove hacks that are no longer
necessary now that we've stopped doing that.

Fixes 4 dEQP-GLES31.functional.program_interface_query tests:
- program_input.location.separable_fragment.var
- program_input.location.separable_fragment.var_array
- program_output.location.separable_vertex.var_array
- program_output.location.separable_vertex.var_array

v2: Delete more code

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Consolidate gl_VertexIDMESA -> gl_VertexID query hacks.
Kenneth Graunke [Tue, 29 Mar 2016 20:32:32 +0000 (13:32 -0700)]
glsl: Consolidate gl_VertexIDMESA -> gl_VertexID query hacks.

A program will either have gl_VertexID or gl_VertexIDMESA (the lowered
zero-based version), not both.  Just spoof it in the resource list so
the hacks are done in a single place.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Clean up some leftover cruft.
Kenneth Graunke [Tue, 29 Mar 2016 19:31:28 +0000 (12:31 -0700)]
glsl: Clean up some leftover cruft.

stages is always 1 << stage now.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Add all system variables to the input resource list.
Kenneth Graunke [Tue, 29 Mar 2016 19:07:37 +0000 (12:07 -0700)]
glsl: Add all system variables to the input resource list.

System values are just built-in input variables that we've opted to
special-case out of convenience.  We need to consider all inputs,
regardless of how we've classified them.

Unfortunately, there's one exception: we shouldn't add gl_BaseVertex
unless ARB_shader_draw_parameters is enabled, because it doesn't
actually exist in the language, and shouldn't be counted in the
GL_ACTIVE_RESOURCES query.

Fixes dEQP-GLES31.functional.program_interface_query.program_input.
resource_list.compute.empty, which expects gl_NumWorkGroups to appear
in the resource list.

v2: Delete more code

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Delete hack for VS system values.
Kenneth Graunke [Tue, 29 Mar 2016 19:11:55 +0000 (12:11 -0700)]
glsl: Delete hack for VS system values.

This makes no sense.  If the stage being considered is the vertex
shader, then we'll add inputs and system values appropriately.

If we're not considering the vertex shader, then we absolutely should
not do anything with it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Make add_interface_variables only consider the appropriate stage.
Kenneth Graunke [Tue, 29 Mar 2016 18:41:46 +0000 (11:41 -0700)]
glsl: Make add_interface_variables only consider the appropriate stage.

add_interface_variables() is supposed to add variables for the inputs of
the first shader stage linked into a program, and the outputs of the
last shader stage linked into a program.

From the ARB_program_interface_query specification:

"* PROGRAM_INPUT corresponds to the set of active input variables used by
   the first shader stage of <program>.  If <program> includes multiple
   shader stages, input variables from any shader stage other than the
   first will not be enumerated.

 * PROGRAM_OUTPUT corresponds to the set of active output variables
   (section 2.14.11) used by the last shader stage of <program>.  If
   <program> includes multiple shader stages, output variables from any
   shader stage other than the last will not be enumerated."

Previously, we used build_stageref here, which walks over all linked
shaders in the program.  This meant that internal varyings would be
visible.  We don't actually need any of build_stageref's code: we
already explicitly skip packed varyings, handle modes, and the name
comparisons just do a fuzzy string comparison of name with itself.

Fixes two tests: dEQP-GLES31.functional.program_interface_query.
program_{input,output}.referenced_by.referenced_by_vertex_fragment.

These tests have a VS and FS linked together into a single program.
Both stages have an input called "shaderInput".  But the FS input
should not be visible because it isn't the first stage.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Clarify "mask" variable in add_interface_variables().
Kenneth Graunke [Tue, 29 Mar 2016 18:37:48 +0000 (11:37 -0700)]
glsl: Clarify "mask" variable in add_interface_variables().

This is a bitfield of which stages refer to a variable.  It is not used
to mask off bits.  In fact, it's used to contribute additional bits.

Rename it and tidy a bit of the logic.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Pass stage to add_interface_variables().
Kenneth Graunke [Tue, 29 Mar 2016 18:31:10 +0000 (11:31 -0700)]
glsl: Pass stage to add_interface_variables().

add_interface_variables is supposed to add variables from either the
first or last stage of a linked shader.  But it has no way of knowing
the stage it's being asked to process, which makes it impossible to
produce correct stagerefs.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Make vertex ID lowering declare gl_BaseVertex as hidden.
Kenneth Graunke [Sat, 2 Apr 2016 03:52:33 +0000 (20:52 -0700)]
glsl: Make vertex ID lowering declare gl_BaseVertex as hidden.

If the GL_ARB_shader_draw_parameters extension is enabled, we'll already
have a gl_BaseVertex variable.  It will have var->how_declared set to
ir_var_declared_implicitly, and will appear in the program resource
list.

If not, we make one for internal use.  We don't want it to be listed
in the program resource list, as the application won't be expecting
it.  Marking it hidden will properly exclude it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl: Exclude ir_var_hidden variables from the program resource list.
Kenneth Graunke [Sat, 2 Apr 2016 04:00:32 +0000 (21:00 -0700)]
glsl: Exclude ir_var_hidden variables from the program resource list.

We occasionally generate variables internally that we want to exclude
from the program resource list, as applications won't be expecting them
to be present.

The next patch will make use of this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: Make _mesa_choose_tex_format() handle stencil textures.
Kenneth Graunke [Mon, 21 Mar 2016 21:01:24 +0000 (14:01 -0700)]
mesa: Make _mesa_choose_tex_format() handle stencil textures.

This is necessary for ARB_texture_stencil8 support on classic drivers.
Presumably Gallium works because it implements its own ChooseTexFormat.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoglsl: Don't require matching centroid qualifiers
Jordan Justen [Sat, 12 Mar 2016 00:44:06 +0000 (16:44 -0800)]
glsl: Don't require matching centroid qualifiers

Note: This patch appears to violate older OpenGL and OpenGLES specs.

The OpenGLES GLSL 3.1 and OpenGL GLSL 4.3 specifications both remove
the requirement for the output and input centroid qualifiers to match.

The deqp
dEQP-GLES3.functional.shaders.linkage.varying.rules.differing_interpolation_2
test wants the newer OpenGLES 3.1 specification behavior, even for
OpenGLES 3.0. This patch simply removes the checking in all cases.

The OpenGLES 3.0 conformance test suite doesn't appear to require the
older ("must match") spec behavior.

For reference, here are the relavent spec citations:

  The OpenGL 4.2 spec says: "the last active shader stage output
  variables and fragment shader input variables of the same name must
  match in type and qualification (other than out matching to in)"

  The OpenGL 4.3 spec says: "interpolation qualification (e.g., flat)
  and auxiliary qualification (e.g. centroid) may differ."

  The OpenGLES GLSL 3.00.4 specification says: "The output of the
  vertex shader and the input of the fragment shader form an
  interface. For this interface, vertex shader output variables and
  fragment shader input variables of the same name must match in type
  and qualification (other than precision and out matching to in)."

  The OpenGLES GLSL 3.10 Specification says: "interpolation
  qualification (e.g., flat) and auxiliary qualification (e.g.
  centroid) may differ"

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92743
Bugzilla: https://cvs.khronos.org/bugzilla/show_bug.cgi?id=7819
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agogallium: distinguish between shader IR in get_compute_param
Bas Nieuwenhuizen [Fri, 25 Mar 2016 01:06:50 +0000 (02:06 +0100)]
gallium: distinguish between shader IR in get_compute_param

For radeonsi, native and TGSI use different compilers and this results
in different limits for different IR's.

The set we strictly need for radeonsi is only the MAX_BLOCK_SIZE
and MAX_THREADS_PER_BLOCK params, but I added a few others as shader
related that seemed like they would also typically depend on the
compiler.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agogallium: add global buffer memory barrier bit
Bas Nieuwenhuizen [Thu, 24 Mar 2016 22:11:03 +0000 (23:11 +0100)]
gallium: add global buffer memory barrier bit

Currently radeonsi synchronizes after every dispatch and Clover
does nothing to synchronize. This is overzealous, especially with
GL compute, so add a barrier for global buffers.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agogallium: add threads per block TGSI property
Bas Nieuwenhuizen [Mon, 28 Mar 2016 00:40:03 +0000 (02:40 +0200)]
gallium: add threads per block TGSI property

The value 0 for unknown has been chosen to so that
drivers using tgsi_scan_shader do not need to detect
missing properties if they zero-initialize the struct.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agogallium: add compute shader IR type
Bas Nieuwenhuizen [Thu, 17 Mar 2016 13:15:39 +0000 (14:15 +0100)]
gallium: add compute shader IR type

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: remove tabs and fix some other style issues in glcpp-parse.y
Timothy Arceri [Thu, 31 Mar 2016 05:49:59 +0000 (16:49 +1100)]
glsl: remove tabs and fix some other style issues in glcpp-parse.y

Note there are still tabs left in the parser rules.

Acked-by: Dave Airlie <airlied@redhat.com>
8 years agoi965: Add an implemnetation of nir_op_fquantize2f16
Jason Ekstrand [Fri, 25 Mar 2016 20:57:15 +0000 (13:57 -0700)]
i965: Add an implemnetation of nir_op_fquantize2f16

Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir: Add an opcode for stomping a 32-bit value to 16-bit precision
Jason Ekstrand [Fri, 25 Mar 2016 20:58:17 +0000 (13:58 -0700)]
nir: Add an opcode for stomping a 32-bit value to 16-bit precision

This correlates directly to the SPIR-V opcode OpQuantizeToF16

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agonvc0: enable compute shaders on GK104 and GM107+
Samuel Pitoiset [Mon, 8 Feb 2016 17:19:47 +0000 (18:19 +0100)]
nvc0: enable compute shaders on GK104 and GM107+

Compute support on GK110 is still unstable for weird reasons, but
this can be fixed later as the NVF0_COMPUTE envvar prevent using
compute.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: bump the maximum number of UBOs for compute on Kepler
Samuel Pitoiset [Mon, 8 Feb 2016 17:20:02 +0000 (18:20 +0100)]
nvc0: bump the maximum number of UBOs for compute on Kepler

The maximum number of uniform blocks (MAX_COMPUTE_UNIFORM_BLOCKS)
per compute program must be at least 12.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0/ir: do not lower shared+atomics on GM107+
Samuel Pitoiset [Mon, 7 Mar 2016 17:56:21 +0000 (18:56 +0100)]
nvc0/ir: do not lower shared+atomics on GM107+

For Maxwell, the ATOMS instruction can be used to perform atomic
operations on shared memory instead of this load/store lowering pass.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0/ir: add atomics support on shared memory for Kepler
Samuel Pitoiset [Wed, 10 Feb 2016 21:37:42 +0000 (22:37 +0100)]
nvc0/ir: add atomics support on shared memory for Kepler

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0/ir: fix wrong pred emission for ld lock on GK104
Samuel Pitoiset [Mon, 22 Feb 2016 22:20:30 +0000 (23:20 +0100)]
nvc0/ir: fix wrong pred emission for ld lock on GK104

This fixes 84b9b8f (nvc0/ir: add missing emission of locked load
predicate).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0/ir: add support for compute UBOs on Kepler
Samuel Pitoiset [Wed, 30 Mar 2016 22:50:39 +0000 (00:50 +0200)]
nvc0/ir: add support for compute UBOs on Kepler

Make sure to avoid out of bounds access in presence of indirect
array indexing by loading the size from the driver constant buffer.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: add indirect compute support on Kepler
Samuel Pitoiset [Thu, 14 Jan 2016 17:24:53 +0000 (18:24 +0100)]
nvc0: add indirect compute support on Kepler

The grid size is stored as three 32-bits integers in the indirect
buffer but the launch descriptor uses a 32-bits integer for both
griddim_y and griddim_z like this (z << 16) | y. To make it work,
the 16 high bits of griddim_y are overwritten by griddim_z.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: reduce likelihood of collision for real buffers on Kepler
Samuel Pitoiset [Mon, 22 Feb 2016 20:44:25 +0000 (21:44 +0100)]
nvc0: reduce likelihood of collision for real buffers on Kepler

Reduce likelihood of collision with real buffers by placing the
hole at the top of the 4G area. This fixes some indirect draw+compute
tests with large buffers.

Suggested by Ilia Mirkin.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: store ubo info to the driver constbuf on Kepler
Samuel Pitoiset [Wed, 30 Mar 2016 22:50:23 +0000 (00:50 +0200)]
nvc0: store ubo info to the driver constbuf on Kepler

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: bind user uniforms for compute on Kepler
Samuel Pitoiset [Mon, 11 Jan 2016 20:22:58 +0000 (21:22 +0100)]
nvc0: bind user uniforms for compute on Kepler

Uniform buffer objects will be sticked to the driver constant buffer
like buffers because the launch descriptor only allows 8 CBs.

Input kernel parameters for OpenCL are still uploaded to screen->parm
which is bound on c0, but this will be changed later with a new series.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: bind shader buffers for compute on Kepler
Samuel Pitoiset [Mon, 11 Jan 2016 15:05:59 +0000 (16:05 +0100)]
nvc0: bind shader buffers for compute on Kepler

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: bind driver cb for compute on c7[] for Kepler
Samuel Pitoiset [Wed, 24 Feb 2016 16:03:57 +0000 (17:03 +0100)]
nvc0: bind driver cb for compute on c7[] for Kepler

Instead of using the screen->parm buffer object which will be removed,
upload auxiliary constants to uniform_bo to be consistent regarding
what we already do for Fermi.

This breaks surfaces support (for compute only) but this will be
properly re-introduced later for ARB_shader_image_load_store.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogallivm: Prevent disassembly debug output from being truncated.
Jose Fonseca [Fri, 1 Apr 2016 20:17:18 +0000 (21:17 +0100)]
gallivm: Prevent disassembly debug output from being truncated.

By using os_log_message directly, as _debug_vprintf truncates messages
to 4K.

Also cleanup the disassemble interface.

Spotted by Roland.

Trivial.

8 years agocompiler: random comment fixup
Rob Clark [Tue, 29 Mar 2016 14:49:03 +0000 (10:49 -0400)]
compiler: random comment fixup

Just noticed this in passing..  gl_shader_stage already has tess so this
comment no longer applies.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agodocs: minor updates to license.html file
Brian Paul [Thu, 31 Mar 2016 16:30:07 +0000 (10:30 -0600)]
docs: minor updates to license.html file

Mesa demos are no longer part of the main Mesa tree/tarball.
Add Gallium and GLX code to list of major components.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoradeonsi: use util_strchrnul() to fix android build error
Mauro Rossi [Sun, 21 Feb 2016 19:57:47 +0000 (20:57 +0100)]
radeonsi: use util_strchrnul() to fix android build error

Android Bionic does not support strchrnul() string function,
gallium auxiliary util/u_string.h provides util_strchrnul()

This change avoids the following building error:

external/mesa/src/gallium/drivers/radeonsi/si_shader.c:3863: error:
undefined reference to 'strchrnul'
collect2: error: ld returned 1 exit status

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoegl: android: enable EGL_FRAMEBUFFER_TARGET_ANDROID and EGL_RECORDABLE_ANDROID
Rob Herring [Tue, 2 Feb 2016 20:23:11 +0000 (14:23 -0600)]
egl: android: enable EGL_FRAMEBUFFER_TARGET_ANDROID and EGL_RECORDABLE_ANDROID

Set EGL_FRAMEBUFFER_TARGET_ANDROID and EGL_RECORDABLE_ANDROID config
attributes to true for Android. These are required in Marshmallow.

The implementation of EGL_RECORDABLE_ANDROID support has 2 options in
the definition of the extension. Android implements the 2nd option
which is the encoder must support RGB input. The requested input format
is RGB888, so setting the attribute on all the native Android visual
formats should be sufficient.

Similarly, setting EGL_FRAMEBUFFER_TARGET_ANDROID for all configs with
a EGL_NATIVE_VISUAL_ID should be sufficient. Most likely, the HWC should
support the same set of formats the underlying DRM driver supports.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoegl: Add EGL_RECORDABLE_ANDROID attribute
Rob Herring [Tue, 2 Feb 2016 20:23:08 +0000 (14:23 -0600)]
egl: Add EGL_RECORDABLE_ANDROID attribute

This is used by Android to select an eglconfig compatible with screen
recording.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Rob Herring <robh@kernel.org>
[Emil Velikov: add the _eglIsConfigAttribValid check]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoegl: Add EGL_FRAMEBUFFER_TARGET_ANDROID attribute
Rob Herring [Tue, 2 Feb 2016 20:23:07 +0000 (14:23 -0600)]
egl: Add EGL_FRAMEBUFFER_TARGET_ANDROID attribute

This is used by Android to select an eglconfig compatible with HWComposer.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Rob Herring <robh@kernel.org>
[Emil Velikov: add the _eglIsConfigAttribValid check]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoAndroid: fix x86 gallium builds
Rob Herring [Tue, 2 Feb 2016 20:45:07 +0000 (14:45 -0600)]
Android: fix x86 gallium builds

Builds with gallium enabled fail on x86 with linker error:

external/mesa3d/src/mesa/vbo/vbo_exec_array.c:127: error: undefined reference to '_mesa_uint_array_min_max'

The problem is sse_minmax.c is not included in the libmesa_st_mesa
library. Since the SSE4.1 files are needed for both libmesa_st_mesa
and libmesa_dricore, move SSE4.1 files into a separate static library
that can be used by both.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agogallivm: Use vector selects on LLVM 3.3+.
Jose Fonseca [Thu, 31 Mar 2016 22:37:34 +0000 (23:37 +0100)]
gallivm: Use vector selects on LLVM 3.3+.

This is an old patch I had around.

Vector selects seem to work well from LLVM 3.3.  Using them should
improve code quality, as it might make constant propagation pass more
effective.

Tested lp_test_*

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agoglsl: do not raise unitialized variable warnings on builtins/reserved GL variables
Alejandro Piñeiro [Fri, 1 Apr 2016 07:11:15 +0000 (09:11 +0200)]
glsl: do not raise unitialized variable warnings on builtins/reserved GL variables

Needed because not all the built-in variables are marked as system
values, so they still have the mode ir_var_auto. Right now it fixes
raising the warning when gl_GlobalInvocationID and
gl_LocalInvocationIndex are used.

v2: use is_gl_identifier instead of filtering for some names (Ilia
    Mirkin)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonv50,nvc0: add PIPE_BIND_LINEAR support to is_format_supported
Ilia Mirkin [Fri, 1 Apr 2016 01:52:13 +0000 (21:52 -0400)]
nv50,nvc0: add PIPE_BIND_LINEAR support to is_format_supported

vdpau has recently come to rely on this, so make sure to check it
properly.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: add GL_OES/EXT_draw_buffers_indexed support
Ilia Mirkin [Thu, 31 Mar 2016 04:48:01 +0000 (00:48 -0400)]
mesa: add GL_OES/EXT_draw_buffers_indexed support

This is the same ext as ARB_draw_buffers_blend (plus some core
functionality that already exists). Add the alias entrypoints.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoi965: Use brw->urb.min_vs_urb_entries instead of 32 for BLORP.
Kenneth Graunke [Thu, 31 Mar 2016 07:53:21 +0000 (00:53 -0700)]
i965: Use brw->urb.min_vs_urb_entries instead of 32 for BLORP.

Haswell GT2 and GT3 have a minimum of 64 entries.  Hardcoding 32
is not legal.

v2: Delete stale comment (caught by Alejandro).

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965: Fix textureSize() depth value for 1 layer surfaces on Gen4-6.
Kenneth Graunke [Tue, 29 Mar 2016 16:58:11 +0000 (09:58 -0700)]
i965: Fix textureSize() depth value for 1 layer surfaces on Gen4-6.

According to the Sandybridge PRM's description of the resinfo message,
the .z value returned will be Depth == 0 ? 0 : Depth + 1.  The earlier
PRMs have the same table.

This means we return 0 for array textures with a single slice, when
we ought to return 1.  Just override it to max(depth, 1).

Fixes 10 dEQP-GLES3.functional tests on Sandybridge:
shaders.texture_functions.texturesize.sampler2darray_fixed_vertex
shaders.texture_functions.texturesize.sampler2darray_fixed_fragment
shaders.texture_functions.texturesize.sampler2darray_float_vertex
shaders.texture_functions.texturesize.sampler2darray_float_fragment
shaders.texture_functions.texturesize.isampler2darray_vertex
shaders.texture_functions.texturesize.isampler2darray_fragment
shaders.texture_functions.texturesize.usampler2darray_vertex
shaders.texture_functions.texturesize.usampler2darray_fragment
shaders.texture_functions.texturesize.sampler2darrayshadow_vertex
shaders.texture_functions.texturesize.sampler2darrayshadow_fragment

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir: Simplify a bcsel to logical-or
Ian Romanick [Tue, 29 Mar 2016 22:25:04 +0000 (15:25 -0700)]
nir: Simplify a bcsel to logical-or

Oddly, this did not affect the shader where I first noticed the pattern.
That particular shader doesn't get its if-statement converted to a bcsel
because there are two assignments in the else-statement.  This led to me
submitting https://bugs.freedesktop.org/show_bug.cgi?id=94747.

shader-db results:

Sandy Bridge
total instructions in shared programs: 8467384 -> 8467069 (-0.00%)
instructions in affected programs: 36594 -> 36279 (-0.86%)
helped: 46
HURT: 0

total cycles in shared programs: 117573448 -> 117568518 (-0.00%)
cycles in affected programs: 339114 -> 334184 (-1.45%)
helped: 46
HURT: 0

Ivy Bridge / Haswell / Broadwell / Skylake:
total instructions in shared programs: 7774258 -> 7773999 (-0.00%)
instructions in affected programs: 30874 -> 30615 (-0.84%)
helped: 46
HURT: 0

total cycles in shared programs: 65739190 -> 65734530 (-0.01%)
cycles in affected programs: 180380 -> 175720 (-2.58%)
helped: 45
HURT: 1

No change on G45 or Ironlake.

I also tried these expressions, but none of them affected any shaders in
shader-db:

   (('bcsel', a, 'a@bool', 'b@bool'), ('ior', a, b)),
   (('bcsel', a, 'b@bool', False),    ('iand', a, b)),
   (('bcsel', a, 'b@bool', 'a@bool'), ('iand', a, b)),

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoptn: Fix all users of ptn_swizzle
Ian Romanick [Thu, 24 Mar 2016 22:48:55 +0000 (15:48 -0700)]
ptn: Fix all users of ptn_swizzle

None of the callers actually wanted what it did.  In ptn_xpd, you only
ever want a vec3 swizzle.  In ptn_tex, you want a swizzle that matches
the number of required texture coordinates.

shader-db results:

G45:
total instructions in shared programs: 4011240 -> 4010911 (-0.01%)
instructions in affected programs: 59232 -> 58903 (-0.56%)
helped: 114
HURT: 0

total cycles in shared programs: 84314194 -> 84313220 (-0.00%)
cycles in affected programs: 779150 -> 778176 (-0.13%)
helped: 110
HURT: 13

Ironlake:
total instructions in shared programs: 6397262 -> 6396605 (-0.01%)
instructions in affected programs: 117402 -> 116745 (-0.56%)
helped: 227
HURT: 0

total cycles in shared programs: 128889798 -> 128888524 (-0.00%)
cycles in affected programs: 1214644 -> 1213370 (-0.10%)
helped: 179
HURT: 44

Sandy Bridge:
total instructions in shared programs: 8467391 -> 8467384 (-0.00%)
instructions in affected programs: 3107 -> 3100 (-0.23%)
helped: 10
HURT: 6

total cycles in shared programs: 117580120 -> 117573448 (-0.01%)
cycles in affected programs: 103158 -> 96486 (-6.47%)
helped: 84
HURT: 11

Ivy Bridge:
total instructions in shared programs: 7774255 -> 7774258 (0.00%)
instructions in affected programs: 1677 -> 1680 (0.18%)
helped: 8
HURT: 6

total cycles in shared programs: 65743828 -> 65739190 (-0.01%)
cycles in affected programs: 89312 -> 84674 (-5.19%)
helped: 78
HURT: 23

Haswell:
total instructions in shared programs: 7107172 -> 7107150 (-0.00%)
instructions in affected programs: 2048 -> 2026 (-1.07%)
helped: 16
HURT: 0

total cycles in shared programs: 64653636 -> 64647486 (-0.01%)
cycles in affected programs: 86836 -> 80686 (-7.08%)
helped: 85
HURT: 17

Broadwell and Skylake:
total instructions in shared programs: 8447529 -> 8447507 (-0.00%)
instructions in affected programs: 2038 -> 2016 (-1.08%)
helped: 16
HURT: 0

total cycles in shared programs: 66418670 -> 66413416 (-0.01%)
cycles in affected programs: 90110 -> 84856 (-5.83%)
helped: 83
HURT: 20

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoptn: Silence unused parameter warning
Ian Romanick [Tue, 29 Mar 2016 00:27:36 +0000 (17:27 -0700)]
ptn: Silence unused parameter warning

The KIL instruction doesn't have a destination, so ptn_kil never uses
dest.

program/prog_to_nir.c: In function ‘ptn_kil’:
program/prog_to_nir.c:547:38: warning: unused parameter ‘dest’ [-Wunused-parameter]
 ptn_kil(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src)
                                      ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agotgsi: silence compiler warning in fetch_sampler_unit()
Samuel Pitoiset [Thu, 31 Mar 2016 08:54:18 +0000 (10:54 +0200)]
tgsi: silence compiler warning in fetch_sampler_unit()

The unit variable can be used uninitialized.

Fixes: 24e77cb09 ("tgsi: handle indirect sampler arrays. (v2)")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi: fix out of bounds access in exec_atomop()
Samuel Pitoiset [Thu, 31 Mar 2016 08:54:17 +0000 (10:54 +0200)]
tgsi: fix out of bounds access in exec_atomop()

The number of channels must be 4 for all RGBA components.

Fixes: 22d129601 ("tgsi: add support for image operations to tgsi_exec. (v2.1)")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi: split tgsi_util_get_texture_coord_dim() function into two
Brian Paul [Wed, 30 Mar 2016 22:54:08 +0000 (16:54 -0600)]
tgsi: split tgsi_util_get_texture_coord_dim() function into two

It was kind of overloaded, returning two different things.  Now get
the index of the shadow reference src register with a new
tgsi_util_get_shadow_ref_src_index() function.

To verify the new code, I added some temp/debug code which looped
over all TGSI_TEXTURE_x values, calling the old function and new and
checking that the returned indexes matched.

Also tested piglit "shadow" tests with softpipe/llvmpipe.
No testing of ilo and radeonsi changes.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi: skip texture query opcodes when examining texture targets
Brian Paul [Wed, 30 Mar 2016 15:55:56 +0000 (09:55 -0600)]
tgsi: skip texture query opcodes when examining texture targets

Should fix the assertion in piglit
spec@arb_gpu_shader5@texturegather@fs-r-none-shadow-2d when the
TXQ instruction specifies a 2D target but the sampler view was
declared as SHADOW2D.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agonv50/ir: Check for valid insn instead of def size
Pierre Moreau [Sat, 19 Mar 2016 13:04:54 +0000 (14:04 +0100)]
nv50/ir: Check for valid insn instead of def size

This fixes a null pointer dereference during the register allocation pass,
if a function had arguments.

Functions arguments get a definition from the function itself, a definition
which is therefore not linked to any instruction. If a value ends up having
a definition but no linked instruction, the register allocation pass doesn't
need to consider whether that value is generated by an instruction that
can only handle "short" registers (on nv50).

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
8 years agomesa: add GL_EXT_copy_image support
Ilia Mirkin [Wed, 17 Feb 2016 18:27:14 +0000 (13:27 -0500)]
mesa: add GL_EXT_copy_image support

The extension is identical to GL_OES_copy_image. But dEQP has tests that
want the EXT variant.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agomesa: add GL_OES_copy_image support
Ilia Mirkin [Tue, 16 Feb 2016 01:34:52 +0000 (20:34 -0500)]
mesa: add GL_OES_copy_image support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agomesa: remove duplicate MAX_GEOMETRY_SHADER_INVOCATIONS entry
Ilia Mirkin [Thu, 31 Mar 2016 02:03:06 +0000 (22:03 -0400)]
mesa: remove duplicate MAX_GEOMETRY_SHADER_INVOCATIONS entry

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agost/mesa: add ES sample-shading support
Ilia Mirkin [Tue, 16 Feb 2016 06:27:27 +0000 (01:27 -0500)]
st/mesa: add ES sample-shading support

We require the full ARB_gpu_shader5 for now, but in the future some
other CAP could get exposed to indicate that only the multisample-related
behavior of ARB_gpu_shader5 is available.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agomesa: add GL_OES_shader_multisample_interpolation support
Ilia Mirkin [Sat, 20 Feb 2016 20:03:55 +0000 (15:03 -0500)]
mesa: add GL_OES_shader_multisample_interpolation support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: add GL_OES_sample_shading support
Ilia Mirkin [Tue, 16 Feb 2016 19:29:38 +0000 (14:29 -0500)]
mesa: add GL_OES_sample_shading support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: add GL_OES_sample_variables support
Ilia Mirkin [Fri, 19 Feb 2016 18:23:10 +0000 (13:23 -0500)]
glsl: add GL_OES_sample_variables support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: add OES_sample_variables to extension table, add enable bit
Ilia Mirkin [Tue, 16 Feb 2016 06:20:15 +0000 (01:20 -0500)]
mesa: add OES_sample_variables to extension table, add enable bit

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: add gl_MaxSamples, new in GL 4.5 / GL ES 3.2
Ilia Mirkin [Fri, 19 Feb 2016 18:20:48 +0000 (13:20 -0500)]
glsl: add gl_MaxSamples, new in GL 4.5 / GL ES 3.2

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Don't add barrier deps for FB write messages.
Matt Turner [Sun, 13 Mar 2016 05:16:03 +0000 (21:16 -0800)]
i965: Don't add barrier deps for FB write messages.

Ken did this earlier, and this is just me reimplementing his patch a
little differently.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Add and use is_scheduling_barrier() function.
Matt Turner [Sun, 13 Mar 2016 05:15:19 +0000 (21:15 -0800)]
i965: Add and use is_scheduling_barrier() function.

8 years agoi965: Remove NOP insertion kludge in scheduler.
Matt Turner [Mon, 15 Feb 2016 18:43:39 +0000 (10:43 -0800)]
i965: Remove NOP insertion kludge in scheduler.

Instead of removing every instruction in add_insts_from_block(), just
move the instruction to its scheduled location. This is a step towards
doing both bottom-up and top-down scheduling without conflicts.

Note that this patch changes cycle counts for programs because it begins
including control flow instructions in the estimates.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Assert that an instruction is not inserted around itself.
Matt Turner [Mon, 15 Feb 2016 18:42:14 +0000 (10:42 -0800)]
i965: Assert that an instruction is not inserted around itself.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Relax restriction on scheduling last instruction.
Matt Turner [Mon, 15 Feb 2016 18:05:33 +0000 (10:05 -0800)]
i965: Relax restriction on scheduling last instruction.

I think when this code was written, basic blocks were always ended by a
control flow instruction or an end-of-thread message. That's no longer
the case, and removing this restriction actually helps things:

   instructions in affected programs: 7267 -> 7244 (-0.32%)
   helped: 4

   total cycles in shared programs: 66559580 -> 66431900 (-0.19%)
   cycles in affected programs: 28310152 -> 28182472 (-0.45%)
   helped: 9577
   HURT: 879

   GAINED: 2

The addition of the is_control_flow() checks is not a functional change,
since the add_insts_from_block() does not put them in the list of
instructions to schedule. I plan to change this in a later patch.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>