mesa.git
5 years agoglx: add support for putimageshm2 path (v2)
Dave Airlie [Thu, 27 Dec 2018 04:26:33 +0000 (14:26 +1000)]
glx: add support for putimageshm2 path (v2)

v2: pass x,0 in as the offset coords at glx level not earlier

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
5 years agodri_interface: add put shm image2 (v2)
Dave Airlie [Thu, 27 Dec 2018 04:26:04 +0000 (14:26 +1000)]
dri_interface: add put shm image2 (v2)

This adds a new interface to the swrast interface to fix an shm put image bug.

The current code adds the x,y src offsets into the offset parameters,
however if the x offset is > 0, and the put image copies up to the height
of the image, this can trigger an X server validation check to fail and
the renderering to get BadMatch.

This patch fixes it to pass the x offset coord in as a src x.

We cannot pass the Y coordinate due to the horrible code mangling the
image w/h vs stride in swrastXPutImage.

v2: drop srcx,y from api

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
5 years agomapi: remove machinery handling CSV files
Emil Velikov [Wed, 14 Nov 2018 14:18:25 +0000 (14:18 +0000)]
mapi: remove machinery handling CSV files

We haven't have one in years, so just drop the code.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomapi: remove old, unused ES* generator code
Emil Velikov [Wed, 21 Nov 2018 05:21:58 +0000 (05:21 +0000)]
mapi: remove old, unused ES* generator code

As of earlier commit, everyone has switched to the new script for the ES
dispatch.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomapi/es2api: remove no longer present entrypoints
Emil Velikov [Wed, 21 Nov 2018 05:05:35 +0000 (05:05 +0000)]
mapi/es2api: remove no longer present entrypoints

With the previous scripts API from the following was incorrectly
exported. Drop them from the list, since they're no longer around.

GL_EXT_blend_func_extended
GL_EXT_texture_integer

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomapi/es*api: remove GL_EXT_multi_draw_arrays entrypoints
Emil Velikov [Tue, 20 Nov 2018 18:46:56 +0000 (18:46 +0000)]
mapi/es*api: remove GL_EXT_multi_draw_arrays entrypoints

Now we use the upstream XML file and a cleaner generator. Thus the
symbols are no longer exported and we can drop them from this list.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomapi/es*api: remove GL_OES_EGL_image entrypoints
Emil Velikov [Tue, 20 Nov 2018 18:45:32 +0000 (18:45 +0000)]
mapi/es*api: remove GL_OES_EGL_image entrypoints

As some point in the past we fixed the scripts so, these are no longer
exported. Drop them from the list.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agoRevert "mapi/new: sort by slot number"
Emil Velikov [Fri, 14 Dec 2018 13:14:29 +0000 (13:14 +0000)]
Revert "mapi/new: sort by slot number"

This reverts commit a1f5d9412cf7cacb3534635f6c2409fafbe6574e.

We no longer needed to sort - it was meant only to ease compare against
the old generated files.

5 years agoscons: wire the new generator for es1 and es2
Emil Velikov [Tue, 20 Nov 2018 17:44:43 +0000 (17:44 +0000)]
scons: wire the new generator for es1 and es2

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomeson: wire the new generator for es1 and es2
Emil Velikov [Tue, 20 Nov 2018 17:30:47 +0000 (17:30 +0000)]
meson: wire the new generator for es1 and es2

v2: use ${foo})_py naming (Dylan)
v3: use symbolic name for genCommon.py

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> (v2)
5 years agoautotools: wire the new generator for es1 and es2
Emil Velikov [Thu, 15 Nov 2018 14:49:08 +0000 (14:49 +0000)]
autotools: wire the new generator for es1 and es2

The output produced functionally identical, with the following changes:
 - A cosmetic: swapped ABI compatible types [ GLclampf -> GLfloat, etc ]
 - B cosmetic: renamed parameters [ zNear -> n, etc ]
 - C dropped extension entrypoints - invalid/incorrect

To make things easier to validate, normalise both old/new headers run
the sed patterns A, B and C to both sets.

A
      s/\<GLclampf\>/GLfloat/g; s/\<GLclampx\>/GLfixed/g;
      s/\<GLvoid\>/void/g;

B
      s/\ \* / */g; s/\<texture\>/target/g;
      s/\<plane\>/p/g; s/\<depth\>/d/g; s/\<modeAlpha\>/modeA/g;
      s/\<shader\>/program/g; s/\<obj\>/shaders/g; s/\<equation\>/eqn/g;
      s/\<param\>/data/g; s/\<params\>/data/g; s/\<buffers\>/buffer/g;
      s/\<src\>/mode/g; s/\<count\>/n/g; s/\<zNear\>/n/g; s/\<zFar\>/f/g;
      s/\<zfail\>/dpfail/g; s/\<zpass\>/dppass/g; s/\<buf\>/index/g;
      s/\<value\>/target/g; s/\<cap\>/target/g; s/\<maskNumber\>/index/g;
      s/\<srcRGB\>/sfactorRGB/g; s/\<dstRGB\>/dfactorRGB/g;
      s/\<srcAlpha\>/sfactorAlpha/g; s/\<dstAlpha\>/dfactorAlpha/g;
      s/\<primitiveMode\>/mode/g; s/\<primcount\>/instancecount/g;
      s/\<top\>/t/g; s/\<bottom\>/b/g; s/\<left\>/l/g; s/\<right\>/r/g;
      s/\<x\>/v0/g; s/\<y\>/v1/g; s/\<z\>/v2/g; s/\<w\>/v3/g;
      s/\<sfactor\>/mode/g; s/\<dfactor\>/dst/g; s/\<attribindex\>/bindingindex/g;
      s/\<internalFormat\>/internalformat/g; s/\<bufSize\>/bufsize/g;

C
glMultiDrawArraysEXT
glMultiDrawElementsEXT

glBindFragDataLocationEXT

glGetTexParameterIivEXT
glGetTexParameterIuivEXT
glTexParameterIivEXT
glTexParameterIuivEXT

v2:
 - gl_dispatch_stub declarations are addressed with previous patch
 - the public_entries table is no longer generated

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomapi/new: remove duplicate GLvoid/void substitution
Emil Velikov [Tue, 20 Nov 2018 16:43:41 +0000 (16:43 +0000)]
mapi/new: remove duplicate GLvoid/void substitution

We already do it a few lines above - drop the duplicate.

Note that for consistency sake, we keep the substitution since the GL
API is a mixed bad - some use GLvoid while others a normal void.

We might want to merge this back in GLVND.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomapi/new: fixup the GLDEBUGPROCKHR typedef to the non KHR one
Emil Velikov [Mon, 19 Nov 2018 16:12:49 +0000 (16:12 +0000)]
mapi/new: fixup the GLDEBUGPROCKHR typedef to the non KHR one

This way we can reuse the latter, which is already present in the
headers that we use. Thus we can drop the manual typedef we generate.

We might want to merge this back in GLVND.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomapi/new: don't print info we don't need for ES1/ES2
Emil Velikov [Thu, 15 Nov 2018 14:49:32 +0000 (14:49 +0000)]
mapi/new: don't print info we don't need for ES1/ES2

There is no need for the noop functions, the public_stubs and
public_entries table or table size defines. Remove those.

Pretty much all of this is applicable to GLVND, although it
requires preparatory work.

v2:
 - python style fixes (Dylan)
 - use "gldispatch" instead of not "glesv1" "glesv2"
 - remove the public_entries table/array (Erik)

v3:
 - use if == "gldispatch", instead of "in" (Kyle)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> (v2)
5 years agomapi/new: split out public_entries handling
Emil Velikov [Sun, 9 Dec 2018 21:11:54 +0000 (21:11 +0000)]
mapi/new: split out public_entries handling

The only instance that requires the public_entries table is the
dispatch library - split that into another function.

We have to be careful with when undefining the guard, so split it out.

We might want to merge this back in GLVND.
Minor GLVND cleanup will be needed first.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
5 years agomapi/new: reinstate _NO_HIDDEN suffixes in the new generator
Emil Velikov [Mon, 19 Nov 2018 15:51:54 +0000 (15:51 +0000)]
mapi/new: reinstate _NO_HIDDEN suffixes in the new generator

Strictly speaking we can rework the rest of the code so we do not need
those. That said, this will require a series on it's own so let's carry
this local quirk for now.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomapi/new: use the static_data offsets in the new generator
Emil Velikov [Thu, 15 Nov 2018 18:40:21 +0000 (18:40 +0000)]
mapi/new: use the static_data offsets in the new generator

Otherwise the incorrect ones will be used, effectively breaking the ABI.

Note: some entries in static_data.py list a suffixed API, while (for ES*
at least) we expect the one w/o suffix.

v2:
 - rework path handling (Dylan)
 - use else if chain (Erik)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomapi/new: sort by slot number
Emil Velikov [Mon, 19 Nov 2018 14:19:03 +0000 (14:19 +0000)]
mapi/new: sort by slot number

Makes it easier to compare the newly generated header against the old
one. Will be reverted after the transition.

5 years agomapi/new: import mapi scripts from glvnd
Emil Velikov [Thu, 15 Nov 2018 11:02:12 +0000 (11:02 +0000)]
mapi/new: import mapi scripts from glvnd

Currently we have over 20 scripts that generate the libGL* dispatch and
various other functionality. More importantly we're using local XML
files instead of the Khronos provides one(s). Resulting in an
increasing complexity of writing, maintaining and bugfixing.

One fairly annoying bug is handling of statically exported symbols.
Today, if we enable a GL extension for GLES1/2, we add a special tag to
the xml. Thus the ES dispatch gets generated, but also since we have no
separate notion of GL/ES1/ES2 static functions it also gets exported
statically.

This commit adds step one towards clearing and simplifying our setup.
It imports the mapi generator from GLVND.

  012fe39 ("Remove a couple of duplicate typedefs.")

v2: use local genCommon.py

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomapi: move genCommon.py to src/mapi/new
Emil Velikov [Sun, 9 Dec 2018 19:51:15 +0000 (19:51 +0000)]
mapi: move genCommon.py to src/mapi/new

The helper will also be used by the new Khronos gl.xml aware generator.

v2: Move existing one, instead of duplicating it.
v3: Correct genCommon.py references in meson [Erik]
v4: Drop the file from the EGL EXTRA_DIST [Erik]

Suggested-by: Kyle Brenneman <kbrenneman@nvidia.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
5 years agogenCommon.py: Fix typo in _LIBRARY_FEATURE_NAMES.
Emil Velikov [Sun, 9 Dec 2018 19:32:54 +0000 (19:32 +0000)]
genCommon.py: Fix typo in _LIBRARY_FEATURE_NAMES.

Port glvnd commit 37fc6caa4b8 ("Fix typo in _LIBRARY_FEATURE_NAMES.")
from Michal Srb.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomapi: add all _glapi_table entrypoints to static_data.py
Emil Velikov [Mon, 19 Nov 2018 14:08:15 +0000 (14:08 +0000)]
mapi: add all _glapi_table entrypoints to static_data.py

Currently various parts of mesa use the glapi_table differently.

Some use _glapi_get_proc_offset() to get the offset, while others
directly reference the specific offset via _gloffset_Function.

Add all static entries, to ensure things don't break as we flip to the
upstream XML + new mapi generator.

Note: the offsets are also used for the alias remap table, thus we need
to ensure we honour the correct offsets range or it will break.

Currently this is done via MAX_OFFSETS constant, although a better
solution is in the works.

v2: add FramebufferTexture2DMultisampleEXT
v3: add MAX_OFFSETS guard

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> (v1)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
5 years agomapi: sort static entrypoints numerically
Emil Velikov [Mon, 19 Nov 2018 14:10:40 +0000 (14:10 +0000)]
mapi: sort static entrypoints numerically

A few of the entrypoints were incorrectly placed. Sort those to align
with the rest of the list.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agoRevert "mesa/main: remove ARB suffix from glGetnTexImage"
Emil Velikov [Mon, 10 Dec 2018 17:54:23 +0000 (17:54 +0000)]
Revert "mesa/main: remove ARB suffix from glGetnTexImage"

This reverts commit f1998e15ffccf260552bf559abe1a733a8ce990e.

This changes the ABI, such that glGetnTexImageARB entry-point from the
GLAPI gets removed. Thus accessing many functions by offset (as we do)
will result in getting the wrong one.

Follow-up work will swap the by-offset handling, but for now revert
this patch.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomapi: drop unneeded gl_dispatch_stub declarations
Erik Faye-Lund [Sun, 9 Dec 2018 21:20:30 +0000 (21:20 +0000)]
mapi: drop unneeded gl_dispatch_stub declarations

These declarations are not used anywhere - be that generated code or
otherwise.

[Emil: format the hunk from Erik into a patch]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
5 years agomesa: correctly use os.path.join in our python scripts
Emil Velikov [Sun, 9 Dec 2018 20:09:49 +0000 (20:09 +0000)]
mesa: correctly use os.path.join in our python scripts

With Windows in mind, using forward slash isn't the right thing to do.
Even if it just works, we might want to fix it.

As here, use __file__ instead of argv[0] and sys.path.insert over
sys.path.append. With the path tweak being reportedly faster.

Suggested-by: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agofreedreno: automake: ship ir3_nir_trig.py in the tarball
Emil Velikov [Fri, 21 Dec 2018 19:30:37 +0000 (19:30 +0000)]
freedreno: automake: ship ir3_nir_trig.py in the tarball

Fixes: aa0fed10d35 ("freedreno: move ir3 to common location")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoegl/glvnd: sync egl.xml from Khronos
Eric Engestrom [Thu, 24 Jan 2019 15:06:34 +0000 (15:06 +0000)]
egl/glvnd: sync egl.xml from Khronos

Fixes: 98984b7cdd79c15cc733 "egl: add glvnd entrypoints for EGL_MESA_query_driver"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
5 years agotravis: bump libdrm to 2.4.97
Eric Engestrom [Thu, 24 Jan 2019 14:49:30 +0000 (14:49 +0000)]
travis: bump libdrm to 2.4.97

Fixes: c02f761bdfc87d0a1bfd "winsys/amdgpu: use the new BO list API"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoegl: Implementation of egl dri2 drivers for MESA_query_driver
Veluri Mithun [Wed, 23 Jan 2019 17:15:42 +0000 (22:45 +0530)]
egl: Implementation of egl dri2 drivers for MESA_query_driver

Signed-off-by: Veluri Mithun <velurimithun38@gmail.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoegl: add glvnd entrypoints for EGL_MESA_query_driver
Eric Engestrom [Thu, 24 Jan 2019 10:27:24 +0000 (10:27 +0000)]
egl: add glvnd entrypoints for EGL_MESA_query_driver

Fixes: fbdd7bde29863935106c "egl: Implement EGL API for MESA_query_driver"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoegl: Implement EGL API for MESA_query_driver
Veluri Mithun [Wed, 23 Jan 2019 17:14:25 +0000 (22:44 +0530)]
egl: Implement EGL API for MESA_query_driver

Signed-off-by: Veluri Mithun <velurimithun38@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoegl: update headers from Khronos
Eric Engestrom [Thu, 24 Jan 2019 10:07:45 +0000 (10:07 +0000)]
egl: update headers from Khronos

Cheating a tiny bit as these headers aren't in the Khronos repo yet, but
I expect them to be within a couple days.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoegl: finalize EGL_MESA_query_driver
Eric Engestrom [Thu, 24 Jan 2019 10:06:27 +0000 (10:06 +0000)]
egl: finalize EGL_MESA_query_driver

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agointel/compiler: Reset default flag register in brw_find_live_channel()
Matt Turner [Tue, 22 Jan 2019 19:33:11 +0000 (11:33 -0800)]
intel/compiler: Reset default flag register in brw_find_live_channel()

emit_uniformize() emits SHADER_OPCODE_FIND_LIVE_CHANNEL with its
flag_subreg set, so that the IR knows which flag is accessed. However
the flag is only used on Gen7 in Align1 mode.

To avoid setting unnecessary bits in the instruction words, get the
information we need and reset the default flag register. This allows
round-tripping through the assembler/disassembler.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
5 years agogallium: Add forgotten docs for PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS.
Kenneth Graunke [Thu, 24 Jan 2019 01:16:22 +0000 (17:16 -0800)]
gallium: Add forgotten docs for PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS.

Thanks to Ilia for catching this.

5 years agoRevert "Implement EGL API for MESA_query_driver"
Mark Janes [Thu, 24 Jan 2019 00:28:55 +0000 (16:28 -0800)]
Revert "Implement EGL API for MESA_query_driver"

This reverts commit ff621a505594a3217f24fb785c51f43580f1bf78.

with default warnings configuration, this commit generates:

   ../src/egl/main/eglapi.c:2654:1: error: no previous prototype for
            ‘eglGetDisplayDriverConfig’ [-Werror=missing-prototypes]

5 years agoRevert "Implementation of egl dri2 drivers for MESA_query_driver"
Mark Janes [Thu, 24 Jan 2019 00:28:47 +0000 (16:28 -0800)]
Revert "Implementation of egl dri2 drivers for MESA_query_driver"

This reverts commit 2720f78ef231a5a19ea69731755ee4242acbc580.

5 years agoImplementation of egl dri2 drivers for MESA_query_driver
Veluri Mithun [Wed, 23 Jan 2019 17:15:42 +0000 (22:45 +0530)]
Implementation of egl dri2 drivers for MESA_query_driver

Signed-off-by: Veluri Mithun <velurimithun38@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoImplement EGL API for MESA_query_driver
Veluri Mithun [Wed, 23 Jan 2019 17:14:25 +0000 (22:44 +0530)]
Implement EGL API for MESA_query_driver

Signed-off-by: Veluri Mithun <velurimithun38@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoAdd extension doc for MESA_query_driver
Veluri Mithun [Sun, 13 Jan 2019 11:28:04 +0000 (16:58 +0530)]
Add extension doc for MESA_query_driver

Signed-off-by: Veluri Mithun <velurimithun38@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agonir: Length of boolean vtn_value now is 1
Sergii Romantsov [Tue, 15 Jan 2019 11:08:32 +0000 (13:08 +0200)]
nir: Length of boolean vtn_value now is 1

During conversion type-length was lost due to math.

v2 (Jason Ekstrand):
 - Use a size/offset of 4 bytes

Fixes: 44227453ec03 (nir: Switch to using 1-bit Booleans for almost everything)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109353
Signed-off-by: Sergii Romantsov <sergii.romantsov@globallogic.com>
Tested-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agost/mesa: fix PRIMITIVES_GENERATED query after the "pipeline stat single" changes
Marek Olšák [Fri, 18 Jan 2019 16:25:06 +0000 (11:25 -0500)]
st/mesa: fix PRIMITIVES_GENERATED query after the "pipeline stat single" changes

When this functionality was added, the PRIMITIVES_GENERATED query was
accidentally omitted. This causes issues for drivers that support
transform feedback."

Fixes: d644698b443 ("gallium: Add the ability to query a single
pipeline statistics counter")

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agost/mesa: purge framebuffers when unbinding a context
Marek Olšák [Mon, 21 Jan 2019 17:09:07 +0000 (12:09 -0500)]
st/mesa: purge framebuffers when unbinding a context

This fixes pipe_surface "leaks".

Cc: 18.3 <mesa-stable@lists.freedesktop.org>
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agodocs: add note about sending merge-requests from forks
Erik Faye-Lund [Wed, 23 Jan 2019 09:34:28 +0000 (10:34 +0100)]
docs: add note about sending merge-requests from forks

Sending MRs from the main Mesa repository increase clutter in the
repository, and decrease visibility of project-wide branches. So it's
better if MRs are sent from forks instead.

Let's add a note about this, in case its not obvious to everyone.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agofreedreno: set modifier when exporting buffer
Rob Clark [Wed, 23 Jan 2019 14:42:42 +0000 (09:42 -0500)]
freedreno: set modifier when exporting buffer

Fixes an assert we start hitting with kms/gbm:

  #0  0x0000007fbf3d6e3c in raise () from /lib64/libc.so.6
  #1  0x0000007fbf3c4a68 in abort () from /lib64/libc.so.6
  #2  0x0000007fbf3d04e8 in __assert_fail_base () from /lib64/libc.so.6
  #3  0x0000007fbf3d0550 in __assert_fail () from /lib64/libc.so.6
  #4  0x0000007fbf5a73c4 in gbm_dri_bo_create (gbm=0x5820f0, width=2160, height=1440, format=875713112, usage=0, modifiers=0x695e00, count=1) at ../src/gbm/backends/dri/gbm_dri.c:1150
  #5  0x0000007fbf5a49c4 in gbm_bo_create_with_modifiers (gbm=0x5820f0, width=2160, height=1440, format=875713112, modifiers=0x695e00, count=1) at ../src/gbm/main/gbm.c:491
  #6  0x0000007fbbac3d64 in get_back_bo (dri2_surf=0x6f4cc0) at ../src/egl/drivers/dri2/platform_drm.c:258
  #7  0x0000007fbbac4318 in dri2_drm_image_get_buffers (driDrawable=0x704490, format=4098, stamp=0x6fc730, loaderPrivate=0x6f4cc0, buffer_mask=1, buffers=0x7fffffe210) at ../src/egl/drivers/dri2/platform_drm.c:409
  #8  0x0000007fbf5a5318 in image_get_buffers (driDrawable=0x704490, format=4098, stamp=0x6fc730, loaderPrivate=0x70e150, buffer_mask=1, buffers=0x7fffffe210) at ../src/gbm/backends/dri/gbm_dri.c:135
  #9  0x0000007fbe4308c4 in dri_image_drawable_get_buffers (drawable=0x6fc730, images=0x7fffffe210, statts=0x6f2660, statts_count=1) at ../src/gallium/state_trackers/dri/dri2.c:339
  #10 0x0000007fbe430c44 in dri2_allocate_textures (ctx=0x614b30, drawable=0x6fc730, statts=0x6f2660, statts_count=1) at ../src/gallium/state_trackers/dri/dri2.c:466
  #11 0x0000007fbe435580 in dri_st_framebuffer_validate (stctx=0x714160, stfbi=0x6fc730, statts=0x6f2660, count=1, out=0x7fffffe3b8) at ../src/gallium/state_trackers/dri/dri_drawable.c:85
  #12 0x0000007fbe7b2c84 in st_framebuffer_validate (stfb=0x6f2190, st=0x714160) at ../src/mesa/state_tracker/st_manager.c:222
  #13 0x0000007fbe7b4884 in st_api_make_current (stapi=0x7fbf0430d8 <st_gl_api>, stctxi=0x714160, stdrawi=0x6fc730, streadi=0x6fc730) at ../src/mesa/state_tracker/st_manager.c:1074
  #14 0x0000007fbe434f44 in dri_make_current (cPriv=0x703c20, driDrawPriv=0x704490, driReadPriv=0x704490) at ../src/gallium/state_trackers/dri/dri_context.c:301
  #15 0x0000007fbe42c910 in driBindContext (pcp=0x703c20, pdp=0x704490, prp=0x704490) at ../src/mesa/drivers/dri/common/dri_util.c:579
  #16 0x0000007fbbabab40 in dri2_make_current (drv=0x69d170, disp=0x69c6e0, dsurf=0x6f4cc0, rsurf=0x6f4cc0, ctx=0x70cb40) at ../src/egl/drivers/dri2/egl_dri2.c:1456
  #17 0x0000007fbbaa8ef4 in eglMakeCurrent (dpy=0x69c6e0, draw=0x6f4cc0, read=0x6f4cc0, ctx=0x70cb40) at ../src/egl/main/eglapi.c:862
  #18 0x0000007fbf5736ac in InternalMakeCurrentVendor (dpy=dpy@entry=0x614fb0, draw=draw@entry=0x6f4cc0, read=read@entry=0x6f4cc0, context=context@entry=0x70cb40, apiState=apiState@entry=0x6fc940, vendor=0x6975f0) at libegl.c:861
  #19 0x0000007fbf573764 in InternalMakeCurrentDispatch (dpy=0x614fb0, draw=0x6f4cc0, read=0x6f4cc0, context=0x70cb40, vendor=0x6975f0) at libegl.c:630
  #20 0x0000000000403640 in init_egl (egl=0x5805a8 <gl>, gbm=0x580528 <gbm>, samples=0) at ../common.c:263
  #21 0x0000000000403c1c in init_cube_smooth (gbm=0x580528 <gbm>, samples=0) at ../cube-smooth.c:225
  #22 0x0000000000408618 in main (argc=1, argv=0x7fffffe8d8) at ../kmscube.c:145

Fixes: 1ce5d757d04 freedreno: core buffer modifier support
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agoradv: always pass the GFX9 fence data to si_cs_emit_cache_flush()
Samuel Pitoiset [Thu, 17 Jan 2019 08:33:39 +0000 (09:33 +0100)]
radv: always pass the GFX9 fence data to si_cs_emit_cache_flush()

Remove two useless checks.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: compute the GFX9 fence VA at allocation time
Samuel Pitoiset [Thu, 17 Jan 2019 08:33:38 +0000 (09:33 +0100)]
radv: compute the GFX9 fence VA at allocation time

Instead of doing every time we emit cache flushes.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: only allocate the GFX9 fence and EOP BOs for the gfx queue
Samuel Pitoiset [Thu, 17 Jan 2019 08:33:37 +0000 (09:33 +0100)]
radv: only allocate the GFX9 fence and EOP BOs for the gfx queue

It's invalid to emit a ZPASS_DONE event on the compute queue, and
the fence BO is unused on the compute queue (ie. we don't flush
CB or DB caches).
This saves some space in the upload BO.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: remove old_fence parameter from si_cs_emit_write_event_eop()
Samuel Pitoiset [Thu, 17 Jan 2019 08:33:36 +0000 (09:33 +0100)]
radv: remove old_fence parameter from si_cs_emit_write_event_eop()

This parameter is actually useless as the immediate value
can always be zero.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: improve gathering of load_push_constants with dynamic bindings
Samuel Pitoiset [Tue, 22 Jan 2019 18:30:20 +0000 (19:30 +0100)]
radv: improve gathering of load_push_constants with dynamic bindings

For example, if a pipeline has two stages VS and FS. And if only
the fragment stage needs dynamic bindings, we shouldn't allocate
an extra user SGPR for the vertex stage. Of course, if the vertex
stage loads constants, it needs an user SGPR.

This should reduce the number of SET_SH_REG packets that are emitted.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agogallium: Add PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS
Caio Marcelo de Oliveira Filho [Wed, 19 Sep 2018 17:16:27 +0000 (10:16 -0700)]
gallium: Add PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS

In the Intel backend, it makes the most sense to treat gl_TessLevelInner
and gl_TessLevelOuter as ordinary shader inputs.  For Radeon, it makes
more sense to treat them as system values which get special handling.

We already have a compiler option for this, but the Iris driver will
need a capability bit so we can set it appropriately.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
5 years agonv50,nvc0: mark textures dirty on fb update
Ilia Mirkin [Mon, 21 Jan 2019 03:19:26 +0000 (22:19 -0500)]
nv50,nvc0: mark textures dirty on fb update

We may have to flush the cache if there are any textures presently bound
that refer to the outgoing framebuffer. This is only checked at
validation time.

Fixes a number of dEQP-GLES3.functional.fbo.color.repeated_clear.sample.*
tests, which would bind a texture, then clear it while the binding was
in effect, and then render to a different texture. This seems legal
under the "no feedback loops" rule.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
5 years agoac/nir_to_llvm: fix interpolateAt* for structs
Timothy Arceri [Tue, 22 Jan 2019 05:11:03 +0000 (16:11 +1100)]
ac/nir_to_llvm: fix interpolateAt* for structs

This fixes the arb_gpu_shader5 interpolateAt* tests that contain
structs.

Acked-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac/nir_to_llvm: add bindless support for uniform handles
Timothy Arceri [Tue, 22 Jan 2019 01:29:34 +0000 (12:29 +1100)]
ac/nir_to_llvm: add bindless support for uniform handles

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoradeonsi/nir: add missing piece for bindless image support
Timothy Arceri [Tue, 22 Jan 2019 00:48:51 +0000 (11:48 +1100)]
radeonsi/nir: add missing piece for bindless image support

This fixes some piglit tests and is was TGSI does.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agofreedreno: core buffer modifier support
Rob Clark [Mon, 21 Jan 2019 15:50:13 +0000 (10:50 -0500)]
freedreno: core buffer modifier support

Split out of a patch from Fritz Koenig to decouple from a6xx UBWC
enablement, and added fd_resource_create_with_modifiers().

5 years agoloader: fix the no-modifiers case
Rob Clark [Tue, 22 Jan 2019 19:08:41 +0000 (14:08 -0500)]
loader: fix the no-modifiers case

Normally modifiers take precendence over use flags, as they are more
explicit.  But if the driver supports modifiers, but the xserver does
not, then we should fallback to the old mechanism of allocating a buffer
using 'use' flags.

Fixes: 069fdd5f9facbd72fb6a289696c7b74e3237e70f
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
5 years agofreedreno: add query for dmabuf modifiers
Fritz Koenig [Fri, 2 Nov 2018 00:08:39 +0000 (17:08 -0700)]
freedreno: add query for dmabuf modifiers

5 years agofreedreno: drm_fourcc.h header include
Fritz Koenig [Thu, 6 Dec 2018 01:26:17 +0000 (17:26 -0800)]
freedreno: drm_fourcc.h header include

Add Qualcomm modifier for UBWC

5 years agosvga: add new gallium formats to the format conversion table
Brian Paul [Tue, 22 Jan 2019 19:29:24 +0000 (12:29 -0700)]
svga: add new gallium formats to the format conversion table

Fixes a static assertion which broke the build.

Fixes: 3ee240890 "gallium: add SINT formats to have exact counterparts to SNORM formats"
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Neha Bhende<bhenden@vmware.com>
5 years agoradeonsi: rename rfence -> sfence
Marek Olšák [Sat, 19 Jan 2019 00:35:04 +0000 (19:35 -0500)]
radeonsi: rename rfence -> sfence

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradeonsi: rename rbo, rbuffer to buf or buffer
Marek Olšák [Sat, 19 Jan 2019 00:30:17 +0000 (19:30 -0500)]
radeonsi: rename rbo, rbuffer to buf or buffer

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradeonsi: rename rsrc -> ssrc, rdst -> sdst
Marek Olšák [Sat, 19 Jan 2019 00:22:06 +0000 (19:22 -0500)]
radeonsi: rename rsrc -> ssrc, rdst -> sdst

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradeonsi: rename rquery -> squery
Marek Olšák [Sat, 19 Jan 2019 00:15:44 +0000 (19:15 -0500)]
radeonsi: rename rquery -> squery

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradeonsi: rename r600_resource -> si_resource
Marek Olšák [Sat, 19 Jan 2019 00:13:36 +0000 (19:13 -0500)]
radeonsi: rename r600_resource -> si_resource

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agovulkan: make generated enum to strings helpers available from c++
Lionel Landwerlin [Tue, 22 Jan 2019 17:36:56 +0000 (17:36 +0000)]
vulkan: make generated enum to strings helpers available from c++

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agoradeonsi: remove r600 from comments
Marek Olšák [Sat, 19 Jan 2019 00:39:45 +0000 (19:39 -0500)]
radeonsi: remove r600 from comments

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agowinsys/amdgpu: rename rfence, rsrc, rdst -> afence, asrc, adst
Marek Olšák [Sat, 19 Jan 2019 00:36:49 +0000 (19:36 -0500)]
winsys/amdgpu: rename rfence, rsrc, rdst -> afence, asrc, adst

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradeonsi: rename rview -> sview
Marek Olšák [Sat, 19 Jan 2019 00:35:33 +0000 (19:35 -0500)]
radeonsi: rename rview -> sview

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradeonsi: rename rscreen -> sscreen
Marek Olšák [Sat, 19 Jan 2019 00:19:23 +0000 (19:19 -0500)]
radeonsi: rename rscreen -> sscreen

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradeonsi: disable render cond & pipeline stats for internal compute dispatches
Marek Olšák [Wed, 16 Jan 2019 23:57:07 +0000 (18:57 -0500)]
radeonsi: disable render cond & pipeline stats for internal compute dispatches

5 years agoradeonsi: use compute for resource_copy_region when possible
Sonny Jiang [Mon, 3 Dec 2018 17:36:33 +0000 (12:36 -0500)]
radeonsi: use compute for resource_copy_region when possible

v2: marek: fix snorm8 blits

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
5 years agoradeonsi: add compute_last_block to configure the partial block fields
Jiang, Sonny [Tue, 8 Jan 2019 19:47:07 +0000 (19:47 +0000)]
radeonsi: add compute_last_block to configure the partial block fields

5 years agogallium/util: add util_format_snorm8_to_sint8 (from radeonsi)
Marek Olšák [Tue, 15 Jan 2019 17:33:53 +0000 (12:33 -0500)]
gallium/util: add util_format_snorm8_to_sint8 (from radeonsi)

5 years agogallium: add SINT formats to have exact counterparts to SNORM formats
Marek Olšák [Tue, 15 Jan 2019 17:32:27 +0000 (12:32 -0500)]
gallium: add SINT formats to have exact counterparts to SNORM formats

for radeonsi

5 years agoradeonsi: move PKT3_WRITE_DATA generation into a helper function
Marek Olšák [Thu, 17 Jan 2019 20:07:03 +0000 (15:07 -0500)]
radeonsi: move PKT3_WRITE_DATA generation into a helper function

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradeonsi: don't use WRITE_DATA.DST_SEL == MEM_GRBM on >= CIK
Marek Olšák [Thu, 17 Jan 2019 19:49:02 +0000 (14:49 -0500)]
radeonsi: don't use WRITE_DATA.DST_SEL == MEM_GRBM on >= CIK

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradeonsi: fix the top-of-pipe fence on SI
Marek Olšák [Thu, 17 Jan 2019 19:45:10 +0000 (14:45 -0500)]
radeonsi: fix the top-of-pipe fence on SI

SI doesn't have MEM.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradeonsi: correct WRITE_DATA.DST_SEL definitions
Marek Olšák [Thu, 17 Jan 2019 19:27:18 +0000 (14:27 -0500)]
radeonsi: correct WRITE_DATA.DST_SEL definitions

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradeonsi: compile clear and copy buffer compute shaders on demand
Marek Olšák [Fri, 11 Jan 2019 23:06:59 +0000 (18:06 -0500)]
radeonsi: compile clear and copy buffer compute shaders on demand

same as all other shaders

5 years agoradeonsi: remove redundant call to emit_cache_flush in compute clear/copy
Marek Olšák [Fri, 11 Jan 2019 21:57:06 +0000 (16:57 -0500)]
radeonsi: remove redundant call to emit_cache_flush in compute clear/copy

launch_grid calls it.

5 years agoradeonsi: use buffer_store_format_x & xy
Marek Olšák [Thu, 10 Jan 2019 21:17:00 +0000 (16:17 -0500)]
radeonsi: use buffer_store_format_x & xy

5 years agoradeonsi: fix rendering to tiny viewports where the viewport center is > 8K
Marek Olšák [Thu, 10 Jan 2019 19:32:42 +0000 (14:32 -0500)]
radeonsi: fix rendering to tiny viewports where the viewport center is > 8K

This fixes an assertion failure with GL CTS when cts-runner is used.
(not a specific test)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108877
Cc: 18.3 <mesa-stable@lists.freedesktop.org>
5 years agoradeonsi: fix a u_blitter crash after a shader with FBFETCH
Marek Olšák [Fri, 11 Jan 2019 20:11:30 +0000 (15:11 -0500)]
radeonsi: fix a u_blitter crash after a shader with FBFETCH

This fixes an assertion failure with GL CTS when cts-runner is used.
(not a specific test)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108877
Cc: 18.3 <mesa-stable@lists.freedesktop.org>
5 years agowinsys/amdgpu: use the new BO list API
Marek Olšák [Mon, 7 Jan 2019 19:32:33 +0000 (14:32 -0500)]
winsys/amdgpu: use the new BO list API

5 years agoanv: Implement transform feedback queries
Jason Ekstrand [Fri, 14 Sep 2018 20:10:28 +0000 (15:10 -0500)]
anv: Implement transform feedback queries

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agogenxml: Add SO_PRIM_STORAGE_NEEDED and SO_NUM_PRIMS_WRITTEN
Jason Ekstrand [Fri, 14 Sep 2018 19:45:12 +0000 (14:45 -0500)]
genxml: Add SO_PRIM_STORAGE_NEEDED and SO_NUM_PRIMS_WRITTEN

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Implement CmdBegin/EndQueryIndexed
Jason Ekstrand [Fri, 14 Sep 2018 19:27:43 +0000 (14:27 -0500)]
anv: Implement CmdBegin/EndQueryIndexed

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Implement vkCmdDrawIndirectByteCountEXT
Jason Ekstrand [Fri, 14 Sep 2018 17:25:10 +0000 (12:25 -0500)]
anv: Implement vkCmdDrawIndirectByteCountEXT

Annoyingly, this requires that we implement integer division on the
command streamer.  Fortunately, we're only ever dividing by constants so
we can use the mulh+add+shift trick and it's not as bad as it sounds.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Implement the basic form of VK_EXT_transform_feedback
Jason Ekstrand [Mon, 10 Sep 2018 21:17:37 +0000 (16:17 -0500)]
anv: Implement the basic form of VK_EXT_transform_feedback

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Add pipeline cache support for xfb_info
Jason Ekstrand [Wed, 12 Sep 2018 21:40:52 +0000 (16:40 -0500)]
anv: Add pipeline cache support for xfb_info

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Add but do not enable VK_EXT_transform_feedback
Jason Ekstrand [Mon, 10 Sep 2018 20:46:02 +0000 (15:46 -0500)]
anv: Add but do not enable VK_EXT_transform_feedback

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agonir/xfb: distinguish array of structs vs array of blocks
Alejandro Piñeiro [Thu, 10 Jan 2019 18:45:12 +0000 (19:45 +0100)]
nir/xfb: distinguish array of structs vs array of blocks

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir/xfb: Properly handle arrays of blocks
Jason Ekstrand [Wed, 9 Jan 2019 00:22:16 +0000 (18:22 -0600)]
nir/xfb: Properly handle arrays of blocks

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
5 years agonir/xfb: don't assert when xfb_buffer/stride is present but not xfb_offset
Alejandro Piñeiro [Mon, 22 Oct 2018 16:30:39 +0000 (18:30 +0200)]
nir/xfb: don't assert when xfb_buffer/stride is present but not xfb_offset

In order to allow nir_gather_xfb_info to be used on OpenGL,
specifically ARB_gl_spirv.

So, from OpenGL 4.6 spec, section 11.1.2.1, "Output Variables":

    "outputs specifying both an *XfbBuffer* and an *Offset* are
     captured, while outputs not specifying both of these are not
     captured. Values are captured each time the shader writes to such
     a decorated object."

This implies that are captured if both are present, and not if one of
those are lacking. Technically, it doesn't explicitly point that
having just one or the other is a mistake. In some cases, glslang is
adding some extra XfbBuffer without XfbOffset around, and mentioning
that technically that is not a bug (see issue#1526)

And for the case of Vulkan, as the same glslang issue mentions, it is
not clear if that should be a mistake or not. But even if it is a
mistake, it is not really needed to be checked on the driver, and we
can let the validation layers to check that.

v2: simplify explicit_xfb_buffer and explicit_offset checks (Jason).

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir/xfb: Fix offset accounting for dvec3/4
Jason Ekstrand [Thu, 6 Dec 2018 22:49:27 +0000 (16:49 -0600)]
nir/xfb: Fix offset accounting for dvec3/4

Before, we were double-counting the component slots when we had a dvec3
or dvec4.  Instead, just add them in once and manually offset the
recorded output offset.

Fixes: 19064b8c "nir: Add a pass for gathering transform feedback info"
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
5 years agonir: Preserve offsets in lower_io_to_scalar_early
Jason Ekstrand [Fri, 14 Sep 2018 20:54:19 +0000 (15:54 -0500)]
nir: Preserve offsets in lower_io_to_scalar_early

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
5 years agonir: fix lowering arrays to elements for XFB outputs
Samuel Pitoiset [Mon, 10 Sep 2018 19:59:31 +0000 (21:59 +0200)]
nir: fix lowering arrays to elements for XFB outputs

If we have a transform feedback output like:

float[2] x2_out (VARYING_SLOT_VAR1.x, 0, 0)

which is lowered by nir_lower_io_arrays_to_elements to,

float x2_out (VARYING_SLOT_VAR1.x, 0, 0)
float x2_out@5 (VARYING_SLOT_VAR2.x, 0, 0)

We have to update the destination offset to avoid overwriting
the same value.

v2 (Jason Ekstrand):
 - Compute the correct offsets for arrays of vectors and/or doubles

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
5 years agonir: do not remove varyings used for transform feedback
Samuel Pitoiset [Fri, 11 May 2018 08:29:17 +0000 (10:29 +0200)]
nir: do not remove varyings used for transform feedback

When a xfb buffer is explicitely declared on a varying
variable, we shouldn't remove it at link time.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>