mesa.git
7 years agoi965: Only flush the batchbuffer if we need to zero the SO offsets
Chris Wilson [Tue, 10 Jan 2017 21:23:26 +0000 (21:23 +0000)]
i965: Only flush the batchbuffer if we need to zero the SO offsets

If we don't have pipelined register access (e.g. Haswell before kernel
v4.2), then we can only implement EXT_transform_feedback by reseting the
SO offsets *between* batches. However, if we do have pipelined access to
the SO registers on gen7, we can simply emit an inline reset of the SO
registers without a full batch flush.

v2 [by Ken]: Simplify after recent kernel feature detection changes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoanv: do not subtract the base layer to compute depth in 3DSTATE_DEPTH_BUFFER
Iago Toral Quiroga [Wed, 22 Feb 2017 10:33:13 +0000 (11:33 +0100)]
anv: do not subtract the base layer to compute depth in 3DSTATE_DEPTH_BUFFER

According to the PRM description of the Depth field:

  "This field specifies the total number of levels for a volume texture
   or the number of array elements allowed to be accessed starting at the
   Minimum Array Element for arrayed surfaces"

However, ISL defines array_len as the length of the range
[base_array_layer, base_array_layer + array_len], so it already represents
a value relative to the base array layer like the hardware expects.

v2: Depth is defined as a U11-1 field, so subtract 1 from
    the actual value (Jason)

This fixes a number of new CTS tests that would crash otherwise:
dEQP-VK.pipeline.render_to_image.*

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoisl: document the meaning of the array_len field in isl_view
Iago Toral Quiroga [Fri, 24 Feb 2017 07:35:39 +0000 (08:35 +0100)]
isl: document the meaning of the array_len field in isl_view

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agovulkan/wsi: Improve the DRI3 error message
Jacob Lifshay [Wed, 1 Mar 2017 04:30:57 +0000 (20:30 -0800)]
vulkan/wsi: Improve the DRI3 error message

This commit improves the message by telling them that they could probably
enable DRI3.  More importantly, it includes a little heuristic to check
to see if we're running on AMD or NVIDIA's proprietary X11 drivers and,
if we are, doesn't emit the warning.  This way, users with both a discrete
card and Intel graphics don't get the warning when they're just running
on the discrete card.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99715
Co-authored-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Rene Lindsay <rjklindsay@hotmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Cc: "17.0" <mesa-dev@lists.freedesktop.org>
7 years agoi965: Do int64 lowering in NIR
Jason Ekstrand [Thu, 23 Feb 2017 22:54:13 +0000 (14:54 -0800)]
i965: Do int64 lowering in NIR

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agonir: Add a simple int64 lowering pass
Jason Ekstrand [Thu, 23 Feb 2017 21:56:15 +0000 (13:56 -0800)]
nir: Add a simple int64 lowering pass

The algorithms used by this pass, especially for division, are heavily
based on the work Ian Romanick did for the similar int64 lowering pass
in the GLSL compiler.

v2: Properly handle vectors

v3: Get rid of log2_denom stuff.  Since we're using bcsel, we do all the
    calculations anyway and this is just extra instructions.

v4:
 - Add back in the log2_denom stuff since it's needed for ensuring that
   the shifts don't overflow.
 - Rework the looping part of the pass to be easier to expand.

Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agospirv: Use nir_builder for control flow
Jason Ekstrand [Wed, 15 Feb 2017 18:47:03 +0000 (10:47 -0800)]
spirv: Use nir_builder for control flow

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agonir/lower_indirect: Use nir_builder control-flow helpers
Jason Ekstrand [Wed, 15 Feb 2017 18:15:58 +0000 (10:15 -0800)]
nir/lower_indirect: Use nir_builder control-flow helpers

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agonir/lower_gs_intrinsics: Use nir_builder control-flow helpers
Jason Ekstrand [Wed, 15 Feb 2017 18:14:47 +0000 (10:14 -0800)]
nir/lower_gs_intrinsics: Use nir_builder control-flow helpers

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoglsl/nir: Use nir_builder's new control-flow helpers
Jason Ekstrand [Wed, 15 Feb 2017 18:04:47 +0000 (10:04 -0800)]
glsl/nir: Use nir_builder's new control-flow helpers

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agonir/builder: Add support for easily building control-flow
Jason Ekstrand [Wed, 15 Feb 2017 16:42:45 +0000 (08:42 -0800)]
nir/builder: Add support for easily building control-flow

Each of the pop functions (and push_else) take a control flow parameter as
their second argument.  If NULL, it assumes that the builder is in a block
that's a direct child of the control-flow node you want to pop off the
virtual stack.  This is what 90% of consumers will want.  The SPIR-V pass,
however, is a bit more "creative" about how it walks the CFG and it needs
to be able to pop multiple levels at a time, hence the argument.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoi965: Move intel_debug.h to intel/common/gen_debug.h
Jason Ekstrand [Wed, 1 Mar 2017 19:20:25 +0000 (11:20 -0800)]
i965: Move intel_debug.h to intel/common/gen_debug.h

This is shared between the Vulkan and GL drivers as it's a requirement
of the back-end compiler.  However, it doesn't really belong in the
compiler.  We rename the file to match the prefix of the other stuff in
common and because libdrm defines an intel_debug.h and this avoids a
pile of possible name conflicts.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoi965: Reduce cross-pollination between the DRI driver and compiler
Jason Ekstrand [Wed, 1 Mar 2017 16:58:43 +0000 (08:58 -0800)]
i965: Reduce cross-pollination between the DRI driver and compiler

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move select_clip_planes to brw_vs.c
Jason Ekstrand [Wed, 1 Mar 2017 19:53:41 +0000 (11:53 -0800)]
i965: Move select_clip_planes to brw_vs.c

Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Delete brw_do_cubemap_normalize
Jason Ekstrand [Wed, 1 Mar 2017 03:08:22 +0000 (19:08 -0800)]
i965: Delete brw_do_cubemap_normalize

This hasn't been used for quite some time now but we never bothered to
get rid of it when we dropped GLSL IR support for vec4.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Add a header for brw_vec4_vs_visitor
Jason Ekstrand [Wed, 1 Mar 2017 03:00:45 +0000 (19:00 -0800)]
i965: Add a header for brw_vec4_vs_visitor

brw_vs.h is not a compiler file but brw_vec4_visitor is definitely a
compiler thing.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move a bunch of pre-compile and link stuff to brw_program.h
Jason Ekstrand [Wed, 1 Mar 2017 02:49:45 +0000 (18:49 -0800)]
i965: Move a bunch of pre-compile and link stuff to brw_program.h

It's all GL-specific and brw_program.h is not part of i965_compiler.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move image uniform setup to brw_nir_uniforms.cpp
Jason Ekstrand [Wed, 1 Mar 2017 02:48:58 +0000 (18:48 -0800)]
i965: Move image uniform setup to brw_nir_uniforms.cpp

It's the only thing that's using it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move channel_expressions and vector_splitting to brw_program.h
Jason Ekstrand [Wed, 1 Mar 2017 02:48:23 +0000 (18:48 -0800)]
i965: Move channel_expressions and vector_splitting to brw_program.h

They're GL-specific.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Make mark_surface_used a static inline in brw_compiler.h
Jason Ekstrand [Wed, 1 Mar 2017 02:52:29 +0000 (18:52 -0800)]
i965: Make mark_surface_used a static inline in brw_compiler.h

One of these days, I'd like to see this function go away all together
but for now, let's at least put it near the struct it updates.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move BRW_ATTRIB_WA_* defines to brw_compiler.h
Jason Ekstrand [Wed, 1 Mar 2017 02:38:27 +0000 (18:38 -0800)]
i965: Move BRW_ATTRIB_WA_* defines to brw_compiler.h

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move BRW_MAX_DRAW_BUFFERS to brw_compiler.h
Jason Ekstrand [Wed, 1 Mar 2017 02:14:49 +0000 (18:14 -0800)]
i965: Move BRW_MAX_DRAW_BUFFERS to brw_compiler.h

It does sort-of go with MAX_UBO and friends but MAX_DRAW_BUFFERS is an
actual hardware constant based on the number of things we can blend
rather than an arbitrary "number of things allowed in GL" like some of
the other maximums are.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/inst: Stop using fi_type
Jason Ekstrand [Wed, 1 Mar 2017 02:12:35 +0000 (18:12 -0800)]
i965/inst: Stop using fi_type

It's a mesa define that's trivial to inline.  This removes a dependence
on main/imports.h.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move brw_register_blocks to brw_fs.cpp
Jason Ekstrand [Wed, 1 Mar 2017 02:11:33 +0000 (18:11 -0800)]
i965: Move brw_register_blocks to brw_fs.cpp

Its one and only caller is brw_compile_fs which lives there.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move SHADER_TIME_STRIDE to brw_compiler.h
Jason Ekstrand [Wed, 1 Mar 2017 02:10:53 +0000 (18:10 -0800)]
i965: Move SHADER_TIME_STRIDE to brw_compiler.h

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move SOL binding #defines to brw_compiler.h
Jason Ekstrand [Wed, 1 Mar 2017 01:21:12 +0000 (17:21 -0800)]
i965: Move SOL binding #defines to brw_compiler.h

While we're at it, we also change the GEN6 binding macro to be a start
index that gets added to the binding.  This makes things a bit more
explicit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi964/gs: Move MAX_GS_INPUT_VERTICES to brw_vec4_gs_visitor.h
Jason Ekstrand [Wed, 1 Mar 2017 01:17:56 +0000 (17:17 -0800)]
i964/gs: Move MAX_GS_INPUT_VERTICES to brw_vec4_gs_visitor.h

It's only users are in brw_vec4_gs_visitor and gen6_vec4_gs_visitor.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/gs: Add the gl_prim_to_hw_prim table to vec4_gs_visitor.cpp
Jason Ekstrand [Wed, 1 Mar 2017 01:16:22 +0000 (17:16 -0800)]
i965/gs: Add the gl_prim_to_hw_prim table to vec4_gs_visitor.cpp

It's currently in brw_util.c but that's the only bit of brw_util.c
that's shared between the compiler and the rest of the GL driver.
It's just a fairly obvious table so the duplication isn't bad.  It's
certainly less pain than trying to figure out how to share the code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Don't use MAX_SURFACES in mark_surface_used
Jason Ekstrand [Wed, 1 Mar 2017 01:15:04 +0000 (17:15 -0800)]
i965: Don't use MAX_SURFACES in mark_surface_used

Vulkan doesn't respect MAX_SURFACES so this assert isn't valid in that
case.  It should, however, assert that it isn't insanely large.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Get rid of BRW_PRIM_OFFSET
Jason Ekstrand [Wed, 1 Mar 2017 01:02:42 +0000 (17:02 -0800)]
i965: Get rid of BRW_PRIM_OFFSET

This is a relic of when we wired up meta to be able to use RECTLIST
primitives.  It's no longer needed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/vue_map: Stop using GLbitfield types
Jason Ekstrand [Wed, 1 Mar 2017 00:49:19 +0000 (16:49 -0800)]
i965/vue_map: Stop using GLbitfield types

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoi965: Move assign_common_binding_table_offsets to brw_program
Jason Ekstrand [Wed, 1 Mar 2017 00:40:56 +0000 (16:40 -0800)]
i965: Move assign_common_binding_table_offsets to brw_program

This isn't used by Vulkan and is specific to the way the GL driver
works.  There's no reason to have it in common compiler code.  Also, it
relies on BRW_MAX_* defines which are defined in brw_context.h

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoi965: Move some gen4 WM defines to brw_compiler.h
Jason Ekstrand [Wed, 1 Mar 2017 00:33:49 +0000 (16:33 -0800)]
i965: Move some gen4 WM defines to brw_compiler.h

These go in wm_prog_key so they're part of the compiler interface.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoi965: Move brw_disassemble_inst to brw_eu.h
Jason Ekstrand [Wed, 1 Mar 2017 03:40:07 +0000 (19:40 -0800)]
i965: Move brw_disassemble_inst to brw_eu.h

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoi965: Move some helpers from brw_context.h to brw_shader.h
Jason Ekstrand [Wed, 1 Mar 2017 00:12:22 +0000 (16:12 -0800)]
i965: Move some helpers from brw_context.h to brw_shader.h

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoi965: Move a couple of #defines from brw_context to brw_compiler
Jason Ekstrand [Wed, 1 Mar 2017 00:09:58 +0000 (16:09 -0800)]
i965: Move a couple of #defines from brw_context to brw_compiler

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoglsl/int64: Fix a typo in imod64
Jason Ekstrand [Fri, 24 Feb 2017 23:44:03 +0000 (15:44 -0800)]
glsl/int64: Fix a typo in imod64

The zy swizzle gives us one component of quotient and one component of
remainder.  What we wanted was zw for the remainder.

Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoutil/build-id: Return a pointer rather than copying the data
Jason Ekstrand [Sat, 25 Feb 2017 00:29:26 +0000 (16:29 -0800)]
util/build-id: Return a pointer rather than copying the data

We're about to use the build-id as the starting point for another SHA1
hash in the Intel Vulkan driver, and returning a pointer is far more
convenient.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Properly handle destroying NULL devices and instances
Jason Ekstrand [Wed, 1 Mar 2017 16:39:49 +0000 (08:39 -0800)]
anv: Properly handle destroying NULL devices and instances

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "17.0 13.0" <mesa-dev@lists.freedesktop.org>
7 years agomesa: Fix performance query id check
Robert Bragg [Fri, 24 Feb 2017 16:39:06 +0000 (16:39 +0000)]
mesa: Fix performance query id check

The queryid_valid() function asserts that an ID given by an application
isn't zero since the spec explicitly reserves an ID of zero as invalid.

The implementation was written as if the ID was a signed integer and
based on the assumption that queryid_to_index() is simply subtracting
one from the ID. It was broken because in fact the ID was stored in an
unsigned int and testing for an index >= 0 would always succeed.

This adds a spec quote to clarify why zero is considered invalid and
checks for zero before even passing the ID to queryid_to_index() for
then checking the upper bound.

This is a v2 of a patch originally posted by Juha-Pekka (thanks)

Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Signed-off-by: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
7 years agoamd/common: Fix build with new ac_add_function_attr()
Tobias Klausmann [Wed, 1 Mar 2017 21:16:27 +0000 (22:16 +0100)]
amd/common: Fix build with new ac_add_function_attr()

Fix usage of ac_add_function_attr() and make it known!

common/ac_nir_to_llvm.c: In function 'create_llvm_function':
common/ac_nir_to_llvm.c:265:4: error: implicit declaration of function
'ac_add_function_attr' [-Werror=implicit-function-declaration]
    ac_add_function_attr(main_function, i + 1, AC_FUNC_ATTR_BYVAL);
    ^~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoegl/wayland: Don't use DRM format codes for SHM
Daniel Stone [Mon, 13 Feb 2017 14:06:10 +0000 (14:06 +0000)]
egl/wayland: Don't use DRM format codes for SHM

The wl_drm interface (akin to X11's DRI2) uses the standard set of DRM
FourCC format codes. wl_shm copies this, except for ARGB8888/XRGB8888,
which use their own definitions.

Make sure we only use wl_shm format codes when we're working with
wl_shm. Otherwise, using swrast with 32bpp formats would fail with an
error.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Daniel Stone <daniels@collabora.com> (v1)
Fixes: cb5e799448 ("egl/wayland: unify dri2_wl_create_surface implementations")
v2: [Emil Velikov: move to dri2_wl_create_window_surface]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com> (IRC)
7 years agomesa: Drop unused STATE_TEXRECT_SCALE program statevars.
Kenneth Graunke [Tue, 28 Feb 2017 19:48:51 +0000 (11:48 -0800)]
mesa: Drop unused STATE_TEXRECT_SCALE program statevars.

The last user is now gone.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
7 years agoi965: Drop unused STATE_TEXRECT_SCALE code.
Kenneth Graunke [Tue, 28 Feb 2017 19:44:26 +0000 (11:44 -0800)]
i965: Drop unused STATE_TEXRECT_SCALE code.

In the past, we used this on Gen4-5 to transform non-normalized texture
coordinates (for sampler2DRect) to normalized ones.  We also used it on
Gen6-7.5 for sampler2DRect with GL_CLAMP.

Jason dropped this code in 6c8ba59cff14a1a86273f4008ff2a8e68335ab25
in favor of using nir_lower_tex(), which just does a textureSize()
call.  But we were still setting up these state references for
useless uniform data.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
7 years agoegl: Ensure ResetNotificationStrategy matches for shared contexts.
Kenneth Graunke [Wed, 1 Mar 2017 01:20:52 +0000 (17:20 -0800)]
egl: Ensure ResetNotificationStrategy matches for shared contexts.

Fixes:
dEQP-EGL.functional.robustness.negative_context.invalid_robust_shared_context_creation

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
7 years agogallivm,ac: add function attributes at call sites instead of declarations
Marek Olšák [Wed, 22 Feb 2017 01:29:12 +0000 (02:29 +0100)]
gallivm,ac: add function attributes at call sites instead of declarations

They can vary at call sites if the intrinsic is NOT a legacy SI intrinsic.
We need this to force readnone or inaccessiblememonly on some amdgcn
intrinsics.

This is only used with LLVM 4.0 and later. Intrinsics only used with
LLVM <= 3.9 don't need the LEGACY flag.

gallivm and ac code is in the same patch, because splitting would be
more complicated with all the LEGACY uses all over the place.

v2: don't change the prototype of lp_add_function_attr.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com> (v1)
7 years agogallivm,ac: remove unused FUNC_ATTR_LAST enums
Marek Olšák [Wed, 22 Feb 2017 01:28:36 +0000 (02:28 +0100)]
gallivm,ac: remove unused FUNC_ATTR_LAST enums

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
7 years agost/mesa: inform the driver of framebuffer changes before compute dispatches
Nicolai Hähnle [Wed, 22 Feb 2017 18:59:06 +0000 (19:59 +0100)]
st/mesa: inform the driver of framebuffer changes before compute dispatches

Even though compute shaders cannot access the framebuffer, there is a
synchronization issue when a compute dispatch accesses a texture that
was previously bound and drawn to as a framebuffer.

Section 9.3 (Feedback Loops Between Textures and the Framebuffer) of
the OpenGL 4.5 spec rather implicitly clarifies that undefined behavior
results if the texture is still attached to the currently bound
framebuffer. However, the feedback loop is broken when the application
changes the framebuffer binding before a compute dispatch, and the
state tracker needs to let the driver known about this.

Fixes GL45-CTS.compute_shader.pipeline-post-fs on SI family Radeons.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/glsl_to_tgsi: avoid iterating past the head of the instruction list
Nicolai Hähnle [Wed, 22 Feb 2017 19:04:39 +0000 (20:04 +0100)]
st/glsl_to_tgsi: avoid iterating past the head of the instruction list

exec_node::get_prev() does not guard against going past the beginning
of the list, so we need to add explicit checks here.

Found by ASAN in piglit arb_shader_storage_buffer_object-rendering.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
7 years agor600g: fix build without opencl and static llvm libs
Marc Dietrich [Mon, 27 Feb 2017 15:35:13 +0000 (16:35 +0100)]
r600g: fix build without opencl and static llvm libs

radeon_llvm_check and friends were never called in the no-opencl case,
which ended up with an empty llvm module list. As --enable-opencl always
requires --enable-llvm, we can use the latter as the guard.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
[Emil Velikov: commit message polish]
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoglsl: remove unecessary flags.q.subroutine_def
Samuel Pitoiset [Tue, 28 Feb 2017 23:31:20 +0000 (00:31 +0100)]
glsl: remove unecessary flags.q.subroutine_def

This bit is definitely not necessary because subroutine_list
can be used instead. This frees one more bit in the flags.q
struct which is nice because arb_bindless_texture will need
4 bits for the new layout qualifiers.

No piglit regressions found (including compiler tests) with
"-t subroutine".

v2: set the subroutine flag for validating illegal flags

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agovulkan: provide vk.xml as argument to the python generator
Emil Velikov [Tue, 28 Feb 2017 18:53:04 +0000 (18:53 +0000)]
vulkan: provide vk.xml as argument to the python generator

Do not hardcode the file in the python script, but pass it via the build
system(s). The latter is the only one that should know about the file
location/tree structure.

Cc: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoautomake: vulkan: rename/reuse VULKAN_UTIL_{GENERATED_,}FILES list
Emil Velikov [Tue, 28 Feb 2017 14:13:09 +0000 (14:13 +0000)]
automake: vulkan: rename/reuse VULKAN_UTIL_{GENERATED_,}FILES list

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoandroid: vulkan: add support for libmesa_vulkan_util
Mauro Rossi [Tue, 28 Feb 2017 00:24:41 +0000 (01:24 +0100)]
android: vulkan: add support for libmesa_vulkan_util

The following changes are implemented:

Add src/vulkan/Android.mk to build libmesa_vulkan_util
Android.mk: add src/vulkan to SUBDIR to build new module
intel/vulkan: fix libmesa_vulkan_util,vk_enum_to_str.h dependencies
Add -o OUTPUT_PATH option in src/vulkan/util/gen_enum_to_str.py script
Use -o OUTPUT_PATH option in automake generation rules for vk_enum_to_str.{c,h}

Fixes: e9dcb17 "vulkan/util: Add generator for enum_to_str functions"
Fixes: 8e03250 "vulkan: Combine wsi and util makefiles"
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
[Emil Velikov]
 - Move parser within main()
 - Use --outdir instead of -o
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoautomake: r600: radeonsi: correctly manage libamd_common.la linking
Emil Velikov [Tue, 28 Feb 2017 10:55:46 +0000 (10:55 +0000)]
automake: r600: radeonsi: correctly manage libamd_common.la linking

Since both r600 and radeonsi use code from libamd_common they need to
static link it. At the same time, adding a common library to LIB_DEPS is
fragile [can lean to multiple symbol definitions] and non-obvious - I
had to do a double-take how things work atm.

So follow the libradeon.la approach and put common libraries in
TARGET_RADEON_COMMON

Fixes: 936f5407a7d ("gallium/radeon: Add libamd_common.a to TARGET_LIB_DEPS also for r600")
Cc: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agoglx/tests: automake: add dispatch-index-check to the tarball
Emil Velikov [Tue, 28 Feb 2017 16:18:27 +0000 (16:18 +0000)]
glx/tests: automake: add dispatch-index-check to the tarball

Otherwise we'll fail at `make distcheck'

Fixes: 3cc33e76401 ("glx: add GLXdispatchIndex sort check")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoautomake: anv: add missing include $(top_srcdir)/src/vulkan/util
Emil Velikov [Tue, 28 Feb 2017 14:08:17 +0000 (14:08 +0000)]
automake: anv: add missing include $(top_srcdir)/src/vulkan/util

Otherwise we'll fail to find the header and `make distcheck` will bail.

Fixes: e9dcb17962f ("vulkan/util: Add generator for enum_to_str functions")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965/fs: emit MOV_INDIRECT with the source with the right register type
Samuel Iglesias Gonsálvez [Mon, 13 Feb 2017 11:09:53 +0000 (12:09 +0100)]
i965/fs: emit MOV_INDIRECT with the source with the right register type

This was hiding bugs as it retyped the source to destination's type.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoi965/fs: fix source type when emitting MOV_INDIRECT to read ICP handles
Samuel Iglesias Gonsálvez [Thu, 16 Feb 2017 09:47:01 +0000 (10:47 +0100)]
i965/fs: fix source type when emitting MOV_INDIRECT to read ICP handles

When generating the MOV INDIRECT instruction, the source type is ignored
and it is set to destination's type. However, this is going to change in a
later patch, so we need to explicitly set the proper source type.

brw_vec8_grf() creates an float type's fs_reg by default, when the
ICP handle is actually unsigned. This patch fixes these cases before
applying the aforementioned patch.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoi965/fs: fix indirect load DF uniforms on BSW/BXT
Samuel Iglesias Gonsálvez [Mon, 13 Feb 2017 12:24:18 +0000 (13:24 +0100)]
i965/fs: fix indirect load DF uniforms on BSW/BXT

The lowered BSW/BXT indirect move instructions had incorrect
source types, which luckily wasn't causing incorrect assembly to be
generated due to the bug fixed in the next patch, but would have
confused the remaining back-end IR infrastructure due to the mismatch
between the IR source types and the emitted machine code.

v2:
- Improve commit log (Curro)
- Fix read_size (Curro)
- Fix DF uniform array detection in assign_constant_locations() when
  it is acceded with 32-bit MOV_INDIRECTs in BSW/BXT.

v3:
- Move changes in assign_constant_locations() to other patch.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoi965/fs: detect different bit size accesses to uniforms to push them in proper locations
Samuel Iglesias Gonsálvez [Mon, 20 Feb 2017 10:03:46 +0000 (11:03 +0100)]
i965/fs: detect different bit size accesses to uniforms to push them in proper locations

Previously, if we had accesses with different sizes to the same uniform, we might not
push it aligned with the bigger one. This is a problem in BSW/BXT when we access
an array of DF uniform with both direct and indirect addressing because for the latter
we use 32-bit MOV INDIRECT instructions. However this problem can happen with other
generations and bitsizes.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoi965/fs: mark last DF uniform array element as 64 bit live one
Samuel Iglesias Gonsálvez [Tue, 21 Feb 2017 07:27:30 +0000 (08:27 +0100)]
i965/fs: mark last DF uniform array element as 64 bit live one

This bug can make that we don't detect the end of a contiguous area
correctly and push larger areas than the real ones.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoradv: fix txs for sampler buffers
Dave Airlie [Tue, 28 Feb 2017 06:26:55 +0000 (16:26 +1000)]
radv: fix txs for sampler buffers

I messed this up when I wrote it, this fixes:
dEQP-VK.memory.pipeline_barrier.*uniform_texel_buffer.*

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoamd/common: fix ASICREV_IS_POLARIS11_M for Polaris12
Marek Olšák [Tue, 28 Feb 2017 19:06:48 +0000 (20:06 +0100)]
amd/common: fix ASICREV_IS_POLARIS11_M for Polaris12

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Don't allocate space for unused immutable samplers.
Bas Nieuwenhuizen [Mon, 27 Feb 2017 19:25:24 +0000 (20:25 +0100)]
radv: Don't allocate space for unused immutable samplers.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/ac: Use constants for immutable samplers.
Bas Nieuwenhuizen [Mon, 27 Feb 2017 08:46:12 +0000 (09:46 +0100)]
radv/ac: Use constants for immutable samplers.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Detect if all immutable samplers for a binding are equal.
Bas Nieuwenhuizen [Mon, 27 Feb 2017 08:44:48 +0000 (09:44 +0100)]
radv: Detect if all immutable samplers for a binding are equal.

We can then use constants for indexed loads.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Store the immutable samplers as uint32_t[4].
Bas Nieuwenhuizen [Mon, 27 Feb 2017 08:29:26 +0000 (09:29 +0100)]
radv: Store the immutable samplers as uint32_t[4].

So we don't need to know about radv_sampler in ac_nir_to_llvm.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoegl/dri3: implement query surface hook
Brendan King [Fri, 17 Feb 2017 15:12:21 +0000 (15:12 +0000)]
egl/dri3: implement query surface hook

This is a DRI3 version of a change made for DRI2
(4d6d4f939e0af4252e0b, "egl/dri2: implement query surface hook"),
that fixed failures in dEQP-EGL.functional.resize.surface_size.grow
and dEQP-EGL.functional.resize.surface_size.shrink.

Cc: Tapani Pälli <tapani.palli@intel.com>
Cc: Mark Janes <mark.a.janes@intel.com>
Cc: Chad Versace <chadversary@chromium.org>
Signed-off-by: Brendan King <Brendan.King@imgtec.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
7 years agogallium/radeon: Add libamd_common.a to TARGET_LIB_DEPS also for r600
Michel Dänzer [Tue, 28 Feb 2017 06:21:39 +0000 (15:21 +0900)]
gallium/radeon: Add libamd_common.a to TARGET_LIB_DEPS also for r600

Fixes build failure with --enable-opencl --enable-xvmc:

make[4]: Entering directory '/home/daenzer/src/mesa-git/mesa/build-amd64/src/gallium/targets/xvmc'
  CXXLD    libXvMCgallium.la
../../../../src/gallium/drivers/r600/.libs/libr600.a(evergreen_compute.o): In function `evergreen_create_compute_state':
/home/daenzer/src/mesa-git/mesa/build-amd64/src/gallium/drivers/r600/../../../../../src/gallium/drivers/r600/evergreen_compute.c:254: undefined reference to `ac_elf_read'
../../../../src/gallium/drivers/r600/.libs/libr600.a(evergreen_compute.o): In function `r600_shader_binary_read_config':
/home/daenzer/src/mesa-git/mesa/build-amd64/src/gallium/drivers/r600/../../../../../src/gallium/drivers/r600/evergreen_compute.c:189: undefined reference to `ac_shader_binary_config_start'
/home/daenzer/src/mesa-git/mesa/build-amd64/src/gallium/drivers/r600/../../../../../src/gallium/drivers/r600/evergreen_compute.c:189: undefined reference to `ac_shader_binary_config_start'
collect2: error: ld returned 1 exit status
Makefile:760: recipe for target 'libXvMCgallium.la' failed

Fixes: dc4c551a345d ("radeon/ac: switch from radeon_elf_read() to ac_elf_read()")
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoi965: Move intel_resolve_map.[ch] from i965_compiler_FILES to i965_FILES
Kenneth Graunke [Mon, 27 Feb 2017 06:35:52 +0000 (22:35 -0800)]
i965: Move intel_resolve_map.[ch] from i965_compiler_FILES to i965_FILES

I have no idea why these were part of the compiler files.  They're
miptree related code, and the compiler doesn't appear to use them.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agogallium/r600: fix r600 build when OpenCL is enabled
Timothy Arceri [Tue, 28 Feb 2017 04:39:08 +0000 (15:39 +1100)]
gallium/r600: fix r600 build when OpenCL is enabled

Fixes build regression caused by d90bf4ef3e1db7

7 years agoradeon: remove unused radeon_elf_util.{c,h}
Timothy Arceri [Mon, 27 Feb 2017 00:48:08 +0000 (11:48 +1100)]
radeon: remove unused radeon_elf_util.{c,h}

We now use the shared code in AMD common instead.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeon/ac: switch to ac_shader_binary_config_start()
Timothy Arceri [Mon, 27 Feb 2017 00:24:54 +0000 (11:24 +1100)]
radeon/ac: switch to ac_shader_binary_config_start()

For radeonsi we could probably switch to
ac_shader_binary_read_config(). However the functions have
diverged so just share this helper for now.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeon/ac: make ac_shader_binary_config_start() available externally
Timothy Arceri [Mon, 27 Feb 2017 00:17:12 +0000 (11:17 +1100)]
radeon/ac: make ac_shader_binary_config_start() available externally

The read config functions are different for r600 and radeonsi so
we can't just share the one in amd common. So just share this
instead.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeon/ac: switch from radeon_elf_read() to ac_elf_read()
Timothy Arceri [Mon, 27 Feb 2017 00:06:51 +0000 (11:06 +1100)]
radeon/ac: switch from radeon_elf_read() to ac_elf_read()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeon/ac: switch from radeon_shader_binary to ac_shader_binary
Timothy Arceri [Sun, 26 Feb 2017 23:50:29 +0000 (10:50 +1100)]
radeon/ac: switch from radeon_shader_binary to ac_shader_binary

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeon/ac: add llvm_ir_string to ac_shader_binary struct
Timothy Arceri [Sun, 26 Feb 2017 23:16:18 +0000 (10:16 +1100)]
radeon/ac: add llvm_ir_string to ac_shader_binary struct

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoralloc: Delete autofree handling.
Kenneth Graunke [Fri, 24 Feb 2017 02:05:16 +0000 (02:05 +0000)]
ralloc: Delete autofree handling.

There was exactly one user of this, and I just removed it.

It also accessed an implicit global context, with no locking.  This
meant that it was only safe if all callers of ralloc_autofree_context()
held the same lock...which is a pretty terrible thing for a utility
library to impose.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agocompiler: Free types in _mesa_glsl_release_types() rather than autofree.
Kenneth Graunke [Fri, 24 Feb 2017 01:58:43 +0000 (01:58 +0000)]
compiler: Free types in _mesa_glsl_release_types() rather than autofree.

Instead of using ralloc_autofree_context() to install an atexit()
handler to ralloc_free(glsl_type::mem_ctx), we can simply free them
from _mesa_glsl_release_types().

This is effectively the same, because _mesa_glsl_release_types() is
called from _mesa_destroy_shader_compiler(), which is called from Mesa's
one_time_fini() function, which Mesa installs as an atexit() handler.

The one advantage here is that it ensures the built-in functions are
destroyed before the types.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoclover: Dump linked binary to a different file
Jan Vesely [Mon, 13 Feb 2017 20:46:03 +0000 (15:46 -0500)]
clover: Dump linked binary to a different file

this allows to pass the generated files directly to llc or bugpoint

v2: add atomic counter ID
v3: remove extra scope operator, constify

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoradv: fix depth format in blit2d.
Dave Airlie [Mon, 27 Feb 2017 06:59:06 +0000 (16:59 +1000)]
radv: fix depth format in blit2d.

For blitting we need to use the depth or stencil format, never
the combined.

This fixes:
dEQP-VK.texture.shadow.2d.nearest.less_or_equal_d32_sfloat_s8_uint
and a few others.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/formats: add fast clear for 8-bit signed ints.
Dave Airlie [Mon, 27 Feb 2017 02:15:03 +0000 (12:15 +1000)]
radv/formats: add fast clear for 8-bit signed ints.

These formats are used by some CTS tests, may as well fill them in.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agomesa/main: refactor sampler parameter error codepath
Samuel Pitoiset [Fri, 24 Feb 2017 11:42:46 +0000 (12:42 +0100)]
mesa/main: refactor sampler parameter error codepath

This is similar to what we do in the texture error codepath.
While we are at it, update the specification comment with
latest GL 4.5 spec.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoglsl: reject samplers not declared as uniform/function params earlier
Samuel Pitoiset [Fri, 24 Feb 2017 13:46:08 +0000 (14:46 +0100)]
glsl: reject samplers not declared as uniform/function params earlier

This improves consistency with image variables and atomic
counters which are already rejected the same way.

Note that opaque variables can't be treated as l-values, which
means only the 'in' function parameter is allowed.

v2: rewrite commit message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> (v1)
Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v2)
7 years agoglsl: use is_sampler() anywhere it's possible
Samuel Pitoiset [Fri, 24 Feb 2017 13:40:21 +0000 (14:40 +0100)]
glsl: use is_sampler() anywhere it's possible

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: use is_image() anywhere it's possible
Samuel Pitoiset [Fri, 24 Feb 2017 13:40:20 +0000 (14:40 +0100)]
glsl: use is_image() anywhere it's possible

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: add missing blend_support qualifier in validate_flags()
Samuel Pitoiset [Thu, 23 Feb 2017 18:17:37 +0000 (19:17 +0100)]
glsl: add missing blend_support qualifier in validate_flags()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Andres Gomez <agomez@igalia.com>
7 years agoglsl: use an enum for AMD_conservative_depth layout qualifiers
Samuel Pitoiset [Thu, 23 Feb 2017 17:07:58 +0000 (18:07 +0100)]
glsl: use an enum for AMD_conservative_depth layout qualifiers

The main idea behind this is to free some bits in the flags.q
struct because currently all 64-bits are used and we can't
add more layout qualifiers without reaching a static assert.

In order to do that (mainly for ARB_bindless_texture), use an
enumeration for the AMD_conservative_depth layout qualifiers
because it's forbidden to declare more than one depth qualifier
for gl_FragDepth.

Note that ast_type_qualifier::merge_qualifier() will prevent
using duplicate layout qualifiers by returning a compile-time
error.

No piglit regressions found (including compiler tests) with
RX480 on RadeonSI.

v2: use a switch case

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Andres Gomez <agomez@igalia.com> (v1)
7 years agoglsl: add has_shader_image_load_store()
Samuel Pitoiset [Thu, 23 Feb 2017 18:04:52 +0000 (19:04 +0100)]
glsl: add has_shader_image_load_store()

Preliminary work for ARB_bindless_texture which can interact
with ARB_shader_image_load_store.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agodrirc: add force_glsl_version=440 for The Culling
Samuel Pitoiset [Thu, 23 Feb 2017 11:04:28 +0000 (12:04 +0100)]
drirc: add force_glsl_version=440 for The Culling

This game uses GLSL 430 but the interpolation qualifiers in
some shaders don't match, which ends up in a link error. GLSL
440 spec removed this restriction, force it.

This fixes the following link error, as well as serious
rendering problems.

error: vertex shader output `out_TEXCOORD1' specifies noperspective
interpolation qualifier, but fragment shader input specifies no
interpolation qualifier

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoanv: Bump advertised version to 1.0.42
Jason Ekstrand [Mon, 27 Feb 2017 17:25:23 +0000 (09:25 -0800)]
anv: Bump advertised version to 1.0.42

We've been following the spec changes.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agovulkan: Update registry and headers to 1.0.42
Jason Ekstrand [Mon, 27 Feb 2017 17:15:17 +0000 (09:15 -0800)]
vulkan: Update registry and headers to 1.0.42

This brings in a bunch of new extensions

7 years agonir: Delete unused arg in get_iteration
Elie TOURNIER [Tue, 21 Feb 2017 16:15:16 +0000 (16:15 +0000)]
nir: Delete unused arg in get_iteration

nir_const_value is not needed in get_iteration

Signed-off-by: Elie Tournier <tournier.elie@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agodocs: fix a few typos
Eric Engestrom [Sun, 26 Feb 2017 23:58:03 +0000 (23:58 +0000)]
docs: fix a few typos

Noticed a couple, found the rest using vimspell.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agogallium/u_queue: set num_threads correctly if not all threads start
Grazvydas Ignotas [Sun, 26 Feb 2017 00:44:07 +0000 (02:44 +0200)]
gallium/u_queue: set num_threads correctly if not all threads start

If i-th thread could not be created it means we have i threads,
not i+1, because we start from 0.

Fixes: 404d0d5 "gallium/u_queue: add an option to have multiple worker threads"
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
7 years agogallium/u_queue: fix a crash with atexit handlers
Grazvydas Ignotas [Sun, 26 Feb 2017 00:44:06 +0000 (02:44 +0200)]
gallium/u_queue: fix a crash with atexit handlers

Commit 4aea8fe ("gallium/u_queue: fix random crashes when the app calls
exit()") added a atexit handler which calls
util_queue_killall_and_wait() for each queue to stop the threads.
However the app is also free to use atexit handlers to clean up things,
leading to util_queue_destroy() call which will also call
util_queue_killall_and_wait() for the same queue again, causing threads
being joined twice, and that is undefined. This happens with libglut,
for example. A simple fix is to just set num_threads to 0 as there are
no more valid threads after util_queue_killall_and_wait() returns.

Fixes: 4aea8fe "gallium/u_queue: fix random crashes when the app calls exit()"
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradv: Use correct size for availability flag.
Bas Nieuwenhuizen [Sun, 26 Feb 2017 21:36:10 +0000 (22:36 +0100)]
radv: Use correct size for availability flag.

Per spec, VK_QUERY_RESULT_64_BIT specifies the integer size and the
availability flag is an integer. We apparently handled this correctly
already for the copy to buffer case.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
7 years agoradv: Only use PKT3_OCCLUSION_QUERY when it doesn't hang.
Bas Nieuwenhuizen [Sun, 26 Feb 2017 21:26:30 +0000 (22:26 +0100)]
radv: Only use PKT3_OCCLUSION_QUERY when it doesn't hang.

PKT3_OCCLUSION_QUERY hangs when used in a nested IB. This only
calls it when in a primary command buffer and we change
GetQueryPoolResults to not need it. CmdCopyQueryPoolResults
still needs it so we break that behavior for secondary command buffers.
However, that would hang already and using an unitialized value is
better than a hang.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
7 years agoradv: Reset emitted compute pipeline when calling secondary cmd buffer.
Bas Nieuwenhuizen [Sun, 26 Feb 2017 19:01:26 +0000 (20:01 +0100)]
radv: Reset emitted compute pipeline when calling secondary cmd buffer.

Otherwise if the new compute pipeline is the same as the last used
pipeline before the call, we don't emit it again.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>