mesa.git
7 years agoac/nir: fix nir_op_unpack_64_2x32_split_y emission
Connor Abbott [Tue, 1 Aug 2017 01:31:54 +0000 (18:31 -0700)]
ac/nir: fix nir_op_unpack_64_2x32_split_y emission

This was broken thanks to a typo in b2367cf.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoac/nir: fix lsb emission
Connor Abbott [Tue, 1 Aug 2017 01:28:45 +0000 (18:28 -0700)]
ac/nir: fix lsb emission

This makes it match radeonsi. The LLVM backend itself will emit the
correct instruction, but LLVM might do incorrect optimizations since it
thinks the output is undefined when the input is 0, even though it's not
supposed to be. We really need a new intrinsic, or for the backend to
become smarter and recognize this pattern.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Bas Nieuwenhuizen <basni@google.com>
7 years agonir: fix algebraic optimizations
Connor Abbott [Tue, 1 Aug 2017 01:26:49 +0000 (18:26 -0700)]
nir: fix algebraic optimizations

The optimizations are only valid for 32-bit integers. They were
mistakenly firing for 64-bit integers as well.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoanv: Autogenerate extension query and lookup
Jason Ekstrand [Fri, 14 Jul 2017 05:50:30 +0000 (22:50 -0700)]
anv: Autogenerate extension query and lookup

As time goes on, extension advertising is going to get more complex.
Today, we either implement an extension or we don't.  However, in the
future, whether or not we advertise an extension will depend on kernel
or hardware features.  This commit introduces a python codegen framework
that generates the anv_EnumerateFooExtensionProperties functions as well
as a pair of anv_foo_extension_supported functions for querying for the
support of a given extension string.  Each extension has an "enable"
predicate that is any valid C expression.  For device extensions, the
physical device is available as "device" so the expression could be
something such as "device->has_kernel_feature".  For instance
extensions, the only option is VK_USE_PLATFORM defines.

This mechanism also means that we have a single one-line-per-entry table
for all extension declarations instead of the two tables we had in
anv_device.c and the one we had in anv_entrypoints_gen.py.  The Python
code is smart and uses the XML to determine whether an extension is an
instance extension or device extension.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv: Add a new centralized extensions file
Jason Ekstrand [Fri, 14 Jul 2017 02:10:25 +0000 (19:10 -0700)]
anv: Add a new centralized extensions file

This will allow us to keep everything in one place when it comes to
declaring what extensions are supported.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoegl/drm: Fix misused x and y offsets in swrast_get_image()
Gwan-gyeong Mun [Wed, 19 Jul 2017 14:05:31 +0000 (15:05 +0100)]
egl/drm: Fix misused x and y offsets in swrast_get_image()

It fixes misused x and y variables on the calculation of the memory copy regions.

Cc: Giovanni Campagna <gcampagna@src.gnome.org>
Fixes: 8430af5ebe1ee8119e14 "Add support for swrast to the DRM EGL platform"
Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
[Eric: use gbm_bo_get_bpp() instead of local function, split clamp patch]
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl/drm: Fix misused x and y offsets in swrast_put_image2()
Gwan-gyeong Mun [Wed, 19 Jul 2017 14:05:30 +0000 (15:05 +0100)]
egl/drm: Fix misused x and y offsets in swrast_put_image2()

It fixes misused x and y variables on the calculation of the memory copy regions.

Cc: Giovanni Campagna <gcampagna@src.gnome.org>
Fixes: 8430af5ebe1ee8119e14 "Add support for swrast to the DRM EGL platform"
Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
[Eric: use gbm_bo_get_bpp() instead of local function, split clamp patch]
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agogbm: add gbm_bo_get_bpp()
Eric Engestrom [Wed, 19 Jul 2017 14:05:29 +0000 (15:05 +0100)]
gbm: add gbm_bo_get_bpp()

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agogles: Restore some lost typedefs
Scott D Phillips [Fri, 30 Jun 2017 20:49:53 +0000 (13:49 -0700)]
gles: Restore some lost typedefs

GLES/gl.h has historically provided some typedefs that are not
used in the API itself. Restore these typedefs that were lost to
avoid breaking applications.

These seem to be the only typedefs removed in the update.

Fixes: 7fd0817 "Update Khronos-supplied headers"
[Eric: added a big warning to revert this patch when pulling the updated header]
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl: remove unnecessary empty array element
Eric Engestrom [Sun, 30 Jul 2017 01:11:59 +0000 (02:11 +0100)]
egl: remove unnecessary empty array element

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: split enums to make use of -Wswitch
Eric Engestrom [Sun, 30 Jul 2017 01:11:58 +0000 (02:11 +0100)]
egl: split enums to make use of -Wswitch

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: use designated initaliser for _eglGlobal
Eric Engestrom [Sun, 30 Jul 2017 01:11:57 +0000 (02:11 +0100)]
egl: use designated initaliser for _eglGlobal

Turn comments into actual code, that the compiler can check for us :)
(Speaking of, one of the comments had a typo. Challenge: find it)

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: make platform's SwapInterval() optional
Eric Engestrom [Mon, 31 Jul 2017 17:03:16 +0000 (18:03 +0100)]
egl: make platform's SwapInterval() optional

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoloader: remove clamp_swap_interval()
Eric Engestrom [Mon, 31 Jul 2017 16:47:35 +0000 (17:47 +0100)]
loader: remove clamp_swap_interval()

As of last commit, no invalid swap interval can be stored, so there's
no need to sanitize the values when reading them anymore.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoegl: deduplicate swap interval clamping logic
Eric Engestrom [Mon, 31 Jul 2017 13:49:31 +0000 (14:49 +0100)]
egl: deduplicate swap interval clamping logic

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoglsl: xfb_stride applies to buffers, not block members
Juan A. Suarez Romero [Fri, 7 Jul 2017 09:35:52 +0000 (09:35 +0000)]
glsl: xfb_stride applies to buffers, not block members

When we have an interface block like:

layout (xfb_buffer = 0, xfb_offset = 0) out Block {
                             vec4 var1;
    layout (xfb_stride = 48) vec4 var2;
                             vec4 var3;
};

According to ARB_enhanced_layouts spec:

   "The *xfb_stride* qualifier specifies how many bytes are consumed by
    each captured vertex.  It applies to the transform feedback buffer
    for that declaration, whether it is inherited or explicitly
    declared. It can be applied to variables, blocks, block members, or
    just the qualifier out. [ ...] While *xfb_stride* can be declared
    multiple times for the same buffer, it is a compile-time or
    link-time error to have different values specified for the stride
    for the same buffer."

This means xfb_stride actually applies to the buffer, and not to the
individual components.

In the above example, it means that var2 consumes 16 bytes, and var3 is
at offset 32.

This has been confirmed also by John Kessenich, the main contact for the
ARB_enhanced_layouts specs, and also because this commit fixes:

GL45.enhanced_layouts.xfb_block_member_stride

This commit is in practice a revert of 598790e8564 (glsl: apply
xfb_stride to implicit offsets for ifc block members).

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agobuild: Convert git_sha1_gen script to Python (part2).
Jose Fonseca [Tue, 1 Aug 2017 13:36:16 +0000 (14:36 +0100)]
build: Convert git_sha1_gen script to Python (part2).

Things pointed out by Emil.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agost/dri: don't set PIPE_BIND_SHARED for privately-allocated renderbuffers
Marek Olšák [Fri, 28 Jul 2017 23:19:19 +0000 (01:19 +0200)]
st/dri: don't set PIPE_BIND_SHARED for privately-allocated renderbuffers

which are MSAA and depth/stencil buffers.

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agoradeonsi: don't print AMD twice in the renderer string with the marketing name
Marek Olšák [Mon, 31 Jul 2017 21:22:31 +0000 (23:22 +0200)]
radeonsi: don't print AMD twice in the renderer string with the marketing name

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: print CE IBs into ddebug reports
Marek Olšák [Sun, 30 Jul 2017 23:34:44 +0000 (01:34 +0200)]
radeonsi: print CE IBs into ddebug reports

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: fix printing vertex buffer descriptors into ddebug reports
Marek Olšák [Sun, 30 Jul 2017 23:31:19 +0000 (01:31 +0200)]
radeonsi: fix printing vertex buffer descriptors into ddebug reports

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: don't flush sL1 conditionally in WAIT_ON_CE_COUNTER
Marek Olšák [Sat, 29 Jul 2017 20:03:38 +0000 (22:03 +0200)]
radeonsi: don't flush sL1 conditionally in WAIT_ON_CE_COUNTER

I don't know the condition for the flush, but we better turn this off.
The sL1 flush is used when CE dumps stuff into a ring buffer and the ring
buffer wraps.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: set up HTILE in descriptors only when level 0 is accessible
Marek Olšák [Sun, 30 Jul 2017 14:41:39 +0000 (16:41 +0200)]
radeonsi: set up HTILE in descriptors only when level 0 is accessible

Compression isn't enabled with non-zero levels.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: fix various CLEAR_STATE issues
Marek Olšák [Sun, 30 Jul 2017 01:37:21 +0000 (03:37 +0200)]
radeonsi: fix various CLEAR_STATE issues

Fixes: 064550238ef0 ("radeonsi: use CLEAR_STATE to initialize some
                      registers")
Bugzilla: https://bugs.freedesktop.org/101969
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agobuild: Convert git_sha1_gen script to Python.
Jose Fonseca [Tue, 1 Aug 2017 13:36:16 +0000 (14:36 +0100)]
build: Convert git_sha1_gen script to Python.

Python is the scripting language we've been using for scripts that need
to run across all supported platforms.

Shell is *not* a portable language for scripts.

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoFix SCons build
Nicolai Hähnle [Tue, 1 Aug 2017 09:27:05 +0000 (11:27 +0200)]
Fix SCons build

Fixes: 601093f95ddf ("xmlconfig: move into src/util")
Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>
Tested-by: Roland Scheidegger <sroland@vmware.com>
7 years agomesa: fix bad cast conversions in viewport()
Samuel Pitoiset [Mon, 31 Jul 2017 19:43:06 +0000 (21:43 +0200)]
mesa: fix bad cast conversions in viewport()

Fixes: ddc32537d6 ("mesa: clamp viewport values only once when using glViewport()")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101981
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101989
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
7 years agoi965/drm: Inline brw_bo_references.
Kenneth Graunke [Wed, 12 Apr 2017 05:55:02 +0000 (22:55 -0700)]
i965/drm: Inline brw_bo_references.

It's a single atomic add, so it makes sense to inline it.

Improves performance in Piglit's drawoverhead microbenchmark's
"DrawArrays ( 1 VBO, 0 UBO,  0    ) w/ no state change" subtest by
0.400922% +/- 0.310389% (n=350) on my i7-7700HQ.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoRevert "st_glsl_to_tgsi: rewrite rename registers to use array fully."
Dave Airlie [Mon, 31 Jul 2017 07:37:10 +0000 (08:37 +0100)]
Revert "st_glsl_to_tgsi: rewrite rename registers to use array fully."

This reverts commit 3008161d28e38336ba39aba4769a2deaf9732f55,
which caused a regression for VMWare.

The initial code had some recursion in it, that I removed by accident
trying to add back the recursion broke lots of things, take the high
road and revert for now.

Fixes: 3008161d (st_glsl_to_tgsi: rewrite rename registers to use array fully.)
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: handle 10-bit format clamping workaround.
Dave Airlie [Thu, 27 Jul 2017 20:52:20 +0000 (21:52 +0100)]
radv: handle 10-bit format clamping workaround.

This fixes:
dEQP-VK.api.copy_and_blit.core.blit_image.all_formats.*
for a2r10g10b10 formats as destination on SI/CIK hardware.

This adds support to the meta program for emitting 10-bit
outputs, and adds 10-bit support to the fragment shader key.

It also only does the int8/10 on SI/CIK.

Fixes: f4e499ec7 (radv: add initial non-conformant radv vulkan driver)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agogallium/targets: Fix d3dadapter9 build after xmlconfig move.
Bas Nieuwenhuizen [Mon, 31 Jul 2017 19:47:36 +0000 (21:47 +0200)]
gallium/targets: Fix d3dadapter9 build after xmlconfig move.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Fixes: 601093f95dd "xmlconfig: move into src/util"
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradv: Don't underflow non-visible VRAM size.
Bas Nieuwenhuizen [Sun, 30 Jul 2017 21:26:11 +0000 (23:26 +0200)]
radv: Don't underflow non-visible VRAM size.

In some APU situations the reported visible size can be larger than
VRAM size. This properly clamps the value.

Surprisingly both CTS and spec seem to allow a heap type with size 0,
so this seemed like the easiest option to me.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Fixes: 4ae84efbc5c "radv: Use enum for memory heaps."
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agoAndroid: fix xmlconfig build
Rob Herring [Mon, 31 Jul 2017 15:42:10 +0000 (10:42 -0500)]
Android: fix xmlconfig build

Commit 601093f95ddf ("xmlconfig: move into src/util") broke the Android
build due to missing libexpat dependency:

external/mesa3d/src/util/xmlconfig.c:34:10: fatal error: 'expat.h' file not found

Fixes: 601093f95ddf ("xmlconfig: move into src/util")
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
7 years agodocs: Update feature list for GL 4.6
Adam Jackson [Mon, 31 Jul 2017 16:27:21 +0000 (12:27 -0400)]
docs: Update feature list for GL 4.6

ARB_polygon_offset_clamp and ARB_texture_filter_anisotropic look like
they'd be pretty trivial to wire up.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
7 years agoutil/ra: fix memory leak
Eric Engestrom [Mon, 31 Jul 2017 13:13:58 +0000 (14:13 +0100)]
util/ra: fix memory leak

CID: 1415909
Fixes: 7a34a0e8903249c41fae "ra: Add a callback for selecting a register
                             from what's available."
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: drop unnecessary GLAPIENTRY to _mesa_init_line()
Samuel Pitoiset [Mon, 31 Jul 2017 12:11:31 +0000 (14:11 +0200)]
mesa: drop unnecessary GLAPIENTRY to _mesa_init_line()

Noticed randomly.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa: only check errors when the state change in glClipControl()
Samuel Pitoiset [Mon, 31 Jul 2017 12:07:08 +0000 (14:07 +0200)]
mesa: only check errors when the state change in glClipControl()

When this GL call is a no-op, it should be a little faster in
the errors path only.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: only check errors when the state change in glPointSize()
Samuel Pitoiset [Mon, 31 Jul 2017 12:07:07 +0000 (14:07 +0200)]
mesa: only check errors when the state change in glPointSize()

When this GL call is a no-op, it should be a little faster in
the errors path only.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: only check errors when the state change in glCullFace()
Samuel Pitoiset [Mon, 31 Jul 2017 12:07:06 +0000 (14:07 +0200)]
mesa: only check errors when the state change in glCullFace()

When this GL call is a no-op, it should be a little faster in
the errors path only.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: only check errors when the state change in glProvokingVertex()
Samuel Pitoiset [Mon, 31 Jul 2017 12:07:05 +0000 (14:07 +0200)]
mesa: only check errors when the state change in glProvokingVertex()

When this GL call is a no-op, it should be a little faster.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agodri_interface: document loaderPrivate for getCapability
Marek Olšák [Mon, 31 Jul 2017 16:21:15 +0000 (18:21 +0200)]
dri_interface: document loaderPrivate for getCapability

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoac/common: always build NIR translation
Nicolai Hähnle [Mon, 31 Jul 2017 15:41:23 +0000 (17:41 +0200)]
ac/common: always build NIR translation

radeonsi needs it now, and we require LLVM 3.9 anyway.

Fixes a build with radeonsi but not radv.

7 years agoAndroid: fix compile error for DRI2 loader getCapability
Rob Herring [Mon, 31 Jul 2017 14:32:10 +0000 (09:32 -0500)]
Android: fix compile error for DRI2 loader getCapability

Fix compile failure from commit 1bf703e4ea5c ("dri_interface,egl,gallium:
only expose RGBA visuals on Android").

Fixes: 1bf703e4ea5c ("dri_interface,egl,gallium: only expose RGBA visuals on Android")
Cc: 17.2 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Rob Herring <robh@kernel.org>
7 years agoAttempt to fix AppVeyor build, round 2
Nicolai Hähnle [Mon, 31 Jul 2017 15:17:44 +0000 (17:17 +0200)]
Attempt to fix AppVeyor build, round 2

7 years agoRevert "st/mesa: release sampler views when redefining a texture in st_context_teximage"
Marek Olšák [Mon, 31 Jul 2017 14:53:19 +0000 (16:53 +0200)]
Revert "st/mesa: release sampler views when redefining a texture in st_context_teximage"

This reverts commit 5c1241268ba9b240cb79ab9a30c5255b176c83c9.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101961

Cc: 17.2 <mesa-stable@lists.freedesktop.org>
7 years agoAttempt to fix the AppVeyor build
Nicolai Hähnle [Mon, 31 Jul 2017 14:51:13 +0000 (16:51 +0200)]
Attempt to fix the AppVeyor build

7 years agoxmlconfig: move into src/util
Nicolai Hähnle [Fri, 30 Jun 2017 09:57:06 +0000 (11:57 +0200)]
xmlconfig: move into src/util

v2: attempt to fix Android build (Emil)

v3: add missing include path

Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
7 years agoxmlconfig: remove GL type dependencies
Nicolai Hähnle [Fri, 30 Jun 2017 09:56:50 +0000 (11:56 +0200)]
xmlconfig: remove GL type dependencies

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: ensure that temp array allocas are in the entry block
Nicolai Hähnle [Sat, 29 Jul 2017 07:17:53 +0000 (09:17 +0200)]
radeonsi: ensure that temp array allocas are in the entry block

Otherwise, code generation fails. This has become necessary since some
shaders are wrapped in control flow.

Fixes: 081ac6e5c6d2 ("radeonsi/gfx9: always wrap GS and TCS in an if-block (v2)")
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: enable R600_DEBUG=nir for vertex and fragment shaders
Nicolai Hähnle [Mon, 15 May 2017 23:51:41 +0000 (01:51 +0200)]
radeonsi: enable R600_DEBUG=nir for vertex and fragment shaders

Also, disable geometry and tessellation shaders. Mixing and matching NIR
and TGSI shaders should work (and I've tested it for the VS/PS interface),
but geometry and tessellation requires VS-as-ES/LS, which isn't implemented
yet for NIR.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: VS as ES/LS are not yet supported with R600_DEBUG=nir
Nicolai Hähnle [Mon, 15 May 2017 23:19:04 +0000 (01:19 +0200)]
radeonsi: VS as ES/LS are not yet supported with R600_DEBUG=nir

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi/nir: lower uniforms to UBO loads
Nicolai Hähnle [Tue, 4 Jul 2017 09:09:50 +0000 (11:09 +0200)]
radeonsi/nir: lower uniforms to UBO loads

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: implement load_frag_coord intrinsic
Nicolai Hähnle [Tue, 4 Jul 2017 09:09:24 +0000 (11:09 +0200)]
ac/nir: implement load_frag_coord intrinsic

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi/nir: lower txp instructions
Nicolai Hähnle [Mon, 3 Jul 2017 13:32:29 +0000 (15:32 +0200)]
radeonsi/nir: lower txp instructions

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: pass ac_llvm_context to unpack_param
Nicolai Hähnle [Sun, 25 Jun 2017 17:50:16 +0000 (19:50 +0200)]
ac/nir: pass ac_llvm_context to unpack_param

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir,radeonsi: add and use ac_shader_abi::frag_pos
Nicolai Hähnle [Sun, 25 Jun 2017 17:48:09 +0000 (19:48 +0200)]
ac/nir,radeonsi: add and use ac_shader_abi::frag_pos

v2: update for LLVMValueRefs in ac_shader_abi

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir,radeonsi: add and use ac_shader_abi::{ancillary,sample_coverage}
Nicolai Hähnle [Sun, 25 Jun 2017 17:40:40 +0000 (19:40 +0200)]
ac/nir,radeonsi: add and use ac_shader_abi::{ancillary,sample_coverage}

v2: update for LLVMValueRefs in ac_shader_abi

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir,radv: move force_persample to ac_shader_info::force_persample
Nicolai Hähnle [Sun, 25 Jun 2017 17:36:06 +0000 (19:36 +0200)]
ac/nir,radv: move force_persample to ac_shader_info::force_persample

Avoid accessing radv-specific structures during the meat of NIR-to-LLVM
translation.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: tweak next-shader assumptions when streamout is used
Nicolai Hähnle [Sun, 25 Jun 2017 17:01:13 +0000 (19:01 +0200)]
radeonsi: tweak next-shader assumptions when streamout is used

VS with streamout is always a HW VS.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: use new function ac_build_umin for edgeflag clamping
Nicolai Hähnle [Sun, 25 Jun 2017 15:56:37 +0000 (17:56 +0200)]
radeonsi: use new function ac_build_umin for edgeflag clamping

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: clamp shadow texture comparison value on VI
Nicolai Hähnle [Sun, 25 Jun 2017 13:45:09 +0000 (15:45 +0200)]
ac/nir: clamp shadow texture comparison value on VI

Needed for TC-compatible HTILE in radeonsi for test cases like
piglit spec/arb_texture_rg/execution/fs-shadow2d-red-01.shader_test

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: add always_vector argument to ac_build_gather_values_extended
Nicolai Hähnle [Sun, 25 Jun 2017 11:04:51 +0000 (13:04 +0200)]
ac/nir: add always_vector argument to ac_build_gather_values_extended

This simplifies a bunch of places that no longer need special treatment
of value_count == 1. We rely on LLVM to optimize away the 1-element vector
types.

This fixes a bunch of bugs where 1-element arrays are indexed indirectly.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir,radeonsi: add ac_shader_abi::front_face
Nicolai Hähnle [Sun, 25 Jun 2017 10:56:49 +0000 (12:56 +0200)]
ac/nir,radeonsi: add ac_shader_abi::front_face

v2: update for LLVMValueRefs in ac_shader_abi

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: pass ac_nir_context to emit_ddxy
Nicolai Hähnle [Sat, 24 Jun 2017 20:57:33 +0000 (22:57 +0200)]
ac/nir: pass ac_nir_context to emit_ddxy

Allocating the ddxy_lds is considered to be part of the API shader
translation and not part of the ABI.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: pass ac_nir_context to SSBO intrinsic handlers
Nicolai Hähnle [Sat, 24 Jun 2017 18:16:29 +0000 (20:16 +0200)]
ac/nir: pass ac_nir_context to SSBO intrinsic handlers

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: implement and use ac_shader_abi::load_ssbo
Nicolai Hähnle [Sat, 24 Jun 2017 18:03:46 +0000 (20:03 +0200)]
radeonsi: implement and use ac_shader_abi::load_ssbo

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: make get_indirect_index globally visible
Nicolai Hähnle [Sat, 24 Jun 2017 18:08:30 +0000 (20:08 +0200)]
radeonsi: make get_indirect_index globally visible

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: load buffer descriptors via ac_shader_abi::load_ssbo
Nicolai Hähnle [Sat, 24 Jun 2017 17:17:54 +0000 (19:17 +0200)]
ac/nir: load buffer descriptors via ac_shader_abi::load_ssbo

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: pass ac_nir_context to emit_discard_if
Nicolai Hähnle [Sat, 24 Jun 2017 16:40:17 +0000 (18:40 +0200)]
ac/nir: pass ac_nir_context to emit_discard_if

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: extract shader_info->fs.can_discard from NIR shader info
Nicolai Hähnle [Sat, 24 Jun 2017 16:38:38 +0000 (18:38 +0200)]
ac/nir: extract shader_info->fs.can_discard from NIR shader info

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi/nir: perform radeonsi-specific lowering and optimization passes
Nicolai Hähnle [Sat, 24 Jun 2017 15:48:22 +0000 (17:48 +0200)]
radeonsi/nir: perform radeonsi-specific lowering and optimization passes

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi/nir: perform lowering of input/output driver locations
Nicolai Hähnle [Sat, 24 Jun 2017 15:30:16 +0000 (17:30 +0200)]
radeonsi/nir: perform lowering of input/output driver locations

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: handle old-style shadow tex instructions correctly
Nicolai Hähnle [Sat, 24 Jun 2017 15:29:43 +0000 (17:29 +0200)]
ac/nir: handle old-style shadow tex instructions correctly

The first element is only extracted for new-style shadow tex.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: whitespace fixes
Nicolai Hähnle [Sat, 24 Jun 2017 12:50:45 +0000 (14:50 +0200)]
ac/nir: whitespace fixes

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: use shader_info pass to determine whether instance_id is used
Nicolai Hähnle [Mon, 26 Jun 2017 12:36:47 +0000 (14:36 +0200)]
ac/nir: use shader_info pass to determine whether instance_id is used

This improves the separation of ABI and NIR translation.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: move setting shader_info->fs.writes_memory to radv-specific code
Nicolai Hähnle [Fri, 9 Jun 2017 15:50:18 +0000 (17:50 +0200)]
ac/nir: move setting shader_info->fs.writes_memory to radv-specific code

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi/nir: add image descriptor loading
Nicolai Hähnle [Fri, 9 Jun 2017 15:48:11 +0000 (17:48 +0200)]
radeonsi/nir: add image descriptor loading

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: add image and write parameter to ac_shader_abi::load_sampler_desc
Nicolai Hähnle [Fri, 9 Jun 2017 15:47:34 +0000 (17:47 +0200)]
ac/nir: add image and write parameter to ac_shader_abi::load_sampler_desc

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: add support for arrays-of-arrays to get_sampler_desc
Nicolai Hähnle [Fri, 9 Jun 2017 13:16:51 +0000 (15:16 +0200)]
ac/nir: add support for arrays-of-arrays to get_sampler_desc

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi/nir: set si_shader_context::num_{sampler,images}
Nicolai Hähnle [Fri, 9 Jun 2017 13:16:14 +0000 (15:16 +0200)]
radeonsi/nir: set si_shader_context::num_{sampler,images}

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi/nir: implement ac_shader_abi::load_sampler_desc
Nicolai Hähnle [Thu, 8 Jun 2017 23:52:06 +0000 (01:52 +0200)]
radeonsi/nir: implement ac_shader_abi::load_sampler_desc

v2: remove enum desc_type from radeonsi (Marek)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: pass ac_nir_context to tex_fetch_ptrs and related functions
Nicolai Hähnle [Thu, 8 Jun 2017 23:41:55 +0000 (01:41 +0200)]
ac/nir: pass ac_nir_context to tex_fetch_ptrs and related functions

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: add and use ac_shader_abi::load_sampler_desc
Nicolai Hähnle [Thu, 8 Jun 2017 23:31:45 +0000 (01:31 +0200)]
ac/nir: add and use ac_shader_abi::load_sampler_desc

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: pass ac_nir_context to visit_tex and various related functions
Nicolai Hähnle [Thu, 8 Jun 2017 18:06:39 +0000 (20:06 +0200)]
ac/nir: pass ac_nir_context to visit_tex and various related functions

Get most of the churn out of the way before actually loading samplers
via the ABI.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir,radeonsi: add ac_shader_abi::chip_class
Nicolai Hähnle [Thu, 8 Jun 2017 18:05:09 +0000 (20:05 +0200)]
ac/nir,radeonsi: add ac_shader_abi::chip_class

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi/nir: emit FS outputs
Nicolai Hähnle [Thu, 8 Jun 2017 17:38:51 +0000 (19:38 +0200)]
radeonsi/nir: emit FS outputs

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi/nir: load FS inputs
Nicolai Hähnle [Thu, 8 Jun 2017 17:10:33 +0000 (19:10 +0200)]
radeonsi/nir: load FS inputs

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi/nir: load VS inputs
Nicolai Hähnle [Thu, 8 Jun 2017 16:38:06 +0000 (18:38 +0200)]
radeonsi/nir: load VS inputs

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir,radeonsi: add ac_shader_abi::load_ubo
Nicolai Hähnle [Sat, 20 May 2017 15:19:50 +0000 (17:19 +0200)]
ac/nir,radeonsi: add ac_shader_abi::load_ubo

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: pass ac_nir_context to visit_load_ubo_buffer
Nicolai Hähnle [Sat, 20 May 2017 07:25:25 +0000 (09:25 +0200)]
ac/nir: pass ac_nir_context to visit_load_ubo_buffer

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: pass ac_nir_context to visit_{load,store}_var and get_deref_offset helper
Nicolai Hähnle [Fri, 19 May 2017 17:40:06 +0000 (19:40 +0200)]
ac/nir: pass ac_nir_context to visit_{load,store}_var and get_deref_offset helper

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: pass ac_llvm_context to some helper functions
Nicolai Hähnle [Fri, 19 May 2017 17:39:16 +0000 (19:39 +0200)]
ac/nir: pass ac_llvm_context to some helper functions

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: pass ac_nir_context to visit_intrinsic
Nicolai Hähnle [Fri, 19 May 2017 17:25:43 +0000 (19:25 +0200)]
ac/nir: pass ac_nir_context to visit_intrinsic

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: add ac_nir_context::main_function
Nicolai Hähnle [Fri, 19 May 2017 17:22:09 +0000 (19:22 +0200)]
ac/nir: add ac_nir_context::main_function

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: split scanning outputs from setting up output allocas
Nicolai Hähnle [Fri, 19 May 2017 16:48:13 +0000 (18:48 +0200)]
ac/nir: split scanning outputs from setting up output allocas

The scanning phase sets the driver_location, because it is part of the
ABI: radeonsi does the assignment differently.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: pass ac_llvm_context to *build_alloca* helpers
Nicolai Hähnle [Fri, 19 May 2017 16:47:02 +0000 (18:47 +0200)]
ac/nir: pass ac_llvm_context to *build_alloca* helpers

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac/nir: use ac_shader_abi::emit_outputs
Nicolai Hähnle [Fri, 19 May 2017 16:37:49 +0000 (18:37 +0200)]
ac/nir: use ac_shader_abi::emit_outputs

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoac,radeonsi: add ac_shader_abi::emit_outputs for hardware VS shaders
Nicolai Hähnle [Fri, 19 May 2017 16:32:57 +0000 (18:32 +0200)]
ac,radeonsi: add ac_shader_abi::emit_outputs for hardware VS shaders

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: pass si_shader_context to get_primitive_id
Nicolai Hähnle [Fri, 19 May 2017 16:17:12 +0000 (18:17 +0200)]
radeonsi: pass si_shader_context to get_primitive_id

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: translate NIR to LLVM
Nicolai Hähnle [Fri, 19 May 2017 15:43:51 +0000 (17:43 +0200)]
radeonsi: translate NIR to LLVM

Reviewed-by: Marek Olšák <marek.olsak@amd.com>