Compare commits

...

55 Commits

Author SHA1 Message Date
Emil Velikov
91b2b925d1 Update version to 13.0.0-rc3
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-31 11:53:03 +00:00
Samuel Iglesias Gonsálvez
7a977612fc glsl: update default precision qualifier when it is set in the shader
Default precision qualifier for a data type could be set several times
inside a shader. This patch allows to update the default precision
qualifier for the given type that is saved in the symbol table.

If it is not in the symbol table, just add it.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97804
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
(cherry picked from commit 0e742926c6)
2016-10-27 19:47:20 +01:00
Samuel Iglesias Gonsálvez
95b5a69093 mesa/program: Add _mesa_symbol_table_replace_symbol()
This function allows to modify an existing symbol.

v2:
- Remove namespace usage now that it was deleted.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
(cherry picked from commit dfbdb2c0b3)
Nominated-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2016-10-27 19:12:06 +01:00
Timothy Arceri
ea37a06037 glsl/mesa: remove unused namespace support from the symbol table
Namespace support seems to have been unused for a very long time.

Previously the hash table entry was never removed and the symbol name
wasn't freed until the symbol table was destroyed.

In theory this could reduced the number of times we need to copy a string
as duplicate names are reused. However in practice there is likely only a
limited number of symbols that are the same and this is likely to cause
other less than optimal behaviour such as the hash_table continuously
growing.

Along with dropping namespace support this change removes entries from
the hash table as they become unused.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
(cherry picked from commit 6dbe8a1b9f)
Nominated-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2016-10-27 19:11:47 +01:00
Kenneth Graunke
02d5e60ee0 glsl: Size TCS->TES unsized arrays to gl_MaxPatchVertices for queries.
SSO validation and other program interface queries want to see that
unsized (non-patch) TCS output/TES input arrays are implicitly sized
to gl_MaxPatchVertices.

By the time we create the program resource lists, we've sized the arrays
to their actual size.  (We try to create TCS output arrays to match the
output patch size right away, and at this point, we should have shrunk
TES input arrays.)  One option would be to keep them sized to
gl_MaxPatchVertices, and defer shrinking them.  But that's a big change,
and I don't think it's a good idea.

Instead, this patch introduces a new ir_variable flag which indicates
the variable is implicitly to gl_MaxPatchVertices.  Then, the linker
munges the types when creating the resource list, ignoring the size
in the IR's types.  Basically, lie about it for resource queries.
It's ugly, but I think it ought to work.

We probably could use var->data.implicit_sized_array for this, but
I opted for a separate bit to try and avoid convoluting the existing
SSBO handling.  They're similar in concept, but share none of the
same code...

Fixes:
ES31-CTS.core.tessellation_shader.single.xfb_captures_data_from_correct_stage
and the ES32-CTS and ESEXT-CTS variants.

v2: Add a comment (requested by Timothy, written by me).

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
(cherry picked from commit 173558445d)
2016-10-27 11:33:14 +01:00
Kenneth Graunke
649a47a834 glsl: Pass ctx to program interface query helper functions.
The next commit will use this in add_shader_variable - this just
separates out some of the mechanical changes for easier review.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
(cherry picked from commit 34fd2ffed8)
2016-10-27 11:31:59 +01:00
Tapani Pälli
d640b0d71b egl: set preserved behavior for surface only if config supports it
Otherwise we can end up with mismatching behavior between config and
surface when client queries surface attributes. As example, configs
for DRI3 do not support preserved behavior but here we were setting
preserved behavior for pixmap and pbuffer.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98326
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Tested-by: Mark Janes <mark.a.janes@intel.com>
(cherry picked from commit 2035930966)
2016-10-27 11:30:54 +01:00
Dave Airlie
d35c4d1512 radv/ac/llvm: trim texture return values
The intrinsic engine asserts in llvm due to this,
as we put a vec4 into a vec1, and the next instruction
isn't expecting it.

So trim the vector at the end before inserting it.

Reported-by: Christoph Haag <haagch+mesadev@frickel.club>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit d548fa882b)
2016-10-27 11:29:49 +01:00
Samuel Pitoiset
5c00425354 nvc0/ir: fix emission of SHLADD with NEG modifiers
This affects GF100:GK110 chipsets, but not GM107+ where the
logic is a bit different. The emitters tried to emit sub
instead of subr when src0 has a NEG modifier.

This fixes the following piglit tests glsl-fs-loop-nested
and glsl-vs-loop-nested.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 1ec7227d44)
2016-10-27 11:28:30 +01:00
Eric Engestrom
6458a9dc6c egl/dri2: swap_buffers_with_damage falls back to swap_buffers
Since commit 0a606a400f ("egl: add eglSwapBuffersWithDamageKHR"),
Android has been broken because the function eglSwapBuffersWithDamageKHR
is provided regardless of the extension being present. Also, the Android
meta-EGL always advertises the extension regardless of the underlying
EGL implementation. As there doesn't seem to be a simple way
conditionally make the EGL function ptr NULL, just implement a brain
dead version of eglSwapBuffersWithDamage{KHR,EXT}.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
CC: Rob Clark <robdclark@gmail.com>
Suggested-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Rob Herring <robh@kernel.org>
[Emil Velikov: copy the original commit message from Rob's patch]
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

(cherry picked from commit 4fa799ae04)
2016-10-27 11:27:23 +01:00
Marek Olšák
b1d02e7006 st/mesa: allow multiple concurrent waiters in ClientWaitSync
so->fence can be unreferenced by one thread while another thread is
somewhere in ClientWaitSync and expecting so->fence to be non-NULL.

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

Cc: 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit b687f766fd)
2016-10-27 11:26:18 +01:00
Marek Olšák
c29a37c444 st/mesa: unduplicate st_check_sync code
It's the same as st_client_wait_sync. Discovered by Michel.
This is needed to make the following fix simpler.

Cc: 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit f240ad98bc)
2016-10-27 11:25:14 +01:00
Marek Olšák
9c5bbfcbc8 winsys/amdgpu: fix radeon_surf::macro_tile_index for imported textures
Maybe this is why SDMA has been broken for many amdgpu users?

SDMA is the only block which is used with imported textures and relies
on this variable. DB also uses it, but it doesn't get imported textures,
so it's unaffected.

I do get SDMA failures on Tonga before this patch if R600_DEBUG=testdma
is changed to use imported textures.

Cc: 11.2 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 6ec3b2a4b1)
2016-10-27 11:24:02 +01:00
Marek Olšák
cf82ceb21e gallium/radeon: make sure the address of separate CMASK is aligned properly
This should fix random GPU hangs on Hawaii and Fiji.

Cc: 11.2 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit dce05b3423)
2016-10-27 11:22:44 +01:00
Marek Olšák
b214af38b9 gallium/radeon: fix incorrect bpe use in si_set_optimal_micro_tile_mode
Oh my god, I wonder what catastrophic issues this was causing on SI.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 8a21f52d73)
2016-10-27 11:21:24 +01:00
Fredrik Höglund
fbfc01e654 vulkan/wsi/wayland: fix ARGB window support
Use an ARGB format for the DRM buffer when the compositeAlpha field
in VkSwapchainCreateInfoKHR is set to
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 68db0fe034)
2016-10-27 11:20:16 +01:00
Fredrik Höglund
100851b1f5 vulkan/wsi/x11: fix ARGB window support
Pass the correct depth to xcb_dri3_pixmap_from_buffer_checked().
Otherwise xcb_present_pixmap() fails with a BadMatch error.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 972670c200)
2016-10-27 11:19:09 +01:00
Fredrik Höglund
8ec30b87c0 radv: mark the fence as submitted and signalled in vkAcquireNextImageKHR
This stops the debug layers from complaining when fences are used to
throttle image acquisition.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 0a153f4ee4)
2016-10-27 11:17:55 +01:00
Matt Turner
cc5995d9e6 radv: Replace "abi_versions" with correct "api_version".
git history shows "abi_versions" was used from the outset.

Cc: <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98415
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 14aac061e9)
2016-10-27 11:16:51 +01:00
Matt Turner
42de0666ec anv: Replace "abi_versions" with correct "api_version".
git history shows "abi_versions" was used from the outset.

Cc: <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98415
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 07755237d3)
2016-10-27 11:15:44 +01:00
Samuel Pitoiset
4083feb939 nvc0: use correct bufctx when invalidating CP textures
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 7b2712c367)
2016-10-27 11:14:28 +01:00
Tapani Pälli
92a50b3d6e mesa: fix error handling in DrawBuffers
Patch rearranges error checking so that enum checking provided via
destmask happens before other checks. It needs to be done in this
order because other error checks do not work properly if there were
invalid enums passed.

Patch also refines one existing check and it's documentation to match
GLES 3.0 spec (also in later specs). This was somewhat mysteriously
referring to desktop GL but had a check for gles3.

Fixes following dEQP tests:

   dEQP-GLES31.functional.debug.negative_coverage.get_error.buffer.draw_buffers

no CI regressions observed.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98134
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit a1652a059e)
2016-10-27 11:13:24 +01:00
Tapani Pälli
732b39507b egl: add check that eglCreateContext gets a valid config
Fixes following dEQP test:

   dEQP-EGL.functional.negative_api.create_context

v2: don't break EGL_KHR_no_config_context (Eric Engestrom)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 5876f3c85a)
2016-10-27 11:12:19 +01:00
Tapani Pälli
8962e9a239 Revert "egl/android: Set EGL_MAX_PBUFFER_WIDTH and EGL_MAX_PBUFFER_HEIGHT"
This reverts commit b1d636aa00, previous
commit sets these values for all egl configs.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
Suggested-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 1ef7873397)
2016-10-27 11:11:13 +01:00
Tapani Pälli
29f70e8e09 egl/dri2: set max values for pbuffer width and height
While these max values were previously fixed for pbuffer creation, this
change makes also eglGetConfigAttrib() return correct values.

Fixes following dEQP tests:

   dEQP-EGL.functional.create_surface.pbuffer.rgb888_no_depth_no_stencil
   dEQP-EGL.functional.create_surface.pbuffer.rgb888_depth_stencil
   dEQP-EGL.functional.create_surface.pbuffer.rgba8888_no_depth_no_stencil
   dEQP-EGL.functional.create_surface.pbuffer.rgba8888_depth_stencil

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98326
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit b91e1e38e8)
2016-10-27 11:10:08 +01:00
Kenneth Graunke
04bd51d7d0 i965: Drop nir_inputs from fs_visitor.
It's unused.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
(cherry picked from commit 41034abfe6)
2016-10-27 11:08:41 +01:00
Kenneth Graunke
f17450ff7e i965: Don't use nir_assign_var_locations for VS/TES/GS outputs.
Fixes spec/arb_enhanced_layouts/execution/component-layout/vs-fs-array-dvec3.

v2: Remove nir_outputs field from fs_visitor (caught by Tim and Iago).

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
(cherry picked from commit 59864e8e02)
2016-10-27 11:07:08 +01:00
Kenneth Graunke
de826a10a7 i965: Make split_virtual_grfs() call compact_virtual_grfs().
Post-splitting, VGRFs have a maximum size (MAX_VGRF_SIZE).  This is
required by the register allocator, as we have to create classes for
each size of VGRF.

We can (and do) allocate virtual registers larger than MAX_VGRF_SIZE,
but we must ensure that they are splittable.  split_virtual_grfs()
asserts that the post-splitting register size is in range.

Unfortunately, these trip for completely dead registers which are too
large - we only set split points for live registers.  So dead ones are
never split, and if they happened to be too large, they'd trip asserts.

To fix this, call compact_virtual_grfs() to eliminate dead registers
before splitting.

v2: Add a comment written by Iago.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
(cherry picked from commit 27715c73ff)
2016-10-27 11:06:02 +01:00
Kenneth Graunke
188a866fd0 i965: Drop unnecessary switch statement in nir_setup_outputs()
TCS and FS are skipped above.  CS has no output variables.
All remaining cases take the same path.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
(cherry picked from commit 3728ee000a)
2016-10-27 11:04:57 +01:00
Axel Davy
a850e69b7e st/nine: Fix locking CubeTexture surfaces.
Only one face of Cubetextures was locked when in DEFAULT Pool.
Fixes:
https://github.com/iXit/Mesa-3D/issues/129

CC: "12.0 13.0" <mesa-stable@lists.freedesktop.org>

Signed-off-by: Axel Davy <axel.davy@ens.fr>
(cherry picked from commit eed605a473)
2016-10-27 11:03:50 +01:00
Axel Davy
d576a2b0e6 st/nine: Fix mistake in Volume9 UnlockBox
In the format fallback path,
the height was used instead of the depth.

CC: "12.0 13.0" <mesa-stable@lists.freedesktop.org>

Signed-off-by: Axel Davy <axel.davy@ens.fr>
(cherry picked from commit fe7bb46134)
2016-10-27 11:02:45 +01:00
Axel Davy
32caa7438a st/nine: Fix leak with integer and boolean constants
Leak introduced by:
a83dce0128

The patch also moves the part to
release changed.vs_const_i and changed.vs_const_b
before the if (!cb.buffer_size) check,
to avoid reuploading every draw call if
integer or boolean constants are dirty, but the shaders
use no constants.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
CC: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 25beccb379)
2016-10-27 11:01:38 +01:00
Nicolai Hähnle
074ede8d4f st/mesa: cleanup and fix primitive restart for indirect draws
There are three intended functional changes here:

1. OpenGL 4.5 clarifies that primitive restart should only apply with index
   buffers, so make that change explicit in the indirect draw path.

2. Make PrimitiveRestartFixedIndex work with indirect draws.

3. The change where primitive_restart is only set when the restart index can
   actually have an effect (based on the size of indices) is also applied for
   indirect draws.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 3d6b5dee3a)
2016-10-27 10:41:13 +01:00
Emil Velikov
497cf4a9d1 cherry-ignore: add mapi VISILITY_CFLAGS patch
Cherry-picked without -x

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-27 10:36:07 +01:00
Emil Velikov
f623a8be3e Update version to 13.0.0-rc2
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-24 12:09:15 +01:00
Jonathan Gray
af81cdfec0 mapi: automake: set VISIBILITY_CFLAGS for shared glapi
shared glapi was previously built without setting CFLAGS for
AM_CFLAGS and VISIBILITY_CFLAGS.

This resulted in symbols being exported that shouldn't be.

The x86 and sparc assembly versions of the dispatch table partially
mitigated this by using .hidden.  Otherwise shared_dispatch_stub_*
were being exported.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Cc: "11.2 12.0 13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-10-24 11:32:13 +01:00
Emil Velikov
990f395e00 anv: automake: cleanup the generated json file during make clean
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 8df581520a)

Conflicts:
	src/intel/vulkan/Makefile.am
2016-10-24 11:31:53 +01:00
Stencel, Joanna
19e8270fe0 egl/wayland: add missing destroy_window callback
The original patch by Joanna added the function pointer and callback yet
things got only partially applied - the infra was added, but the
implementation was missing.

Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
Fixes: 690ead4a13 ("egl/wayland-egl: Fix for segfault in
dri2_wl_destroy_surface.")
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>

(cherry picked from commit 2e0ab61e29)
2016-10-24 09:55:02 +01:00
Emil Velikov
cac49ee2cd automake: don't forget to pick wglext.h in the tarball
Earlier commit reworked the header install rules, to ensure that the
correct ones are installed only as needed.

By doing so it dropped a wildcard which was effectively including the
wglext.h header in the tarball.

Add the header to the top-level noinst_HEADERS, since the it is not
meant to be installed (autoconf is not used on Windows plaforms).

Fixes: a89faa2022 ("autoconf: Make header install distinct for various
APIs (v2)")
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
Cc: Chuck Atkins <chuck.atkins@kitware.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>

(cherry picked from commit 3511a86111)
2016-10-24 09:55:02 +01:00
Dave Airlie
0f8b7f90d1 radv: allow cmask transitions without fast clear
This fixes
dEQP-VK.pipeline.multisample.sampled_image*

These all render to multisampled image, and then
sample from it, so we must transition it correctly,
since we have a cmask and fmask this will cause
the correct transition.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit a969548f59)
2016-10-24 09:55:02 +01:00
Jason Ekstrand
abf5327b86 anv: Suffix the intel_icd file with the host CPU
Vulkan has a multi-arch problem... The idea behind the Vulkan loader is
that you have a little json file on your disk that tells the loader where
to find drivers.  The loader looks for these json files in standard
locations, and then goes and loads the my_driver.so's that they specify.
This allows you as a driver implementer to put their driver wherever on the
disk they want so long as the ICD points in the right place.

For a multi-arch system, however, you may have multiple libvulkan_intel.so
files installed that the loader needs to pick depending on architecture.
Since the ICD file format does not specify any architecture information,
you can't tell the loader where to find the 32-bit version vs. the 64-bit
version.  The way that packagers have been dealing with this is to place
libvulkan_intel.so in the top level lib directory and provide just a name
(and no path) to the loader.  It will then use the regular system search
paths and find the correct driver.  While this solution works fine for
distro-installed Vulkan drivers, it doesn't work so well for user-installed
drivers because they may put it in /opt or $HOME/.local or some other more
exotic location.  In this case, you can't use an ICD json file with just a
library name because it doesn't know where to find it; you also have to add
that to your library lookup path via LD_LIBRARY_PATH or similar.

This patch handles both use-cases by taking advantage of the fact that the
loader dlopen()s each of the drivers and, if one dlopen() calls fails, it
silently continues on to open other drivers.  By suffixing the icd file, we
can provide two different json files: intel_icd.x86_64.json and
intel_icd.i686.json with different paths.  Since dlopen() will only succeed
on the libvulkan_intel.so of the right arch, the loader will happily ignore
the others and load that one.  This allows us to properly handle multi-arch
while still providing a full path so user installs will work fine.

I tested this on my Fedora 25 machine with 32 and 64-bit builds of our
Vulkan driver installed and 32 and 64-bit builds of crucible.  It seems to
work just fine.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit d96345de98)

Squashed with commit:

anv: Always use the full driver path in the intel_icd.*.json

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 7ea4ef8849)

Squashed with commit:

configure: Get rid of the --disable-vulkan-icd-full-driver-path flag

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 3f05fc62f9)
2016-10-24 09:54:28 +01:00
Francisco Jerez
d0d3e721d0 Revert "Revert "mapi: export all GLES 3.2 functions in libGLESv2.so""
This reverts commit 85e9bbc14d.  The
previous commit should help with the scons build failure caused by the
original commit.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
(cherry picked from commit 811eb7f178)
2016-10-24 09:10:01 +01:00
Francisco Jerez
293e458558 glapi: Move PrimitiveBoundingBox and BlendBarrier definitions into ES3.2 category.
These two GLES 3.2 entry points were being defined in the category of
the ARB_ES3_2_compatibility and KHR_blend_equation_advanced extensions
respectively instead of in the ES3.2 category.  Defining them in the
ES3.2 category makes sure that the gl_procs.py generator emits
declarations in the glprocs.h header file for the unsuffixed GLES-only
entry points that PrimitiveBoundingBoxARB and BlendBarrierKHR
respectively alias.  This should avoid a compilation failure during
scons builds in combination with "mapi: export all GLES 3.2 functions
in libGLESv2.so".

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
(cherry picked from commit 15a084a039)
2016-10-24 09:08:28 +01:00
Samuel Pitoiset
5798d602e0 nvc0: do not break 3D state by pushing MS coordinates on Fermi
Long story short, 3D and CP are aliased on Fermi and initializing
compute after pushing the MS sample coordinate offsets seems to
corrupt 3D state for weird reasons.

I still don't have the faintest clue what is going on, but
this seems to only affect Fermi generation. A possible fix
could be to use two different channels, one for 3D and one
for CP.

This fixes a bunch of regressions pinpointed by piglit.

Fixes: "nvc0: fix up image support for allowing multiple samples"
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
(cherry picked from commit 42273edf79)
2016-10-24 09:07:21 +01:00
Nicolai Hähnle
039d1e6f11 radeonsi: fix 64-bit loads from LDS
Fixes spec/arb_tessellation_shader/execution/dvec[23]-vs-tcs-tes, among
others.

Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 4a2dbfff05)
2016-10-24 09:06:16 +01:00
Nicolai Hähnle
ba6efd48c3 st/mesa: only set primitive_restart when the restart index is in range
Even when enabled, primitive restart has no effect when the restart index
is larger than the representable values in the index buffer.

Fixes GL45-CTS.gtf31.GL3Tests.primitive_restart.primitive_restart_upconvert
for radeonsi VI.

v2: add an explanatory comment

Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
(cherry picked from commit bfa50f88ce)
2016-10-24 09:05:18 +01:00
Nicolai Hähnle
13f685cf11 st/glsl_to_tgsi: sort input and output decls by TGSI index
Fixes a regression introduced by commit 777dcf81b.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98307
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: 13.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 3d9b57e493)
2016-10-24 09:04:17 +01:00
Nicolai Hähnle
8f807e914f st/glsl_to_tgsi: fix block copies of arrays of structs
Use a full writemask in this case. This is relevant e.g. when a function
has an inout argument which is an array of structs.

v2: use C-style comment (Timothy Arceri)

Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
Cc: 13.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit a1895685f8)
2016-10-24 09:03:16 +01:00
Nicolai Hähnle
3581e21d5b st/glsl_to_tgsi: fix block copies of arrays of doubles
Set the type of the left-hand side to the same as the right-hand side,
so that when the base type is double, the writemask of the MOV instruction
is properly fixed up.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: 13.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit ca592af880)
2016-10-24 09:02:14 +01:00
Ilia Mirkin
52df379d6b nv50/ir: process texture offset sources as regular sources
With ARB_gpu_shader5, texture offsets can be any source, including TEMPs
and IN's. Make sure to process them as regular sources so that we pick
up masks, etc.

This should fix some CTS tests that feed offsets directly to
textureGatherOffset, and we were not picking up the input use, thus not
advertising it in the shader header.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Dave Airlie <airlied@redhat.com>
Cc: 12.0 13.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit cd45d758ff)
2016-10-24 09:01:03 +01:00
Ilia Mirkin
05b89cf40e nv50,nvc0: avoid reading out of bounds when getting bogus so info
The state tracker tries to attach the info to the wrong shader. This is
easy enough to protect against.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: 12.0 13.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 313fba5ee1)
2016-10-24 08:59:57 +01:00
Eric Engestrom
4768b7353f wsi/wayland: fix error path
Fixes: 1720bbd353 ("anv/wsi: split image alloc/free out to separate fns.")
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 8bf7717e1f)
2016-10-24 08:58:59 +01:00
Dave Airlie
554a99ebde radv: use emit_icmp for samples_identical
On a debug llvm build we'd assert on the next compare
when the return from samples_identical was i1 instead
of i32.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit d842546ad1)
2016-10-24 08:51:57 +01:00
Emil Velikov
e45c4586c2 Update version to 13.0.0-rc1
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-19 19:12:42 +01:00
Emil Velikov
2ced8eb136 Revert Use absolute path in intel_icd.json and related patches.
This commit effectively reverts the following commits:

This reverts commit 0b6837a643.
This reverts commit 05f36435ef.
This reverts commit a2ae67aa47.

While the feature introduced is convinient for development it is not as
useful for distributions. Furthermore it even breaks things as one
wishes to have both 32 and 64 bit package installed on the same system.

Keep the functionality in development branch(es) and drop it from
distribution packages to avoid confusion and misuse.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-19 19:10:30 +01:00
58 changed files with 673 additions and 608 deletions

View File

@@ -62,6 +62,7 @@ noinst_HEADERS = \
include/c99_math.h \
include/c11 \
include/D3D9 \
include/GL/wglext.h \
include/HaikuGL \
include/no_extern_c.h \
include/pci_ids

View File

@@ -1 +1 @@
12.1.0-devel
13.0.0-rc3

2
bin/.cherry-ignore Normal file
View File

@@ -0,0 +1,2 @@
# Commit was picked with -x
907ace57986733add2aebfa9dd7c83c67efed70e mapi: automake: set VISIBILITY_CFLAGS for shared glapi

View File

@@ -1667,13 +1667,6 @@ AC_ARG_WITH([vulkan-icddir],
[VULKAN_ICD_INSTALL_DIR='${datarootdir}/vulkan/icd.d'])
AC_SUBST([VULKAN_ICD_INSTALL_DIR])
AC_ARG_ENABLE([vulkan-icd-full-driver-path],
[AS_HELP_STRING([--disable-vulkan-icd-full-driver-path],
[create Vulkan ICD files with just a .so name and no path])],
[vulkan_icd_driver_path="$enableval"],
[vulkan_icd_driver_path="yes"])
AM_CONDITIONAL(VULKAN_ICD_DRIVER_PATH, test "x$vulkan_icd_driver_path" = xyes)
if test -n "$with_vulkan_drivers"; then
VULKAN_DRIVERS=`IFS=', '; echo $with_vulkan_drivers`
for driver in $VULKAN_DRIVERS; do

View File

@@ -3412,7 +3412,7 @@ static void visit_tex(struct nir_to_llvm_context *ctx, nir_tex_instr *instr)
result = build_tex_intrinsic(ctx, instr, &txf_info);
result = LLVMBuildExtractElement(ctx->builder, result, ctx->i32zero, "");
result = LLVMBuildICmp(ctx->builder, LLVMIntEQ, result, ctx->i32zero, "");
result = emit_int_cmp(ctx, LLVMIntEQ, result, ctx->i32zero);
goto write_result;
}
@@ -3520,7 +3520,8 @@ static void visit_tex(struct nir_to_llvm_context *ctx, nir_tex_instr *instr)
LLVMValueRef z = LLVMBuildExtractElement(ctx->builder, result, two, "");
z = LLVMBuildSDiv(ctx->builder, z, six, "");
result = LLVMBuildInsertElement(ctx->builder, result, z, two, "");
}
} else if (instr->dest.ssa.num_components != 4)
result = trim_vector(ctx, result, instr->dest.ssa.num_components);
write_result:
if (result) {

View File

@@ -2,6 +2,6 @@
"file_format_version": "1.0.0",
"ICD": {
"library_path": "@build_libdir@/libvulkan_radeon.so",
"abi_versions": "1.0.3"
"api_version": "1.0.3"
}
}

View File

@@ -2,6 +2,6 @@
"file_format_version": "1.0.0",
"ICD": {
"library_path": "libvulkan_radeon.so",
"abi_versions": "1.0.3"
"api_version": "1.0.3"
}
}

View File

@@ -2163,9 +2163,6 @@ static void radv_handle_cmask_image_transition(struct radv_cmd_buffer *cmd_buffe
radv_initialise_cmask(cmd_buffer, image, 0xffffffffu);
} else if (radv_layout_has_cmask(image, src_layout) &&
!radv_layout_has_cmask(image, dst_layout)) {
if (!cmd_buffer->device->allow_fast_clears)
return;
radv_fast_clear_flush_image_inplace(cmd_buffer, image);
}
}

View File

@@ -44,12 +44,6 @@
#include "util/debug.h"
struct radv_dispatch_table dtable;
struct radv_fence {
struct radeon_winsys_fence *fence;
bool submitted;
bool signalled;
};
static VkResult
radv_physical_device_init(struct radv_physical_device *device,
struct radv_instance *instance,

View File

@@ -1206,6 +1206,13 @@ void radv_initialise_cmask(struct radv_cmd_buffer *cmd_buffer,
struct radv_image *image, uint32_t value);
void radv_initialize_dcc(struct radv_cmd_buffer *cmd_buffer,
struct radv_image *image, uint32_t value);
struct radv_fence {
struct radeon_winsys_fence *fence;
bool submitted;
bool signalled;
};
#define RADV_DEFINE_HANDLE_CASTS(__radv_type, __VkType) \
\
static inline struct __radv_type * \

View File

@@ -318,13 +318,21 @@ VkResult radv_AcquireNextImageKHR(
VkSwapchainKHR _swapchain,
uint64_t timeout,
VkSemaphore semaphore,
VkFence fence,
VkFence _fence,
uint32_t* pImageIndex)
{
RADV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
RADV_FROM_HANDLE(radv_fence, fence, _fence);
return swapchain->acquire_next_image(swapchain, timeout, semaphore,
pImageIndex);
VkResult result = swapchain->acquire_next_image(swapchain, timeout, semaphore,
pImageIndex);
if (fence && result == VK_SUCCESS) {
fence->submitted = true;
fence->signalled = true;
}
return result;
}
VkResult radv_QueuePresentKHR(

View File

@@ -4330,6 +4330,8 @@ handle_tess_ctrl_shader_output_decl(struct _mesa_glsl_parse_state *state,
if (var->data.patch)
return;
var->data.tess_varying_implicit_sized_array = var->type->is_unsized_array();
validate_layout_qualifier_vertex_count(state, loc, var, num_vertices,
&state->tcs_output_size,
"tessellation control shader output");
@@ -4366,6 +4368,7 @@ handle_tess_shader_input_decl(struct _mesa_glsl_parse_state *state,
if (var->type->is_unsized_array()) {
var->type = glsl_type::get_array_instance(var->type->fields.array,
state->Const.MaxPatchVertices);
var->data.tess_varying_implicit_sized_array = true;
} else if (var->type->length != state->Const.MaxPatchVertices) {
_mesa_glsl_error(&loc, state,
"per-vertex tessellation shader input arrays must be "

View File

@@ -126,7 +126,7 @@ void glsl_symbol_table::pop_scope()
bool glsl_symbol_table::name_declared_this_scope(const char *name)
{
return _mesa_symbol_table_symbol_scope(table, -1, name) == 0;
return _mesa_symbol_table_symbol_scope(table, name) == 0;
}
bool glsl_symbol_table::add_variable(ir_variable *v)
@@ -152,7 +152,7 @@ bool glsl_symbol_table::add_variable(ir_variable *v)
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
if (existing != NULL)
entry->f = existing->f;
int added = _mesa_symbol_table_add_symbol(table, -1, v->name, entry);
int added = _mesa_symbol_table_add_symbol(table, v->name, entry);
assert(added == 0);
(void)added;
return true;
@@ -162,13 +162,13 @@ bool glsl_symbol_table::add_variable(ir_variable *v)
/* 1.20+ rules: */
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
return _mesa_symbol_table_add_symbol(table, -1, v->name, entry) == 0;
return _mesa_symbol_table_add_symbol(table, v->name, entry) == 0;
}
bool glsl_symbol_table::add_type(const char *name, const glsl_type *t)
{
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(t);
return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
return _mesa_symbol_table_add_symbol(table, name, entry) == 0;
}
bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i,
@@ -180,7 +180,7 @@ bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i,
symbol_table_entry *entry =
new(mem_ctx) symbol_table_entry(i, mode);
bool add_interface_symbol_result =
_mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
_mesa_symbol_table_add_symbol(table, name, entry) == 0;
assert(add_interface_symbol_result);
return add_interface_symbol_result;
} else {
@@ -199,7 +199,7 @@ bool glsl_symbol_table::add_function(ir_function *f)
}
}
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0;
return _mesa_symbol_table_add_symbol(table, f->name, entry) == 0;
}
bool glsl_symbol_table::add_default_precision_qualifier(const char *type_name,
@@ -213,13 +213,16 @@ bool glsl_symbol_table::add_default_precision_qualifier(const char *type_name,
symbol_table_entry *entry =
new(mem_ctx) symbol_table_entry(default_specifier);
return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
if (!get_entry(name))
return _mesa_symbol_table_add_symbol(table, name, entry) == 0;
return _mesa_symbol_table_replace_symbol(table, name, entry) == 0;
}
void glsl_symbol_table::add_global_function(ir_function *f)
{
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
int added = _mesa_symbol_table_add_global_symbol(table, -1, f->name, entry);
int added = _mesa_symbol_table_add_global_symbol(table, f->name, entry);
assert(added == 0);
(void)added;
}
@@ -261,7 +264,7 @@ int glsl_symbol_table::get_default_precision_qualifier(const char *type_name)
symbol_table_entry *glsl_symbol_table::get_entry(const char *name)
{
return (symbol_table_entry *)
_mesa_symbol_table_find_symbol(table, -1, name);
_mesa_symbol_table_find_symbol(table, name);
}
void

View File

@@ -832,6 +832,12 @@ public:
unsigned implicit_sized_array:1;
/**
* Is this a non-patch TCS output / TES input array that was implicitly
* sized to gl_MaxPatchVertices?
*/
unsigned tess_varying_implicit_sized_array:1;
/**
* Whether this is a fragment shader output implicitly initialized with
* the previous contents of the specified render target at the

View File

@@ -130,14 +130,14 @@ ir_print_visitor::unique_name(ir_variable *var)
/* If there's no conflict, just use the original name */
const char* name = NULL;
if (_mesa_symbol_table_find_symbol(this->symbols, -1, var->name) == NULL) {
if (_mesa_symbol_table_find_symbol(this->symbols, var->name) == NULL) {
name = var->name;
} else {
static unsigned i = 1;
name = ralloc_asprintf(this->mem_ctx, "%s@%u", var->name, ++i);
}
_mesa_hash_table_insert(this->printable_names, var, (void *) name);
_mesa_symbol_table_add_symbol(this->symbols, -1, name, var);
_mesa_symbol_table_add_symbol(this->symbols, name, var);
return name;
}

View File

@@ -3574,6 +3574,7 @@ static gl_shader_variable *
create_shader_variable(struct gl_shader_program *shProg,
const ir_variable *in,
const char *name, const glsl_type *type,
const glsl_type *interface_type,
bool use_implicit_location, int location,
const glsl_type *outermost_struct_type)
{
@@ -3631,7 +3632,7 @@ create_shader_variable(struct gl_shader_program *shProg,
out->type = type;
out->outermost_struct_type = outermost_struct_type;
out->interface_type = in->get_interface_type();
out->interface_type = interface_type;
out->component = in->data.location_frac;
out->index = in->data.index;
out->patch = in->data.patch;
@@ -3643,8 +3644,21 @@ create_shader_variable(struct gl_shader_program *shProg,
return out;
}
static const glsl_type *
resize_to_max_patch_vertices(const struct gl_context *ctx,
const glsl_type *type)
{
if (!type)
return NULL;
return glsl_type::get_array_instance(type->fields.array,
ctx->Const.MaxPatchVertices);
}
static bool
add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
add_shader_variable(const struct gl_context *ctx,
struct gl_shader_program *shProg,
struct set *resource_set,
unsigned stage_mask,
GLenum programInterface, ir_variable *var,
const char *name, const glsl_type *type,
@@ -3673,7 +3687,7 @@ add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
for (unsigned i = 0; i < type->length; i++) {
const struct glsl_struct_field *field = &type->fields.structure[i];
char *field_name = ralloc_asprintf(shProg, "%s.%s", name, field->name);
if (!add_shader_variable(shProg, resource_set,
if (!add_shader_variable(ctx, shProg, resource_set,
stage_mask, programInterface,
var, field_name, field->type,
use_implicit_location, field_location,
@@ -3687,6 +3701,29 @@ add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
}
default: {
const glsl_type *interface_type = var->get_interface_type();
/* Unsized (non-patch) TCS output/TES input arrays are implicitly
* sized to gl_MaxPatchVertices. Internally, we shrink them to a
* smaller size.
*
* This can cause trouble with SSO programs. Since the TCS declares
* the number of output vertices, we can always shrink TCS output
* arrays. However, the TES might not be linked with a TCS, in
* which case it won't know the size of the patch. In other words,
* the TCS and TES may disagree on the (smaller) array sizes. This
* can result in the resource names differing across stages, causing
* SSO validation failures and other cascading issues.
*
* Expanding the array size to the full gl_MaxPatchVertices fixes
* these issues. It's also what program interface queries expect,
* as that is the official size of the array.
*/
if (var->data.tess_varying_implicit_sized_array) {
type = resize_to_max_patch_vertices(ctx, type);
interface_type = resize_to_max_patch_vertices(ctx, interface_type);
}
/* Issue #16 of the ARB_program_interface_query spec says:
*
* "* If a variable is a member of an interface block without an
@@ -3699,8 +3736,7 @@ add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
*/
const char *prefixed_name = (var->data.from_named_ifc_block &&
!is_gl_identifier(var->name))
? ralloc_asprintf(shProg, "%s.%s", var->get_interface_type()->name,
name)
? ralloc_asprintf(shProg, "%s.%s", interface_type->name, name)
: name;
/* The ARB_program_interface_query spec says:
@@ -3711,6 +3747,7 @@ add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
*/
gl_shader_variable *sha_v =
create_shader_variable(shProg, var, prefixed_name, type,
interface_type,
use_implicit_location, location,
outermost_struct_type);
if (!sha_v)
@@ -3723,7 +3760,8 @@ add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
}
static bool
add_interface_variables(struct gl_shader_program *shProg,
add_interface_variables(const struct gl_context *ctx,
struct gl_shader_program *shProg,
struct set *resource_set,
unsigned stage, GLenum programInterface)
{
@@ -3774,7 +3812,7 @@ add_interface_variables(struct gl_shader_program *shProg,
(stage == MESA_SHADER_VERTEX && var->data.mode == ir_var_shader_in) ||
(stage == MESA_SHADER_FRAGMENT && var->data.mode == ir_var_shader_out);
if (!add_shader_variable(shProg, resource_set,
if (!add_shader_variable(ctx, shProg, resource_set,
1 << stage, programInterface,
var, var->name, var->type, vs_input_or_fs_output,
var->data.location - loc_bias))
@@ -3784,7 +3822,9 @@ add_interface_variables(struct gl_shader_program *shProg,
}
static bool
add_packed_varyings(struct gl_shader_program *shProg, struct set *resource_set,
add_packed_varyings(const struct gl_context *ctx,
struct gl_shader_program *shProg,
struct set *resource_set,
int stage, GLenum type)
{
struct gl_linked_shader *sh = shProg->_LinkedShaders[stage];
@@ -3810,7 +3850,7 @@ add_packed_varyings(struct gl_shader_program *shProg, struct set *resource_set,
if (type == iface) {
const int stage_mask =
build_stageref(shProg, var->name, var->data.mode);
if (!add_shader_variable(shProg, resource_set,
if (!add_shader_variable(ctx, shProg, resource_set,
stage_mask,
iface, var, var->name, var->type, false,
var->data.location - VARYING_SLOT_VAR0))
@@ -3822,7 +3862,9 @@ add_packed_varyings(struct gl_shader_program *shProg, struct set *resource_set,
}
static bool
add_fragdata_arrays(struct gl_shader_program *shProg, struct set *resource_set)
add_fragdata_arrays(const struct gl_context *ctx,
struct gl_shader_program *shProg,
struct set *resource_set)
{
struct gl_linked_shader *sh = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT];
@@ -3834,7 +3876,7 @@ add_fragdata_arrays(struct gl_shader_program *shProg, struct set *resource_set)
if (var) {
assert(var->data.mode == ir_var_shader_out);
if (!add_shader_variable(shProg, resource_set,
if (!add_shader_variable(ctx, shProg, resource_set,
1 << MESA_SHADER_FRAGMENT,
GL_PROGRAM_OUTPUT, var, var->name, var->type,
true, var->data.location - FRAG_RESULT_DATA0))
@@ -4093,24 +4135,24 @@ build_program_resource_list(struct gl_context *ctx,
/* Program interface needs to expose varyings in case of SSO. */
if (shProg->SeparateShader) {
if (!add_packed_varyings(shProg, resource_set,
if (!add_packed_varyings(ctx, shProg, resource_set,
input_stage, GL_PROGRAM_INPUT))
return;
if (!add_packed_varyings(shProg, resource_set,
if (!add_packed_varyings(ctx, shProg, resource_set,
output_stage, GL_PROGRAM_OUTPUT))
return;
}
if (!add_fragdata_arrays(shProg, resource_set))
if (!add_fragdata_arrays(ctx, shProg, resource_set))
return;
/* Add inputs and outputs to the resource list. */
if (!add_interface_variables(shProg, resource_set,
if (!add_interface_variables(ctx, shProg, resource_set,
input_stage, GL_PROGRAM_INPUT))
return;
if (!add_interface_variables(shProg, resource_set,
if (!add_interface_variables(ctx, shProg, resource_set,
output_stage, GL_PROGRAM_OUTPUT))
return;

View File

@@ -193,6 +193,8 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions)
new_var->data.patch = iface_t->fields.structure[i].patch;
new_var->data.stream = var->data.stream;
new_var->data.how_declared = var->data.how_declared;
new_var->data.tess_varying_implicit_sized_array =
var->data.tess_varying_implicit_sized_array;
new_var->data.from_named_ifc_block = 1;
new_var->init_interface_type(var->type);

View File

@@ -241,6 +241,15 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
return NULL;
break;
case __DRI_ATTRIB_MAX_PBUFFER_WIDTH:
_eglSetConfigKey(&base, EGL_MAX_PBUFFER_WIDTH,
_EGL_MAX_PBUFFER_WIDTH);
break;
case __DRI_ATTRIB_MAX_PBUFFER_HEIGHT:
_eglSetConfigKey(&base, EGL_MAX_PBUFFER_HEIGHT,
_EGL_MAX_PBUFFER_HEIGHT);
break;
default:
key = dri2_to_egl_attribute_map[attrib];
if (key != 0)

View File

@@ -66,7 +66,8 @@ dri2_fallback_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLSurface *surf,
const EGLint *rects, EGLint n_rects)
{
return EGL_FALSE;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
return dri2_dpy->vtbl->swap_buffers(drv, dpy, surf);
}
static inline EGLBoolean

View File

@@ -766,8 +766,6 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
EGL_NATIVE_VISUAL_TYPE, 0,
EGL_FRAMEBUFFER_TARGET_ANDROID, EGL_TRUE,
EGL_RECORDABLE_ANDROID, EGL_TRUE,
EGL_MAX_PBUFFER_WIDTH, _EGL_MAX_PBUFFER_WIDTH,
EGL_MAX_PBUFFER_HEIGHT, _EGL_MAX_PBUFFER_HEIGHT,
EGL_NONE
};
unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };

View File

@@ -118,6 +118,13 @@ resize_callback(struct wl_egl_window *wl_win, void *data)
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable);
}
static void
destroy_window_callback(void *data)
{
struct dri2_egl_surface *dri2_surf = data;
dri2_surf->wl_win = NULL;
}
/**
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
*/
@@ -159,6 +166,7 @@ dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp,
dri2_surf->wl_win->private = dri2_surf;
dri2_surf->wl_win->resize_callback = resize_callback;
dri2_surf->wl_win->destroy_window_callback = destroy_window_callback;
dri2_surf->base.Width = -1;
dri2_surf->base.Height = -1;
@@ -254,8 +262,11 @@ dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
if (dri2_surf->throttle_callback)
wl_callback_destroy(dri2_surf->throttle_callback);
dri2_surf->wl_win->private = NULL;
dri2_surf->wl_win->resize_callback = NULL;
if (dri2_surf->wl_win) {
dri2_surf->wl_win->private = NULL;
dri2_surf->wl_win->resize_callback = NULL;
dri2_surf->wl_win->destroy_window_callback = NULL;
}
free(surf);

View File

@@ -734,7 +734,9 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
_EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
if (!config && !disp->Extensions.KHR_no_config_context)
if (config != EGL_NO_CONFIG_KHR)
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv);
else if (!disp->Extensions.KHR_no_config_context)
RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT);
if (!share && share_list != EGL_NO_CONTEXT)

View File

@@ -262,9 +262,13 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
{
const char *func;
EGLint renderBuffer = EGL_BACK_BUFFER;
EGLint swapBehavior = EGL_BUFFER_PRESERVED;
EGLint swapBehavior = EGL_BUFFER_DESTROYED;
EGLint err;
/* Swap behavior can be preserved only if config supports this. */
if (conf->SurfaceType & EGL_SWAP_BEHAVIOR_PRESERVED_BIT)
swapBehavior = EGL_BUFFER_PRESERVED;
switch (type) {
case EGL_WINDOW_BIT:
func = "eglCreateWindowSurface";

View File

@@ -760,7 +760,7 @@ CodeEmitterGK110::emitISAD(const Instruction *i)
void
CodeEmitterGK110::emitSHLADD(const Instruction *i)
{
uint8_t addOp = (i->src(2).mod.neg() << 1) | i->src(0).mod.neg();
uint8_t addOp = (i->src(0).mod.neg() << 1) | i->src(2).mod.neg();
const ImmediateValue *imm = i->src(1).get()->asImm();
assert(imm);

View File

@@ -762,7 +762,7 @@ CodeEmitterNVC0::emitIMAD(const Instruction *i)
void
CodeEmitterNVC0::emitSHLADD(const Instruction *i)
{
uint8_t addOp = (i->src(2).mod.neg() << 1) | i->src(0).mod.neg();
uint8_t addOp = (i->src(0).mod.neg() << 1) | i->src(2).mod.neg();
const ImmediateValue *imm = i->src(1).get()->asImm();
assert(imm);

View File

@@ -182,6 +182,7 @@ public:
// mask of used components of source s
unsigned int srcMask(unsigned int s) const;
unsigned int texOffsetMask() const;
SrcRegister getSrc(unsigned int s) const
{
@@ -234,6 +235,35 @@ private:
const struct tgsi_full_instruction *insn;
};
unsigned int Instruction::texOffsetMask() const
{
const struct tgsi_instruction_texture *tex = &insn->Texture;
assert(insn->Instruction.Texture);
switch (tex->Texture) {
case TGSI_TEXTURE_BUFFER:
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_SHADOW1D:
case TGSI_TEXTURE_1D_ARRAY:
case TGSI_TEXTURE_SHADOW1D_ARRAY:
return 0x1;
case TGSI_TEXTURE_2D:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_SHADOW2D_ARRAY:
case TGSI_TEXTURE_RECT:
case TGSI_TEXTURE_SHADOWRECT:
case TGSI_TEXTURE_2D_MSAA:
case TGSI_TEXTURE_2D_ARRAY_MSAA:
return 0x3;
case TGSI_TEXTURE_3D:
return 0x7;
default:
assert(!"Unexpected texture target");
return 0xf;
}
}
unsigned int Instruction::srcMask(unsigned int s) const
{
unsigned int mask = insn->Dst[0].Register.WriteMask;
@@ -955,6 +985,9 @@ private:
int inferSysValDirection(unsigned sn) const;
bool scanDeclaration(const struct tgsi_full_declaration *);
bool scanInstruction(const struct tgsi_full_instruction *);
void scanInstructionSrc(const Instruction& insn,
const Instruction::SrcRegister& src,
unsigned mask);
void scanProperty(const struct tgsi_full_property *);
void scanImmediate(const struct tgsi_full_immediate *);
@@ -1364,6 +1397,61 @@ inline bool Source::isEdgeFlagPassthrough(const Instruction& insn) const
insn.getSrc(0).getFile() == TGSI_FILE_INPUT;
}
void Source::scanInstructionSrc(const Instruction& insn,
const Instruction::SrcRegister& src,
unsigned mask)
{
if (src.getFile() == TGSI_FILE_TEMPORARY) {
if (src.isIndirect(0))
indirectTempArrays.insert(src.getArrayId());
} else
if (src.getFile() == TGSI_FILE_BUFFER ||
src.getFile() == TGSI_FILE_IMAGE ||
(src.getFile() == TGSI_FILE_MEMORY &&
memoryFiles[src.getIndex(0)].mem_type == TGSI_MEMORY_TYPE_GLOBAL)) {
info->io.globalAccess |= (insn.getOpcode() == TGSI_OPCODE_LOAD) ?
0x1 : 0x2;
} else
if (src.getFile() == TGSI_FILE_OUTPUT) {
if (src.isIndirect(0)) {
// We don't know which one is accessed, just mark everything for
// reading. This is an extremely unlikely occurrence.
for (unsigned i = 0; i < info->numOutputs; ++i)
info->out[i].oread = 1;
} else {
info->out[src.getIndex(0)].oread = 1;
}
}
if (src.getFile() != TGSI_FILE_INPUT)
return;
if (src.isIndirect(0)) {
for (unsigned i = 0; i < info->numInputs; ++i)
info->in[i].mask = 0xf;
} else {
const int i = src.getIndex(0);
for (unsigned c = 0; c < 4; ++c) {
if (!(mask & (1 << c)))
continue;
int k = src.getSwizzle(c);
if (k <= TGSI_SWIZZLE_W)
info->in[i].mask |= 1 << k;
}
switch (info->in[i].sn) {
case TGSI_SEMANTIC_PSIZE:
case TGSI_SEMANTIC_PRIMID:
case TGSI_SEMANTIC_FOG:
info->in[i].mask &= 0x1;
break;
case TGSI_SEMANTIC_PCOORD:
info->in[i].mask &= 0x3;
break;
default:
break;
}
}
}
bool Source::scanInstruction(const struct tgsi_full_instruction *inst)
{
Instruction insn(inst);
@@ -1396,66 +1484,19 @@ bool Source::scanInstruction(const struct tgsi_full_instruction *inst)
indirectTempArrays.insert(dst.getArrayId());
} else
if (dst.getFile() == TGSI_FILE_BUFFER ||
dst.getFile() == TGSI_FILE_IMAGE ||
dst.getFile() == TGSI_FILE_IMAGE ||
(dst.getFile() == TGSI_FILE_MEMORY &&
memoryFiles[dst.getIndex(0)].mem_type == TGSI_MEMORY_TYPE_GLOBAL)) {
info->io.globalAccess |= 0x2;
}
}
for (unsigned s = 0; s < insn.srcCount(); ++s) {
Instruction::SrcRegister src = insn.getSrc(s);
if (src.getFile() == TGSI_FILE_TEMPORARY) {
if (src.isIndirect(0))
indirectTempArrays.insert(src.getArrayId());
} else
if (src.getFile() == TGSI_FILE_BUFFER ||
src.getFile() == TGSI_FILE_IMAGE ||
(src.getFile() == TGSI_FILE_MEMORY &&
memoryFiles[src.getIndex(0)].mem_type == TGSI_MEMORY_TYPE_GLOBAL)) {
info->io.globalAccess |= (insn.getOpcode() == TGSI_OPCODE_LOAD) ?
0x1 : 0x2;
} else
if (src.getFile() == TGSI_FILE_OUTPUT) {
if (src.isIndirect(0)) {
// We don't know which one is accessed, just mark everything for
// reading. This is an extremely unlikely occurrence.
for (unsigned i = 0; i < info->numOutputs; ++i)
info->out[i].oread = 1;
} else {
info->out[src.getIndex(0)].oread = 1;
}
}
if (src.getFile() != TGSI_FILE_INPUT)
continue;
unsigned mask = insn.srcMask(s);
for (unsigned s = 0; s < insn.srcCount(); ++s)
scanInstructionSrc(insn, insn.getSrc(s), insn.srcMask(s));
for (unsigned s = 0; s < insn.getNumTexOffsets(); ++s)
scanInstructionSrc(insn, insn.getTexOffset(s), insn.texOffsetMask());
if (src.isIndirect(0)) {
for (unsigned i = 0; i < info->numInputs; ++i)
info->in[i].mask = 0xf;
} else {
const int i = src.getIndex(0);
for (unsigned c = 0; c < 4; ++c) {
if (!(mask & (1 << c)))
continue;
int k = src.getSwizzle(c);
if (k <= TGSI_SWIZZLE_W)
info->in[i].mask |= 1 << k;
}
switch (info->in[i].sn) {
case TGSI_SEMANTIC_PSIZE:
case TGSI_SEMANTIC_PRIMID:
case TGSI_SEMANTIC_FOG:
info->in[i].mask &= 0x1;
break;
case TGSI_SEMANTIC_PCOORD:
info->in[i].mask &= 0x3;
break;
default:
break;
}
}
}
return true;
}

View File

@@ -307,6 +307,9 @@ nv50_program_create_strmout_state(const struct nv50_ir_prog_info *info,
const unsigned r = pso->output[i].register_index;
b = pso->output[i].output_buffer;
if (r >= info->numOutputs)
continue;
for (c = 0; c < pso->output[i].num_components; ++c)
so->map[base[b] + p + c] = info->out[r].slot[s + c];
}

View File

@@ -509,11 +509,14 @@ nvc0_program_create_tfb_state(const struct nv50_ir_prog_info *info,
for (i = 0; i < pso->num_outputs; ++i) {
unsigned s = pso->output[i].start_component;
unsigned p = pso->output[i].dst_offset;
const unsigned r = pso->output[i].register_index;
b = pso->output[i].output_buffer;
if (r >= info->numOutputs)
continue;
for (c = 0; c < pso->output[i].num_components; ++c)
tfb->varying_index[b][p++] =
info->out[pso->output[i].register_index].slot[s + c];
tfb->varying_index[b][p++] = info->out[r].slot[s + c];
tfb->varying_count[b] = MAX2(tfb->varying_count[b], p);
tfb->stream[b] = pso->output[i].stream;

View File

@@ -1002,49 +1002,6 @@ nvc0_screen_create(struct nouveau_device *dev)
PUSH_REFN (push, screen->uniform_bo, NV_VRAM_DOMAIN(&screen->base) | NOUVEAU_BO_WR);
for (i = 0; i < 5; ++i) {
/* TIC and TSC entries for each unit (nve4+ only) */
/* auxiliary constants (6 user clip planes, base instance id) */
BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
PUSH_DATA (push, NVC0_CB_AUX_SIZE);
PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
BEGIN_NVC0(push, NVC0_3D(CB_BIND(i)), 1);
PUSH_DATA (push, (15 << 4) | 1);
if (screen->eng3d->oclass >= NVE4_3D_CLASS) {
unsigned j;
BEGIN_1IC0(push, NVC0_3D(CB_POS), 9);
PUSH_DATA (push, NVC0_CB_AUX_UNK_INFO);
for (j = 0; j < 8; ++j)
PUSH_DATA(push, j);
} else {
BEGIN_NVC0(push, NVC0_3D(TEX_LIMITS(i)), 1);
PUSH_DATA (push, 0x54);
}
/* MS sample coordinate offsets: these do not work with _ALT modes ! */
BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 2 * 8);
PUSH_DATA (push, NVC0_CB_AUX_MS_INFO);
PUSH_DATA (push, 0); /* 0 */
PUSH_DATA (push, 0);
PUSH_DATA (push, 1); /* 1 */
PUSH_DATA (push, 0);
PUSH_DATA (push, 0); /* 2 */
PUSH_DATA (push, 1);
PUSH_DATA (push, 1); /* 3 */
PUSH_DATA (push, 1);
PUSH_DATA (push, 2); /* 4 */
PUSH_DATA (push, 0);
PUSH_DATA (push, 3); /* 5 */
PUSH_DATA (push, 0);
PUSH_DATA (push, 2); /* 6 */
PUSH_DATA (push, 1);
PUSH_DATA (push, 3); /* 7 */
PUSH_DATA (push, 1);
}
BEGIN_NVC0(push, NVC0_3D(LINKED_TSC), 1);
PUSH_DATA (push, 0);
/* return { 0.0, 0.0, 0.0, 0.0 } for out-of-bounds vtxbuf access */
BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
PUSH_DATA (push, 256);
@@ -1214,6 +1171,50 @@ nvc0_screen_create(struct nouveau_device *dev)
if (nvc0_screen_init_compute(screen))
goto fail;
/* XXX: Compute and 3D are somehow aliased on Fermi. */
for (i = 0; i < 5; ++i) {
/* TIC and TSC entries for each unit (nve4+ only) */
/* auxiliary constants (6 user clip planes, base instance id) */
BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
PUSH_DATA (push, NVC0_CB_AUX_SIZE);
PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
BEGIN_NVC0(push, NVC0_3D(CB_BIND(i)), 1);
PUSH_DATA (push, (15 << 4) | 1);
if (screen->eng3d->oclass >= NVE4_3D_CLASS) {
unsigned j;
BEGIN_1IC0(push, NVC0_3D(CB_POS), 9);
PUSH_DATA (push, NVC0_CB_AUX_UNK_INFO);
for (j = 0; j < 8; ++j)
PUSH_DATA(push, j);
} else {
BEGIN_NVC0(push, NVC0_3D(TEX_LIMITS(i)), 1);
PUSH_DATA (push, 0x54);
}
/* MS sample coordinate offsets: these do not work with _ALT modes ! */
BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 2 * 8);
PUSH_DATA (push, NVC0_CB_AUX_MS_INFO);
PUSH_DATA (push, 0); /* 0 */
PUSH_DATA (push, 0);
PUSH_DATA (push, 1); /* 1 */
PUSH_DATA (push, 0);
PUSH_DATA (push, 0); /* 2 */
PUSH_DATA (push, 1);
PUSH_DATA (push, 1); /* 3 */
PUSH_DATA (push, 1);
PUSH_DATA (push, 2); /* 4 */
PUSH_DATA (push, 0);
PUSH_DATA (push, 3); /* 5 */
PUSH_DATA (push, 0);
PUSH_DATA (push, 2); /* 6 */
PUSH_DATA (push, 1);
PUSH_DATA (push, 3); /* 7 */
PUSH_DATA (push, 1);
}
BEGIN_NVC0(push, NVC0_3D(LINKED_TSC), 1);
PUSH_DATA (push, 0);
PUSH_KICK (push);
screen->tic.entries = CALLOC(4096, sizeof(void *));

View File

@@ -607,7 +607,7 @@ void nvc0_validate_textures(struct nvc0_context *nvc0)
/* Invalidate all CP textures because they are aliased. */
for (int i = 0; i < nvc0->num_textures[5]; i++)
nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_CP_TEX(i));
nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_TEX(i));
nvc0->textures_dirty[5] = ~0;
nvc0->dirty_cp |= NVC0_NEW_CP_TEXTURES;
}

View File

@@ -826,8 +826,9 @@ static void r600_texture_alloc_cmask_separate(struct r600_common_screen *rscreen
}
rtex->cmask_buffer = (struct r600_resource *)
pipe_buffer_create(&rscreen->b, PIPE_BIND_CUSTOM,
PIPE_USAGE_DEFAULT, rtex->cmask.size);
r600_aligned_buffer_create(&rscreen->b, 0, PIPE_USAGE_DEFAULT,
rtex->cmask.size,
rtex->cmask.alignment);
if (rtex->cmask_buffer == NULL) {
rtex->cmask.size = 0;
return;
@@ -2442,29 +2443,29 @@ static void si_set_optimal_micro_tile_mode(struct r600_common_screen *rscreen,
switch (rtex->last_msaa_resolve_target_micro_mode) {
case 0: /* displayable */
switch (rtex->surface.bpe) {
case 8:
case 1:
rtex->surface.tiling_index[0] = 10;
break;
case 16:
case 2:
rtex->surface.tiling_index[0] = 11;
break;
default: /* 32, 64 */
default: /* 4, 8 */
rtex->surface.tiling_index[0] = 12;
break;
}
break;
case 1: /* thin */
switch (rtex->surface.bpe) {
case 8:
case 1:
rtex->surface.tiling_index[0] = 14;
break;
case 16:
case 2:
rtex->surface.tiling_index[0] = 15;
break;
case 32:
case 4:
rtex->surface.tiling_index[0] = 16;
break;
default: /* 64, 128 */
default: /* 8, 16 */
rtex->surface.tiling_index[0] = 17;
break;
}

View File

@@ -911,7 +911,7 @@ static LLVMValueRef lds_load(struct lp_build_tgsi_context *bld_base,
if (tgsi_type_is_64bit(type)) {
LLVMValueRef value2;
dw_addr = lp_build_add(&bld_base->uint_bld, dw_addr,
lp_build_const_int32(gallivm, swizzle + 1));
lp_build_const_int32(gallivm, 1));
value2 = build_indexed_load(ctx, ctx->lds, dw_addr, false);
return si_llvm_emit_fetch_64bit(bld_base, type, value, value2);
}

View File

@@ -126,7 +126,6 @@ prepare_vs_constants_userbuf_swvp(struct NineDevice9 *device)
cb.user_buffer = state->vs_const_i;
state->pipe.cb2_swvp = cb;
state->changed.vs_const_i = 0;
}
if (state->changed.vs_const_b || state->changed.group & NINE_STATE_SWVP) {
@@ -138,7 +137,6 @@ prepare_vs_constants_userbuf_swvp(struct NineDevice9 *device)
cb.user_buffer = state->vs_const_b;
state->pipe.cb3_swvp = cb;
state->changed.vs_const_b = 0;
}
if (!device->driver_caps.user_cbufs) {
@@ -236,14 +234,30 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device)
if (state->changed.vs_const_i || state->changed.group & NINE_STATE_SWVP) {
int *idst = (int *)&state->vs_const_f[4 * device->max_vs_const_f];
memcpy(idst, state->vs_const_i, NINE_MAX_CONST_I * sizeof(int[4]));
state->changed.vs_const_i = 0;
}
if (state->changed.vs_const_b || state->changed.group & NINE_STATE_SWVP) {
int *idst = (int *)&state->vs_const_f[4 * device->max_vs_const_f];
uint32_t *bdst = (uint32_t *)&idst[4 * NINE_MAX_CONST_I];
memcpy(bdst, state->vs_const_b, NINE_MAX_CONST_B * sizeof(BOOL));
state->changed.vs_const_b = 0;
}
if (device->state.changed.vs_const_i) {
struct nine_range *r = device->state.changed.vs_const_i;
struct nine_range *p = r;
while (p->next)
p = p->next;
nine_range_pool_put_chain(&device->range_pool, r, p);
device->state.changed.vs_const_i = NULL;
}
if (device->state.changed.vs_const_b) {
struct nine_range *r = device->state.changed.vs_const_b;
struct nine_range *p = r;
while (p->next)
p = p->next;
nine_range_pool_put_chain(&device->range_pool, r, p);
device->state.changed.vs_const_b = NULL;
}
if (!cb.buffer_size)
@@ -290,23 +304,6 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device)
device->state.changed.vs_const_f = NULL;
}
if (device->state.changed.vs_const_i) {
struct nine_range *r = device->state.changed.vs_const_i;
struct nine_range *p = r;
while (p->next)
p = p->next;
nine_range_pool_put_chain(&device->range_pool, r, p);
device->state.changed.vs_const_i = NULL;
}
if (device->state.changed.vs_const_b) {
struct nine_range *r = device->state.changed.vs_const_b;
struct nine_range *p = r;
while (p->next)
p = p->next;
nine_range_pool_put_chain(&device->range_pool, r, p);
device->state.changed.vs_const_b = NULL;
}
state->changed.group &= ~NINE_STATE_VS_CONST;
state->commit |= NINE_STATE_COMMIT_CONST_VS;
}

View File

@@ -447,6 +447,7 @@ NineSurface9_LockRect( struct NineSurface9 *This,
} else {
u_box_origin_2d(This->desc.Width, This->desc.Height, &box);
}
box.z = This->layer;
user_warn(This->desc.Format == D3DFMT_NULL);

View File

@@ -373,7 +373,7 @@ NineVolume9_UnlockBox( struct NineVolume9 *This )
This->layer_stride_conversion,
0, 0, 0,
This->desc.Width, This->desc.Height,
This->desc.Height);
This->desc.Depth);
if (!This->data)
pipe_transfer_unmap(This->pipe, transfer);

View File

@@ -303,6 +303,20 @@ static void set_micro_tile_mode(struct radeon_surf *surf,
surf->micro_tile_mode = G_009910_MICRO_TILE_MODE(tile_mode);
}
static unsigned cik_get_macro_tile_index(struct radeon_surf *surf)
{
unsigned index, tileb;
tileb = 8 * 8 * surf->bpe;
tileb = MIN2(surf->tile_split, tileb);
for (index = 0; tileb > 64; index++)
tileb >>= 1;
assert(index < 16);
return index;
}
static int amdgpu_surface_init(struct radeon_winsys *rws,
struct radeon_surf *surf)
{
@@ -475,6 +489,9 @@ static int amdgpu_surface_init(struct radeon_winsys *rws,
AddrSurfInfoIn.tileIndex = 10; /* 2D displayable */
else
AddrSurfInfoIn.tileIndex = 14; /* 2D non-displayable */
/* Addrlib doesn't set this if tileIndex is forced like above. */
AddrSurfInfoOut.macroModeIndex = cik_get_macro_tile_index(surf);
}
}

View File

@@ -3,4 +3,4 @@
/anv_entrypoints.h
/anv_timestamp.h
/dev_icd.json
/intel_icd.json
/intel_icd.*.json

View File

@@ -147,13 +147,12 @@ anv_timestamp.h:
$(AM_V_GEN) echo "#define ANV_TIMESTAMP \"$(TIMESTAMP_CMD)\"" > $@
BUILT_SOURCES = $(VULKAN_GENERATED_FILES)
CLEANFILES = $(BUILT_SOURCES) dev_icd.json intel_icd.json
CLEANFILES = $(BUILT_SOURCES) dev_icd.json intel_icd.@host_cpu@.json
EXTRA_DIST = \
$(top_srcdir)/include/vulkan/vk_icd.h \
anv_entrypoints_gen.py \
dev_icd.json.in \
intel_icd.json.in \
intel_icd.json
intel_icd.json.in
libvulkan_intel_la_LIBADD = $(VULKAN_LIB_DEPS)
@@ -168,7 +167,7 @@ libvulkan_intel_la_LDFLAGS = \
icdconfdir = @VULKAN_ICD_INSTALL_DIR@
icdconf_DATA = intel_icd.json
icdconf_DATA = intel_icd.@host_cpu@.json
# The following is used for development purposes, by setting VK_ICD_FILENAMES.
noinst_DATA = dev_icd.json
@@ -177,15 +176,9 @@ dev_icd.json : dev_icd.json.in
-e "s#@build_libdir@#${abs_top_builddir}/${LIB_DIR}#" \
< $(srcdir)/dev_icd.json.in > $@
if VULKAN_ICD_DRIVER_PATH
ICD_DRIVER_PATH="${libdir}/libvulkan_intel.so"
else
ICD_DRIVER_PATH="libvulkan_intel.so"
endif
intel_icd.json : intel_icd.json.in
intel_icd.@host_cpu@.json : intel_icd.json.in
$(AM_V_GEN) $(SED) \
-e "s#@ICD_DRIVER_PATH@#${ICD_DRIVER_PATH}#" \
-e "s#@install_libdir@#${libdir}#" \
< $(srcdir)/intel_icd.json.in > $@
# Libvulkan with dummy gem. Used for unit tests.

View File

@@ -2,6 +2,6 @@
"file_format_version": "1.0.0",
"ICD": {
"library_path": "@build_libdir@/libvulkan_intel.so",
"abi_versions": "1.0.3"
"api_version": "1.0.3"
}
}

View File

@@ -1,7 +1,7 @@
{
"file_format_version": "1.0.0",
"ICD": {
"library_path": "@ICD_DRIVER_PATH@",
"abi_versions": "1.0.3"
"library_path": "@install_libdir@/libvulkan_intel.so",
"api_version": "1.0.3"
}
}

View File

@@ -64,6 +64,9 @@ BUILT_SOURCES += shared-glapi/glapi_mapi_tmp.h
lib_LTLIBRARIES += shared-glapi/libglapi.la
shared_glapi_libglapi_la_SOURCES = $(MAPI_GLAPI_FILES) shared-glapi/glapi_mapi_tmp.h
shared_glapi_libglapi_la_CFLAGS = \
$(AM_CFLAGS) \
$(VISIBILITY_CFLAGS)
shared_glapi_libglapi_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DMAPI_MODE_GLAPI \

View File

@@ -8296,6 +8296,23 @@
<!-- ARB extension 171 -->
<xi:include href="ARB_pipeline_statistics_query.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<category name="es3.2">
<!-- This should be in es_EXT, but this file is included first and
the alias doesn't work otherwise. -->
<function name="PrimitiveBoundingBox" es2="3.2" desktop="false">
<param name="minX" type="GLfloat"/>
<param name="minY" type="GLfloat"/>
<param name="minZ" type="GLfloat"/>
<param name="minW" type="GLfloat"/>
<param name="maxX" type="GLfloat"/>
<param name="maxY" type="GLfloat"/>
<param name="maxZ" type="GLfloat"/>
<param name="maxW" type="GLfloat"/>
</function>
<function name="BlendBarrier" es2="3.2"/>
</category>
<category name="KHR_blend_equation_advanced" number="174">
<enum name="BLEND_ADVANCED_COHERENT_KHR" value="0x9285"/>
@@ -8316,7 +8333,6 @@
<enum name="HSL_COLOR_KHR" value="0x92AF"/>
<enum name="HSL_LUMINOSITY_KHR" value="0x92B0"/>
<function name="BlendBarrier" es2="3.2"/>
<function name="BlendBarrierKHR" alias="BlendBarrier" es2="2.0"/>
</category>
@@ -8332,18 +8348,6 @@
<size name="Get" mode="get"/>
</enum>
<!-- This should be in es_EXT, but this file is included first and
the alias doesn't work otherwise. -->
<function name="PrimitiveBoundingBox" es2="3.2" desktop="false">
<param name="minX" type="GLfloat"/>
<param name="minY" type="GLfloat"/>
<param name="minZ" type="GLfloat"/>
<param name="minW" type="GLfloat"/>
<param name="maxX" type="GLfloat"/>
<param name="maxY" type="GLfloat"/>
<param name="maxZ" type="GLfloat"/>
<param name="maxW" type="GLfloat"/>
</function>
<function name="PrimitiveBoundingBoxARB" alias="PrimitiveBoundingBox">
<param name="minX" type="GLfloat"/>
<param name="minY" type="GLfloat"/>

View File

@@ -484,17 +484,22 @@ functions = [
"BindVertexBuffer",
"BindVertexBuffers",
"Bitmap",
"BlendBarrier",
"BlendColor",
"BlendColorEXT",
"BlendEquation",
"BlendEquationEXT",
"BlendEquationi",
"BlendEquationiARB",
"BlendEquationSeparate",
"BlendEquationSeparatei",
"BlendEquationSeparateiARB",
"BlendFunc",
"BlendFunci",
"BlendFunciARB",
"BlendFuncSeparate",
"BlendFuncSeparateEXT",
"BlendFuncSeparatei",
"BlendFuncSeparateiARB",
"BlitFramebuffer",
"BufferData",
@@ -825,6 +830,7 @@ functions = [
"GetFramebufferAttachmentParameteriv",
"GetFramebufferAttachmentParameterivEXT",
"GetFramebufferParameteriv",
"GetGraphicsResetStatus",
"GetGraphicsResetStatusARB",
"GetHandleARB",
"GetHistogram",
@@ -864,8 +870,11 @@ functions = [
"GetnSeparableFilterARB",
"GetnTexImageARB",
"GetnUniformdvARB",
"GetnUniformfv",
"GetnUniformfvARB",
"GetnUniformiv",
"GetnUniformivARB",
"GetnUniformuiv",
"GetnUniformuivARB",
"GetObjectLabel",
"GetObjectParameterfvARB",
@@ -1160,6 +1169,7 @@ functions = [
"Orthof",
"Orthox",
"PassThrough",
"PatchParameteri",
"PauseTransformFeedback",
"PixelMapfv",
"PixelMapuiv",
@@ -1191,6 +1201,7 @@ functions = [
"PopDebugGroup",
"PopMatrix",
"PopName",
"PrimitiveBoundingBox",
"PrimitiveRestartIndex",
"PrimitiveRestartIndexNV",
"PrimitiveRestartNV",
@@ -1273,6 +1284,7 @@ functions = [
"RasterPos4s",
"RasterPos4sv",
"ReadBuffer",
"ReadnPixels",
"ReadnPixelsARB",
"ReadPixels",
"Rectd",

View File

@@ -492,19 +492,6 @@ type_size_scalar(const struct glsl_type *type)
return 0;
}
/**
* Returns the number of scalar components needed to store type, assuming
* that vectors are padded out to vec4.
*
* This has the packing rules of type_size_vec4(), but counts components
* similar to type_size_scalar().
*/
extern "C" int
type_size_vec4_times_4(const struct glsl_type *type)
{
return 4 * type_size_vec4(type);
}
/* Attribute arrays are loaded as one vec4 per element (or matrix column),
* except for double-precision types, which are loaded as one dvec4.
*/
@@ -1687,6 +1674,12 @@ fs_visitor::assign_gs_urb_setup()
void
fs_visitor::split_virtual_grfs()
{
/* Compact the register file so we eliminate dead vgrfs. This
* only defines split points for live registers, so if we have
* too large dead registers they will hit assertions later.
*/
compact_virtual_grfs();
int num_vars = this->alloc.count;
/* Count the total number of registers */

View File

@@ -324,8 +324,6 @@ public:
fs_reg *nir_locals;
fs_reg *nir_ssa_values;
fs_reg nir_inputs;
fs_reg nir_outputs;
fs_reg *nir_system_values;
bool failed;

View File

@@ -48,56 +48,18 @@ fs_visitor::emit_nir_code()
}
}
void
fs_visitor::nir_setup_single_output_varying(fs_reg *reg,
const glsl_type *type,
unsigned *location)
{
if (type->is_array() || type->is_matrix()) {
const struct glsl_type *elem_type = glsl_get_array_element(type);
const unsigned length = glsl_get_length(type);
for (unsigned i = 0; i < length; i++) {
nir_setup_single_output_varying(reg, elem_type, location);
}
} else if (type->is_record()) {
for (unsigned i = 0; i < type->length; i++) {
const struct glsl_type *field_type = type->fields.structure[i].type;
nir_setup_single_output_varying(reg, field_type, location);
}
} else {
assert(type->is_scalar() || type->is_vector());
unsigned num_iter = 1;
if (type->is_dual_slot())
num_iter = 2;
for (unsigned count = 0; count < num_iter; count++) {
this->outputs[*location] = *reg;
*reg = offset(*reg, bld, 4);
(*location)++;
}
}
}
void
fs_visitor::nir_setup_outputs()
{
if (stage == MESA_SHADER_TESS_CTRL || stage == MESA_SHADER_FRAGMENT)
return;
nir_outputs = bld.vgrf(BRW_REGISTER_TYPE_F, nir->num_outputs);
nir_foreach_variable(var, &nir->outputs) {
switch (stage) {
case MESA_SHADER_VERTEX:
case MESA_SHADER_TESS_EVAL:
case MESA_SHADER_GEOMETRY: {
fs_reg reg = offset(nir_outputs, bld, var->data.driver_location);
unsigned location = var->data.location;
nir_setup_single_output_varying(&reg, var->type, &location);
break;
}
default:
unreachable("unhandled shader stage");
const unsigned vec4s = type_size_vec4(var->type);
fs_reg reg = bld.vgrf(BRW_REGISTER_TYPE_F, 4 * vec4s);
for (unsigned i = 0; i < vec4s; i++) {
if (outputs[var->data.driver_location + i].file == BAD_FILE)
outputs[var->data.driver_location + i] = offset(reg, bld, 4 * i);
}
}
}
@@ -4251,12 +4213,11 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
case nir_intrinsic_store_output: {
fs_reg src = get_nir_src(instr->src[0]);
fs_reg new_dest = offset(retype(nir_outputs, src.type), bld,
instr->const_index[0]);
nir_const_value *const_offset = nir_src_as_const_value(instr->src[1]);
assert(const_offset && "Indirect output stores not allowed");
new_dest = offset(new_dest, bld, const_offset->u32[0]);
fs_reg new_dest = retype(offset(outputs[instr->const_index[0]], bld,
4 * const_offset->u32[0]), src.type);
unsigned num_components = instr->num_components;
unsigned first_component = nir_intrinsic_component(instr);

View File

@@ -327,16 +327,11 @@ void
brw_nir_lower_vue_outputs(nir_shader *nir,
bool is_scalar)
{
if (is_scalar) {
nir_assign_var_locations(&nir->outputs, &nir->num_outputs,
VARYING_SLOT_VAR0,
type_size_vec4_times_4);
nir_lower_io(nir, nir_var_shader_out, type_size_vec4_times_4, 0);
} else {
nir_foreach_variable(var, &nir->outputs)
var->data.driver_location = var->data.location;
nir_lower_io(nir, nir_var_shader_out, type_size_vec4, 0);
nir_foreach_variable(var, &nir->outputs) {
var->data.driver_location = var->data.location;
}
nir_lower_io(nir, nir_var_shader_out, type_size_vec4, 0);
}
void

View File

@@ -34,7 +34,6 @@ extern "C" {
int type_size_scalar(const struct glsl_type *type);
int type_size_vec4(const struct glsl_type *type);
int type_size_dvec4(const struct glsl_type *type);
int type_size_vec4_times_4(const struct glsl_type *type);
int type_size_vs_input(const struct glsl_type *type);
static inline int

View File

@@ -389,17 +389,48 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb,
/* complicated error checking... */
for (output = 0; output < n; output++) {
/* Section 4.2 (Whole Framebuffer Operations) of the OpenGL 3.0
destMask[output] = draw_buffer_enum_to_bitmask(ctx, buffers[output]);
/* From the OpenGL 3.0 specification, page 258:
* "Each buffer listed in bufs must be one of the values from tables
* 4.5 or 4.6. Otherwise, an INVALID_ENUM error is generated.
*/
if (destMask[output] == BAD_MASK) {
_mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid buffer %s)",
caller, _mesa_enum_to_string(buffers[output]));
return;
}
/* From the OpenGL 4.0 specification, page 256:
* "For both the default framebuffer and framebuffer objects, the
* constants FRONT, BACK, LEFT, RIGHT, and FRONT_AND_BACK are not
* valid in the bufs array passed to DrawBuffers, and will result in
* the error INVALID_ENUM. This restriction is because these
* constants may themselves refer to multiple buffers, as shown in
* table 4.4."
* Previous versions of the OpenGL specification say INVALID_OPERATION,
* but the Khronos conformance tests expect INVALID_ENUM.
*/
if (_mesa_bitcount(destMask[output]) > 1) {
_mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid buffer %s)",
caller, _mesa_enum_to_string(buffers[output]));
return;
}
/* Section 4.2 (Whole Framebuffer Operations) of the OpenGL ES 3.0
* specification says:
*
* "Each buffer listed in bufs must be BACK, NONE, or one of the values
* from table 4.3 (NONE, COLOR_ATTACHMENTi)"
* "If the GL is bound to a draw framebuffer object, the ith buffer
* listed in bufs must be COLOR_ATTACHMENTi or NONE . Specifying a
* buffer out of order, BACK , or COLOR_ATTACHMENTm where m is greater
* than or equal to the value of MAX_- COLOR_ATTACHMENTS , will
* generate the error INVALID_OPERATION .
*/
if (_mesa_is_gles3(ctx) && buffers[output] != GL_NONE &&
buffers[output] != GL_BACK &&
if (_mesa_is_gles3(ctx) && _mesa_is_user_fbo(fb) &&
buffers[output] != GL_NONE &&
(buffers[output] < GL_COLOR_ATTACHMENT0 ||
buffers[output] >= GL_COLOR_ATTACHMENT0 + ctx->Const.MaxColorAttachments)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffers(buffer)");
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffers(buffer)");
return;
}
@@ -423,34 +454,6 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb,
return;
}
destMask[output] = draw_buffer_enum_to_bitmask(ctx, buffers[output]);
/* From the OpenGL 3.0 specification, page 258:
* "Each buffer listed in bufs must be one of the values from tables
* 4.5 or 4.6. Otherwise, an INVALID_ENUM error is generated.
*/
if (destMask[output] == BAD_MASK) {
_mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid buffer %s)",
caller, _mesa_enum_to_string(buffers[output]));
return;
}
/* From the OpenGL 4.0 specification, page 256:
* "For both the default framebuffer and framebuffer objects, the
* constants FRONT, BACK, LEFT, RIGHT, and FRONT_AND_BACK are not
* valid in the bufs array passed to DrawBuffers, and will result in
* the error INVALID_ENUM. This restriction is because these
* constants may themselves refer to multiple buffers, as shown in
* table 4.4."
* Previous versions of the OpenGL specification say INVALID_OPERATION,
* but the Khronos conformance tests expect INVALID_ENUM.
*/
if (_mesa_bitcount(destMask[output]) > 1) {
_mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid buffer %s)",
caller, _mesa_enum_to_string(buffers[output]));
return;
}
/* From the OpenGL 3.0 specification, page 259:
* "If the GL is bound to the default framebuffer and DrawBuffers is
* supplied with a constant (other than NONE) that does not indicate

View File

@@ -123,7 +123,7 @@ handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval)
{
lval->string = strdup(text);
return (_mesa_symbol_table_find_symbol(state->st, 0, text) == NULL)
return (_mesa_symbol_table_find_symbol(state->st, text) == NULL)
? IDENTIFIER : USED_IDENTIFIER;
}

View File

@@ -724,7 +724,7 @@ extSwizSel: INTEGER
srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, $1);
_mesa_symbol_table_find_symbol(state->st, $1);
free($1);
@@ -812,7 +812,7 @@ dstReg: resultBinding
| USED_IDENTIFIER /* temporaryReg | vertexResultReg */
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, $1);
_mesa_symbol_table_find_symbol(state->st, $1);
free($1);
@@ -841,7 +841,7 @@ dstReg: resultBinding
progParamArray: USED_IDENTIFIER
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, $1);
_mesa_symbol_table_find_symbol(state->st, $1);
free($1);
@@ -914,7 +914,7 @@ addrRegNegOffset: INTEGER
addrReg: USED_IDENTIFIER
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, $1);
_mesa_symbol_table_find_symbol(state->st, $1);
free($1);
@@ -2028,9 +2028,9 @@ legacyTexUnitNum: INTEGER
ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER
{
struct asm_symbol *exist = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, $2);
_mesa_symbol_table_find_symbol(state->st, $2);
struct asm_symbol *target = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, $4);
_mesa_symbol_table_find_symbol(state->st, $4);
free($4);
@@ -2046,7 +2046,7 @@ ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER
"undefined variable binding in ALIAS statement");
YYERROR;
} else {
_mesa_symbol_table_add_symbol(state->st, 0, $2, target);
_mesa_symbol_table_add_symbol(state->st, $2, target);
}
}
;
@@ -2235,7 +2235,7 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
{
struct asm_symbol *s = NULL;
struct asm_symbol *exist = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, name);
_mesa_symbol_table_find_symbol(state->st, name);
if (exist != NULL) {
@@ -2273,7 +2273,7 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
break;
}
_mesa_symbol_table_add_symbol(state->st, 0, s->name, s);
_mesa_symbol_table_add_symbol(state->st, s->name, s);
s->next = state->sym;
state->sym = s;
}

View File

@@ -26,6 +26,9 @@
#include "../../util/hash_table.h"
struct symbol {
/** Symbol name. */
char *name;
/**
* Link to the next symbol in the table with the same name
*
@@ -34,7 +37,6 @@ struct symbol {
*/
struct symbol *next_with_same_name;
/**
* Link to the next symbol in the table with the same scope
*
@@ -43,21 +45,6 @@ struct symbol {
*/
struct symbol *next_with_same_scope;
/**
* Header information for the list of symbols with the same name.
*/
struct symbol_header *hdr;
/**
* Name space of the symbol
*
* Name space are arbitrary user assigned integers. No two symbols can
* exist in the same name space at the same scope level.
*/
int name_space;
/** Scope depth where this symbol was defined. */
unsigned depth;
@@ -68,20 +55,6 @@ struct symbol {
};
/**
*/
struct symbol_header {
/** Linkage in list of all headers in a given symbol table. */
struct symbol_header *next;
/** Symbol name. */
char *name;
/** Linked list of symbols with the same name. */
struct symbol *symbols;
};
/**
* Element of the scope stack.
*/
@@ -104,41 +77,10 @@ struct _mesa_symbol_table {
/** Top of scope stack. */
struct scope_level *current_scope;
/** List of all symbol headers in the table. */
struct symbol_header *hdr;
/** Current scope depth. */
unsigned depth;
};
static void
check_symbol_table(struct _mesa_symbol_table *table)
{
#if !defined(NDEBUG)
struct scope_level *scope;
for (scope = table->current_scope; scope != NULL; scope = scope->next) {
struct symbol *sym;
for (sym = scope->symbols
; sym != NULL
; sym = sym->next_with_same_name) {
const struct symbol_header *const hdr = sym->hdr;
struct symbol *sym2;
for (sym2 = hdr->symbols
; sym2 != NULL
; sym2 = sym2->next_with_same_name) {
assert(sym2->hdr == hdr);
}
}
}
#else
(void) table;
#endif /* !defined(NDEBUG) */
}
void
_mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table)
{
@@ -152,18 +94,22 @@ _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table)
while (sym != NULL) {
struct symbol *const next = sym->next_with_same_scope;
struct symbol_header *const hdr = sym->hdr;
assert(hdr->symbols == sym);
hdr->symbols = sym->next_with_same_name;
struct hash_entry *hte = _mesa_hash_table_search(table->ht,
sym->name);
if (sym->next_with_same_name) {
/* If there is a symbol with this name in an outer scope update
* the hash table to point to it.
*/
hte->key = sym->next_with_same_name->name;
hte->data = sym->next_with_same_name;
} else {
_mesa_hash_table_remove(table->ht, hte);
free(sym->name);
}
free(sym);
sym = next;
}
check_symbol_table(table);
}
@@ -171,7 +117,6 @@ void
_mesa_symbol_table_push_scope(struct _mesa_symbol_table *table)
{
struct scope_level *const scope = calloc(1, sizeof(*scope));
if (scope == NULL) {
_mesa_error_no_memory(__func__);
return;
@@ -183,11 +128,11 @@ _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table)
}
static struct symbol_header *
static struct symbol *
find_symbol(struct _mesa_symbol_table *table, const char *name)
{
struct hash_entry *entry = _mesa_hash_table_search(table->ht, name);
return entry ? (struct symbol_header *) entry->data : NULL;
return entry ? (struct symbol *) entry->data : NULL;
}
@@ -201,200 +146,140 @@ find_symbol(struct _mesa_symbol_table *table, const char *name)
*/
int
_mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table,
int name_space, const char *name)
const char *name)
{
struct symbol_header *const hdr = find_symbol(table, name);
struct symbol *sym;
struct symbol *const sym = find_symbol(table, name);
if (hdr != NULL) {
for (sym = hdr->symbols; sym != NULL; sym = sym->next_with_same_name) {
assert(sym->hdr == hdr);
if (sym) {
assert(sym->depth <= table->depth);
return sym->depth - table->depth;
}
if ((name_space == -1) || (sym->name_space == name_space)) {
assert(sym->depth <= table->depth);
return sym->depth - table->depth;
}
}
}
return -1;
return -1;
}
void *
_mesa_symbol_table_find_symbol(struct _mesa_symbol_table *table,
int name_space, const char *name)
const char *name)
{
struct symbol_header *const hdr = find_symbol(table, name);
struct symbol *const sym = find_symbol(table, name);
if (sym)
return sym->data;
if (hdr != NULL) {
struct symbol *sym;
for (sym = hdr->symbols; sym != NULL; sym = sym->next_with_same_name) {
assert(sym->hdr == hdr);
if ((name_space == -1) || (sym->name_space == name_space)) {
return sym->data;
}
}
}
return NULL;
return NULL;
}
int
_mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table,
int name_space, const char *name,
void *declaration)
const char *name, void *declaration)
{
struct symbol_header *hdr;
struct symbol *sym;
struct symbol *new_sym;
struct symbol *sym = find_symbol(table, name);
check_symbol_table(table);
if (sym && sym->depth == table->depth)
return -1;
hdr = find_symbol(table, name);
new_sym = calloc(1, sizeof(*sym));
if (new_sym == NULL) {
_mesa_error_no_memory(__func__);
return -1;
}
check_symbol_table(table);
if (sym) {
/* Store link to symbol in outer scope with the same name */
new_sym->next_with_same_name = sym;
new_sym->name = sym->name;
} else {
new_sym->name = strdup(name);
if (new_sym->name == NULL) {
free(new_sym);
_mesa_error_no_memory(__func__);
return -1;
}
}
if (hdr == NULL) {
hdr = calloc(1, sizeof(*hdr));
if (hdr == NULL) {
_mesa_error_no_memory(__func__);
return -1;
}
new_sym->next_with_same_scope = table->current_scope->symbols;
new_sym->data = declaration;
new_sym->depth = table->depth;
hdr->name = strdup(name);
if (hdr->name == NULL) {
free(hdr);
_mesa_error_no_memory(__func__);
return -1;
}
table->current_scope->symbols = new_sym;
_mesa_hash_table_insert(table->ht, hdr->name, hdr);
hdr->next = table->hdr;
table->hdr = hdr;
}
_mesa_hash_table_insert(table->ht, new_sym->name, new_sym);
check_symbol_table(table);
return 0;
}
/* If the symbol already exists in this namespace at this scope, it cannot
* be added to the table.
*/
for (sym = hdr->symbols
; (sym != NULL) && (sym->name_space != name_space)
; sym = sym->next_with_same_name) {
/* empty */
}
int
_mesa_symbol_table_replace_symbol(struct _mesa_symbol_table *table,
const char *name,
void *declaration)
{
struct symbol *sym = find_symbol(table, name);
if (sym && (sym->depth == table->depth))
/* If the symbol doesn't exist, it cannot be replaced. */
if (sym == NULL)
return -1;
sym = calloc(1, sizeof(*sym));
if (sym == NULL) {
_mesa_error_no_memory(__func__);
return -1;
}
sym->next_with_same_name = hdr->symbols;
sym->next_with_same_scope = table->current_scope->symbols;
sym->hdr = hdr;
sym->name_space = name_space;
sym->data = declaration;
sym->depth = table->depth;
assert(sym->hdr == hdr);
hdr->symbols = sym;
table->current_scope->symbols = sym;
check_symbol_table(table);
return 0;
}
int
_mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table *table,
int name_space, const char *name,
void *declaration)
const char *name, void *declaration)
{
struct symbol_header *hdr;
struct symbol *sym;
struct symbol *curr;
struct scope_level *top_scope;
struct scope_level *top_scope;
struct symbol *inner_sym = NULL;
struct symbol *sym = find_symbol(table, name);
check_symbol_table(table);
while (sym) {
if (sym->depth == 0)
return -1;
hdr = find_symbol(table, name);
inner_sym = sym;
check_symbol_table(table);
/* Get symbol from the outer scope with the same name */
sym = sym->next_with_same_name;
}
if (hdr == NULL) {
hdr = calloc(1, sizeof(*hdr));
if (hdr == NULL) {
_mesa_error_no_memory(__func__);
return -1;
}
/* Find the top-level scope */
for (top_scope = table->current_scope; top_scope->next != NULL;
top_scope = top_scope->next) {
/* empty */
}
hdr->name = strdup(name);
sym = calloc(1, sizeof(*sym));
if (sym == NULL) {
_mesa_error_no_memory(__func__);
return -1;
}
_mesa_hash_table_insert(table->ht, hdr->name, hdr);
hdr->next = table->hdr;
table->hdr = hdr;
}
if (inner_sym) {
/* In case we add the global out of order store a link to the global
* symbol in global.
*/
inner_sym->next_with_same_name = sym;
check_symbol_table(table);
sym->name = inner_sym->name;
} else {
sym->name = strdup(name);
if (sym->name == NULL) {
free(sym);
_mesa_error_no_memory(__func__);
return -1;
}
}
/* If the symbol already exists in this namespace at this scope, it cannot
* be added to the table.
*/
for (sym = hdr->symbols
; (sym != NULL) && (sym->name_space != name_space)
; sym = sym->next_with_same_name) {
/* empty */
}
sym->next_with_same_scope = top_scope->symbols;
sym->data = declaration;
if (sym && sym->depth == 0)
return -1;
top_scope->symbols = sym;
/* Find the top-level scope */
for (top_scope = table->current_scope
; top_scope->next != NULL
; top_scope = top_scope->next) {
/* empty */
}
_mesa_hash_table_insert(table->ht, sym->name, sym);
sym = calloc(1, sizeof(*sym));
if (sym == NULL) {
_mesa_error_no_memory(__func__);
return -1;
}
sym->next_with_same_scope = top_scope->symbols;
sym->hdr = hdr;
sym->name_space = name_space;
sym->data = declaration;
assert(sym->hdr == hdr);
/* Since next_with_same_name is ordered by scope, we need to append the
* new symbol to the _end_ of the list.
*/
if (hdr->symbols == NULL) {
hdr->symbols = sym;
} else {
for (curr = hdr->symbols
; curr->next_with_same_name != NULL
; curr = curr->next_with_same_name) {
/* empty */
}
curr->next_with_same_name = sym;
}
top_scope->symbols = sym;
check_symbol_table(table);
return 0;
return 0;
}
@@ -418,19 +303,10 @@ _mesa_symbol_table_ctor(void)
void
_mesa_symbol_table_dtor(struct _mesa_symbol_table *table)
{
struct symbol_header *hdr;
struct symbol_header *next;
while (table->current_scope != NULL) {
_mesa_symbol_table_pop_scope(table);
}
for (hdr = table->hdr; hdr != NULL; hdr = next) {
next = hdr->next;
free(hdr->name);
free(hdr);
}
_mesa_hash_table_destroy(table->ht, NULL);
free(table);
}

View File

@@ -30,17 +30,22 @@ extern void _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table);
extern void _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table);
extern int _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *symtab,
int name_space, const char *name, void *declaration);
const char *name, void *declaration);
extern int _mesa_symbol_table_add_global_symbol(
struct _mesa_symbol_table *symtab, int name_space, const char *name,
void *declaration);
extern int _mesa_symbol_table_replace_symbol(struct _mesa_symbol_table *table,
const char *name,
void *declaration);
extern int
_mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table *symtab,
const char *name,
void *declaration);
extern int _mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table,
int name_space, const char *name);
const char *name);
extern void *_mesa_symbol_table_find_symbol(
struct _mesa_symbol_table *symtab, int name_space, const char *name);
extern void *_mesa_symbol_table_find_symbol(struct _mesa_symbol_table *symtab,
const char *name);
extern struct _mesa_symbol_table *_mesa_symbol_table_ctor(void);

View File

@@ -41,16 +41,21 @@ struct st_sync_object {
struct gl_sync_object b;
struct pipe_fence_handle *fence;
mtx_t mutex; /**< protects "fence" */
};
static struct gl_sync_object * st_new_sync_object(struct gl_context *ctx,
GLenum type)
{
if (type == GL_SYNC_FENCE)
return (struct gl_sync_object*)CALLOC_STRUCT(st_sync_object);
else
if (type == GL_SYNC_FENCE) {
struct st_sync_object *so = CALLOC_STRUCT(st_sync_object);
mtx_init(&so->mutex, mtx_plain);
return &so->b;
} else {
return NULL;
}
}
static void st_delete_sync_object(struct gl_context *ctx,
@@ -60,6 +65,7 @@ static void st_delete_sync_object(struct gl_context *ctx,
struct st_sync_object *so = (struct st_sync_object*)obj;
screen->fence_reference(screen, &so->fence, NULL);
mtx_destroy(&so->mutex);
free(so->b.Label);
free(so);
}
@@ -76,24 +82,6 @@ static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
pipe->flush(pipe, &so->fence, PIPE_FLUSH_DEFERRED);
}
static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct pipe_screen *screen = pipe->screen;
struct st_sync_object *so = (struct st_sync_object*)obj;
/* If the fence doesn't exist, assume it's signalled. */
if (!so->fence) {
so->b.StatusFlag = GL_TRUE;
return;
}
if (screen->fence_finish(screen, pipe, so->fence, 0)) {
screen->fence_reference(screen, &so->fence, NULL);
so->b.StatusFlag = GL_TRUE;
}
}
static void st_client_wait_sync(struct gl_context *ctx,
struct gl_sync_object *obj,
GLbitfield flags, GLuint64 timeout)
@@ -101,13 +89,22 @@ static void st_client_wait_sync(struct gl_context *ctx,
struct pipe_context *pipe = st_context(ctx)->pipe;
struct pipe_screen *screen = pipe->screen;
struct st_sync_object *so = (struct st_sync_object*)obj;
struct pipe_fence_handle *fence = NULL;
/* If the fence doesn't exist, assume it's signalled. */
mtx_lock(&so->mutex);
if (!so->fence) {
mtx_unlock(&so->mutex);
so->b.StatusFlag = GL_TRUE;
return;
}
/* We need a local copy of the fence pointer, so that we can call
* fence_finish unlocked.
*/
screen->fence_reference(screen, &fence, so->fence);
mtx_unlock(&so->mutex);
/* Section 4.1.2 of OpenGL 4.5 (Compatibility Profile) says:
* [...] if ClientWaitSync is called and all of the following are true:
* - the SYNC_FLUSH_COMMANDS_BIT bit is set in flags,
@@ -120,11 +117,18 @@ static void st_client_wait_sync(struct gl_context *ctx,
* Assume GL_SYNC_FLUSH_COMMANDS_BIT is always set, because applications
* forget to set it.
*/
if (so->fence &&
screen->fence_finish(screen, pipe, so->fence, timeout)) {
if (screen->fence_finish(screen, pipe, fence, timeout)) {
mtx_lock(&so->mutex);
screen->fence_reference(screen, &so->fence, NULL);
mtx_unlock(&so->mutex);
so->b.StatusFlag = GL_TRUE;
}
screen->fence_reference(screen, &fence, NULL);
}
static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
{
st_client_wait_sync(ctx, obj, 0, 0);
}
static void st_server_wait_sync(struct gl_context *ctx,

View File

@@ -126,6 +126,30 @@ setup_index_buffer(struct st_context *st,
}
/**
* Set the restart index.
*/
static void
setup_primitive_restart(struct gl_context *ctx,
const struct _mesa_index_buffer *ib,
struct pipe_draw_info *info)
{
if (ctx->Array._PrimitiveRestart) {
info->restart_index = _mesa_primitive_restart_index(ctx, ib->type);
/* Enable primitive restart only when the restart index can have an
* effect. This is required for correctness in radeonsi VI support.
* Other hardware may also benefit from taking a faster, non-restart path
* when possible.
*/
if ((ib->type == GL_UNSIGNED_INT) ||
(ib->type == GL_UNSIGNED_SHORT && info->restart_index <= 0xffff) ||
(ib->type == GL_UNSIGNED_BYTE && info->restart_index <= 0xff))
info->primitive_restart = true;
}
}
/**
* Translate OpenGL primtive type (GL_POINTS, GL_TRIANGLE_STRIP, etc) to
* the corresponding Gallium type.
@@ -205,8 +229,7 @@ st_draw_vbo(struct gl_context *ctx,
/* The VBO module handles restart for the non-indexed GLDrawArrays
* so we only set these fields for indexed drawing:
*/
info.primitive_restart = ctx->Array._PrimitiveRestart;
info.restart_index = _mesa_primitive_restart_index(ctx, ib->type);
setup_primitive_restart(ctx, ib, &info);
}
else {
/* Transform feedback drawing is always non-indexed. */
@@ -299,6 +322,9 @@ st_indirect_draw_vbo(struct gl_context *ctx,
}
info.indexed = TRUE;
/* Primitive restart is not handled by the VBO module in this case. */
setup_primitive_restart(ctx, ib, &info);
}
info.mode = translate_prim(ctx, mode);
@@ -306,10 +332,6 @@ st_indirect_draw_vbo(struct gl_context *ctx,
info.indirect = st_buffer_object(indirect_data)->buffer;
info.indirect_offset = indirect_offset;
/* Primitive restart is not handled by the VBO module in this case. */
info.primitive_restart = ctx->Array._PrimitiveRestart;
info.restart_index = ctx->Array.RestartIndex;
if (ST_DEBUG & DEBUG_DRAW) {
debug_printf("st/draw indirect: mode %s drawcount %d indexed %d\n",
u_prim_name(info.mode),

View File

@@ -55,6 +55,7 @@
#include "st_glsl_types.h"
#include "st_nir.h"
#include <algorithm>
#define PROGRAM_ANY_CONST ((1 << PROGRAM_STATE_VAR) | \
(1 << PROGRAM_CONSTANT) | \
@@ -2880,6 +2881,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, const struct glsl_type *
assert(type->is_scalar() || type->is_vector());
l->type = type->base_type;
r->type = type->base_type;
if (cond) {
st_src_reg l_src = st_src_reg(*l);
@@ -2940,10 +2942,12 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
} else if (ir->write_mask == 0) {
assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector());
if (ir->lhs->type->is_array() || ir->lhs->type->is_matrix()) {
unsigned num_elements = ir->lhs->type->without_array()->vector_elements;
unsigned num_elements = ir->lhs->type->without_array()->vector_elements;
if (num_elements) {
l.writemask = u_bit_consecutive(0, num_elements);
} else {
/* The type is a struct or an array of (array of) structs. */
l.writemask = WRITEMASK_XYZW;
}
} else {
@@ -5870,6 +5874,29 @@ emit_compute_block_size(const struct gl_program *program,
cp->LocalSize[2]);
}
struct sort_inout_decls {
bool operator()(const struct inout_decl &a, const struct inout_decl &b) const {
return mapping[a.mesa_index] < mapping[b.mesa_index];
}
const GLuint *mapping;
};
/* Sort the given array of decls by the corresponding slot (TGSI file index).
*
* This is for the benefit of older drivers which are broken when the
* declarations aren't sorted in this way.
*/
static void
sort_inout_decls_by_slot(struct inout_decl *decls,
unsigned count,
const GLuint mapping[])
{
sort_inout_decls sorter;
sorter.mapping = mapping;
std::sort(decls, decls + count, sorter);
}
/**
* Translate intermediate IR (glsl_to_tgsi_instruction) to TGSI format.
* \param program the program to translate
@@ -5942,6 +5969,8 @@ st_translate_program(
case PIPE_SHADER_GEOMETRY:
case PIPE_SHADER_TESS_EVAL:
case PIPE_SHADER_TESS_CTRL:
sort_inout_decls_by_slot(program->inputs, program->num_inputs, inputMapping);
for (i = 0; i < program->num_inputs; ++i) {
struct inout_decl *decl = &program->inputs[i];
unsigned slot = inputMapping[decl->mesa_index];
@@ -5994,6 +6023,8 @@ st_translate_program(
case PIPE_SHADER_TESS_EVAL:
case PIPE_SHADER_TESS_CTRL:
case PIPE_SHADER_VERTEX:
sort_inout_decls_by_slot(program->outputs, program->num_outputs, outputMapping);
for (i = 0; i < program->num_outputs; ++i) {
struct inout_decl *decl = &program->outputs[i];
unsigned slot = outputMapping[decl->mesa_index];

View File

@@ -635,11 +635,15 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
wl_display_roundtrip(chain->display->display);
close(fd);
if (!image->buffer)
goto fail_image;
wl_proxy_set_queue((struct wl_proxy *)image->buffer, chain->queue);
wl_buffer_add_listener(image->buffer, &buffer_listener, image);
return VK_SUCCESS;
fail_image:
chain->base.image_fns->free_wsi_image(vk_device, pAllocator,
image->image, image->memory);
@@ -698,6 +702,9 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
if (chain == NULL)
return VK_ERROR_OUT_OF_HOST_MEMORY;
bool alpha = pCreateInfo->compositeAlpha ==
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
chain->base.device = device;
chain->base.destroy = wsi_wl_swapchain_destroy;
chain->base.get_images = wsi_wl_swapchain_get_images;
@@ -707,7 +714,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->surface = surface->surface;
chain->extent = pCreateInfo->imageExtent;
chain->vk_format = pCreateInfo->imageFormat;
chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format, false);
chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format, alpha);
chain->present_mode = pCreateInfo->presentMode;
chain->fifo_ready = true;

View File

@@ -471,6 +471,7 @@ struct x11_swapchain {
xcb_connection_t * conn;
xcb_window_t window;
xcb_gc_t gc;
uint32_t depth;
VkExtent2D extent;
uint32_t image_count;
@@ -625,7 +626,6 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
uint32_t row_pitch;
uint32_t offset;
uint32_t bpp = 32;
uint32_t depth = 24;
int fd;
uint32_t size;
@@ -651,7 +651,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
pCreateInfo->imageExtent.width,
pCreateInfo->imageExtent.height,
row_pitch,
depth, bpp, fd);
chain->depth, bpp, fd);
xcb_discard_reply(chain->conn, cookie.sequence);
int fence_fd = xshmfence_alloc_shm();
@@ -752,18 +752,29 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
if (chain == NULL)
return VK_ERROR_OUT_OF_HOST_MEMORY;
xcb_connection_t *conn = x11_surface_get_connection(icd_surface);
xcb_window_t window = x11_surface_get_window(icd_surface);
xcb_get_geometry_reply_t *geometry =
xcb_get_geometry_reply(conn, xcb_get_geometry(conn, window), NULL);
if (geometry == NULL)
return VK_ERROR_SURFACE_LOST_KHR;
chain->base.device = device;
chain->base.destroy = x11_swapchain_destroy;
chain->base.get_images = x11_get_images;
chain->base.acquire_next_image = x11_acquire_next_image;
chain->base.queue_present = x11_queue_present;
chain->base.image_fns = image_fns;
chain->conn = x11_surface_get_connection(icd_surface);
chain->window = x11_surface_get_window(icd_surface);
chain->conn = conn;
chain->window = window;
chain->depth = geometry->depth;
chain->extent = pCreateInfo->imageExtent;
chain->image_count = num_images;
chain->send_sbc = 0;
free(geometry);
chain->event_id = xcb_generate_id(chain->conn);
xcb_present_select_input(chain->conn, chain->event_id, chain->window,
XCB_PRESENT_EVENT_MASK_CONFIGURE_NOTIFY |