platform/upstream/mesa.git
7 years agoegl: use designated initializers
Emil Velikov [Fri, 31 Mar 2017 11:08:38 +0000 (12:08 +0100)]
egl: use designated initializers

All the compilers used to build Mesa support them.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoegl: drop unneeded sentinel from level_strings[]
Emil Velikov [Thu, 4 May 2017 18:34:43 +0000 (19:34 +0100)]
egl: drop unneeded sentinel from level_strings[]

The array is local so we already know its size.

v2: Correct loop condition (Bartosz)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoegl: remove suprous header eglcompiler.h
Emil Velikov [Thu, 4 May 2017 17:55:36 +0000 (18:55 +0100)]
egl: remove suprous header eglcompiler.h

The header is used only to provide STATIC_ASSERT. The latter is already
available in utils/macros.h so use that instead and kill of the header.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoegl: remove unneeded else statement in _eglInitLogger
Emil Velikov [Thu, 4 May 2017 18:31:12 +0000 (19:31 +0100)]
egl: remove unneeded else statement in _eglInitLogger

The variable level is already initialized to -1 which is already
interpreted as FALLBACK_LOG_LEVEL.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoegl: remove no longer needed logger infra
Emil Velikov [Thu, 4 May 2017 18:20:17 +0000 (19:20 +0100)]
egl: remove no longer needed logger infra

As of last commit nobody requires anything else but the
_eglDefaultLogger(). As such use it directly and simplify the
implementation.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoegl: fold Android logger into main/
Emil Velikov [Thu, 4 May 2017 18:10:21 +0000 (19:10 +0100)]
egl: fold Android logger into main/

Will allow us to greatly simplify a lot of the code in egllog.c

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoegl: remove unused _eglSetLogLevel()
Emil Velikov [Fri, 31 Mar 2017 11:17:19 +0000 (12:17 +0100)]
egl: remove unused _eglSetLogLevel()

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoglsl: apply the image format for members of structures
Samuel Pitoiset [Sat, 6 May 2017 14:55:47 +0000 (16:55 +0200)]
glsl: apply the image format for members of structures

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: store the image format in glsl_struct_field
Samuel Pitoiset [Sat, 6 May 2017 14:55:46 +0000 (16:55 +0200)]
glsl: store the image format in glsl_struct_field

ARB_bindless_texture allows to declare image types inside
structures, which means we need to keep track of the format.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/glsl_to_tgsi: don't use rzalloc_array() when it's unnecessary
Samuel Pitoiset [Fri, 5 May 2017 09:01:37 +0000 (11:01 +0200)]
st/glsl_to_tgsi: don't use rzalloc_array() when it's unnecessary

When the arrays are initialized later on with -1, that's useless
to use rzalloc_array().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoanv: check return value of anv_execbuf_add_bo
Lionel Landwerlin [Mon, 8 May 2017 08:01:56 +0000 (09:01 +0100)]
anv: check return value of anv_execbuf_add_bo

CID: 1405919 (Error handling issues)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv: avoid null pointer dereference
Lionel Landwerlin [Wed, 3 May 2017 05:06:01 +0000 (22:06 -0700)]
anv: avoid null pointer dereference

The application might not give an output structure.

CID: 1405765 (Null pointer dereferences)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoegl: avoid dereferencing a null display
Eric Engestrom [Sun, 7 May 2017 22:44:12 +0000 (23:44 +0100)]
egl: avoid dereferencing a null display

Fixes: ddb99127a6f6c ("egl/x11: Honor the EGL_PLATFORM_X11_SCREEN_EXT attribute")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agodocs/releasing: added relevant people for build/check with MacOSX
Andres Gomez [Mon, 27 Mar 2017 18:48:16 +0000 (21:48 +0300)]
docs/releasing: added relevant people for build/check with MacOSX

Signed-off-by: Andres Gomez <agomez@igalia.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Jeremy Sequoia <jeremyhu@apple.com>
7 years agodocs/releasing: added relevant people for build/check with Android
Andres Gomez [Fri, 5 May 2017 09:44:16 +0000 (12:44 +0300)]
docs/releasing: added relevant people for build/check with Android

v2: Tapani as main contact and Mauro just for help with
    debugging/building (Mauro).

v3: Mauro my provide feedback for android-x86 only (Mauro).

Signed-off-by: Andres Gomez <agomez@igalia.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Tapani Pälli <tapani.palli@intel.com>
Cc: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs/releasing: added relevant people for build/check with Windows
Andres Gomez [Wed, 3 May 2017 18:14:38 +0000 (21:14 +0300)]
docs/releasing: added relevant people for build/check with Windows

v2: Brian Paul as main contact point and Jose Fonseca as
    fallback (Vinson, Jose)

Signed-off-by: Andres Gomez <agomez@igalia.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Vinson Lee <vlee@freedesktop.org>
Cc: Brian Paul <brianp@vmware.com>
Cc: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
7 years agodocs/releasing: if possible, do some every day use on the RC
Andres Gomez [Mon, 27 Mar 2017 18:48:13 +0000 (21:48 +0300)]
docs/releasing: if possible, do some every day use on the RC

Signed-off-by: Andres Gomez <agomez@igalia.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs/releasing: further explain the build/check testing process
Andres Gomez [Mon, 27 Mar 2017 18:48:12 +0000 (21:48 +0300)]
docs/releasing: further explain the build/check testing process

The build/check test should be done with an appropriate combination of
flags, depending on the changes introduced by the patch set.

Also, mention to cross compile with mingw-w64 for Windows.

Signed-off-by: Andres Gomez <agomez@igalia.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs/releasing: check in master for forgotten nomination candidates
Andres Gomez [Mon, 27 Mar 2017 18:48:11 +0000 (21:48 +0300)]
docs/releasing: check in master for forgotten nomination candidates

The maintanier should not just rely on the mesa-stable@ mailing list
but actually check the master branch in search for suitable nomination
candidates.

Signed-off-by: Andres Gomez <agomez@igalia.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs/releasing: format/style homogenization
Andres Gomez [Mon, 27 Mar 2017 18:48:10 +0000 (21:48 +0300)]
docs/releasing: format/style homogenization

Signed-off-by: Andres Gomez <agomez@igalia.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agobin/get-fixes-pick-list.sh: don't warn if more than one, go over them
Andres Gomez [Sat, 6 May 2017 14:09:35 +0000 (17:09 +0300)]
bin/get-fixes-pick-list.sh: don't warn if more than one, go over them

If an identified commit was having more than one fix, we would warn
about that and only treat the first.

Now, we don't warn but treat all of them.

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoi965: Update gen6_depth_stencil_state to use genX macro.
Rafael Antognolli [Fri, 5 May 2017 18:22:18 +0000 (11:22 -0700)]
i965: Update gen6_depth_stencil_state to use genX macro.

While moving depth stencil state to use genxml, this one was left
behind.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move MOCS macros to brw_state.h.
Rafael Antognolli [Thu, 4 May 2017 18:49:08 +0000 (11:49 -0700)]
i965: Move MOCS macros to brw_state.h.

brw_state.h is a better place to keep them, instead of brw_context.h.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Don't try to unmap NULL program cache BO.
Kenneth Graunke [Thu, 4 May 2017 02:24:32 +0000 (19:24 -0700)]
i965: Don't try to unmap NULL program cache BO.

When running shader-db with intel_stub and recent Mesa, context creation
fails when making a logical hardware context.  In this case, we call
intelDestroyContext(), which gets here and tries to unmap the cache BO.

But there isn't one - we haven't made it yet.  So we try to unmap a
NULL pointer, which used to be safe (it did nothing), but crashes
after commit 7c3b8ed87859bfdfb985d21685115a729f9cd138.

The result is that we crash rather than failing context creation with
a nice message.  Either way nothing works, but this is more polite.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoRevert "mesa: Require mipmap completeness for glCopyImageSubData(), sometimes."
Kenneth Graunke [Fri, 5 May 2017 16:20:56 +0000 (09:20 -0700)]
Revert "mesa: Require mipmap completeness for glCopyImageSubData(), sometimes."

This reverts commit c5bf7cb52942cb7df9f5d73746ffbf3c102d12cc.

This broke rendering in "Total War: WARHAMMER", which uses a single
level RGBA_UINT32 texture and the default filter modes of GL_LINEAR
and GL_NEAREST_MIPMAP_LINEAR.  However, the texture max level is 0,
so it is actually mipmap complete - it's the integer + linear rule
that causes the error.

I'm working with Khronos to find a real solution.  However it turns
out, this patch is not correct and breaks real programs, so let's
revert it for now.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100690
Bugzilla: https://cvs.khronos.org/bugzilla/show_bug.cgi?id=16224
Cc: "17.1" <mesa-stable@lists.freedesktop.org>
7 years agoglsl: destroy function and subroutine hash tables
Grazvydas Ignotas [Tue, 2 May 2017 18:06:50 +0000 (21:06 +0300)]
glsl: destroy function and subroutine hash tables

Just like other type hash tables are destroyed in
_mesa_glsl_release_types(), also destroy the ones for function and
subroutine types.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoradv: fix regression in blit2d push constant change.
Dave Airlie [Sun, 7 May 2017 23:54:49 +0000 (00:54 +0100)]
radv: fix regression in blit2d push constant change.

These were being fed to the shader as floats via the vertex
path, so also push them as floats here.

This fixes missing overlay in Sascha Willems demos.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/meta: cleanup some unused code path
Dave Airlie [Wed, 19 Apr 2017 04:25:19 +0000 (14:25 +1000)]
radv/meta: cleanup some unused code path

After moving everything to using push constants,
these paths are no longer needed.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/meta: port blit to using push constants
Dave Airlie [Wed, 19 Apr 2017 03:27:27 +0000 (13:27 +1000)]
radv/meta: port blit to using push constants

Remove use of vertex buffer.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/meta: move blit2d to using push constants
Dave Airlie [Wed, 19 Apr 2017 03:17:48 +0000 (13:17 +1000)]
radv/meta: move blit2d to using push constants

This allows us to drop the vertex buffer.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/meta: move clear color to using push constants
Dave Airlie [Wed, 19 Apr 2017 00:34:37 +0000 (10:34 +1000)]
radv/meta: move clear color to using push constants

The color clear value is uniform and needs only to be emitted from
the frag shader, so just push it down via a push constant,
and remove the vertex buffer completely.

The depth clear value needs to be emitted from the vertex
shader, but is only a single value.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/meta: use novertex save path for resolve pass.
Dave Airlie [Wed, 19 Apr 2017 03:29:21 +0000 (13:29 +1000)]
radv/meta: use novertex save path for resolve pass.

This was missing in the original change.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: set base/ranges for push constant loads.
Dave Airlie [Fri, 5 May 2017 00:42:40 +0000 (10:42 +1000)]
radv: set base/ranges for push constant loads.

This isn't necessary yet but I'd like to use the range in
some future patches.

[airlied: add new resolve pass]
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: drop resolve hack workarounds
Dave Airlie [Fri, 28 Apr 2017 07:06:09 +0000 (08:06 +0100)]
radv: drop resolve hack workarounds

This drops the resolve workarounds that change an image
tiling mode behinds it's back, this is horrible and breaks
the image_view->image relationship. Remove all this.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/meta: select resolve paths
Dave Airlie [Fri, 28 Apr 2017 02:56:25 +0000 (03:56 +0100)]
radv/meta: select resolve paths

There are 3 resolve paths, the fastest being the hw resolver
but it has restriction on tile modes and can't do subresolves,
the compute resolver is next speed wise, but can't handle DCC
destinations, the fragment resolver handles that case.

This will end up with a slow down as currently we hack the
hw resolver paths when they shouldn't work, but we shouldn't
keep doing that.

The next patch removes the hacks.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/meta: add resolve pass using fragment/vertex shaders
Dave Airlie [Thu, 27 Apr 2017 00:47:22 +0000 (01:47 +0100)]
radv/meta: add resolve pass using fragment/vertex shaders

In order to resolve into DCC enabled dests we need to use
the fragment shader. This reuses the code from the compute
path and implements a resolve path in vertex/fragment shader.

This code isn't used until later.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: add subpass resolve compute path
Dave Airlie [Thu, 4 May 2017 03:02:08 +0000 (04:02 +0100)]
radv: add subpass resolve compute path

This adds a path to allow compute resolves to be used
for subpass resolves.

This isn't used yet, but will be later.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/resolve: split resolve emission out for compute
Dave Airlie [Thu, 4 May 2017 03:01:35 +0000 (04:01 +0100)]
radv/resolve: split resolve emission out for compute

This will allow to add a subpass compute resolve path.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/meta: split out core part of resolve shader
Dave Airlie [Wed, 3 May 2017 03:23:04 +0000 (04:23 +0100)]
radv/meta: split out core part of resolve shader

I want to reuse the same code for the fragment shader
version of the resolve shaders.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/meta: add srgb conversion to end of resolve shader.
Dave Airlie [Thu, 20 Apr 2017 03:42:26 +0000 (04:42 +0100)]
radv/meta: add srgb conversion to end of resolve shader.

If we are resolving into an srgb dest, we need to convert
to linear so the store does the conversion back.

This should fix some wierdness seen when we subresolves
hit the compute path.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agonir: Fix missing snprintf symbol on Windows.
Jose Fonseca [Sun, 7 May 2017 16:58:56 +0000 (17:58 +0100)]
nir: Fix missing snprintf symbol on Windows.

Copy nir_print.c's snprintf definition for now, to unbreak Windows
builds.

We can and should cleanup all snprintf definitions in a follow up
change, but I rather not leave Windows build broken any further.

Trivial.

7 years agonv50/ir: Replace NV50_PROGRAM_IR_* by PIPE_SHADER_IR_*
Pierre Moreau [Sat, 6 May 2017 21:47:23 +0000 (23:47 +0200)]
nv50/ir: Replace NV50_PROGRAM_IR_* by PIPE_SHADER_IR_*

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonv50/ir: Remove unused translation methods
Pierre Moreau [Sat, 6 May 2017 21:47:22 +0000 (23:47 +0200)]
nv50/ir: Remove unused translation methods

This code was merged commented out, and has stayed that way ever since.

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonv50/ir: Free target if we failed to create a program
Pierre Moreau [Sat, 6 May 2017 21:47:21 +0000 (23:47 +0200)]
nv50/ir: Free target if we failed to create a program

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonv50/ir: Fail if encountering unknown shader type
Pierre Moreau [Sat, 6 May 2017 21:47:20 +0000 (23:47 +0200)]
nv50/ir: Fail if encountering unknown shader type

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agoradv: set PERF_MOD in sample state like radeonsi.
Dave Airlie [Fri, 28 Apr 2017 06:17:10 +0000 (07:17 +0100)]
radv: set PERF_MOD in sample state like radeonsi.

This just aligns the code with radeonsi.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: apply the tess+GS hang workaround to Polaris12 as well
Dave Airlie [Sat, 6 May 2017 20:14:11 +0000 (21:14 +0100)]
radv: apply the tess+GS hang workaround to Polaris12 as well

As I pointed out for radeonsi, and AMD confirmed, so fix this
in radv as well.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agomesa: small texture targetIndex tidy up
Timothy Arceri [Thu, 4 May 2017 06:53:56 +0000 (16:53 +1000)]
mesa: small texture targetIndex tidy up

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: fix broken indentation
Timothy Arceri [Thu, 4 May 2017 06:36:40 +0000 (16:36 +1000)]
mesa: fix broken indentation

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: some C99 tidy ups
Timothy Arceri [Thu, 4 May 2017 06:14:33 +0000 (16:14 +1000)]
mesa: some C99 tidy ups

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add KHR_no_error support to copy buffer subdata functions
Timothy Arceri [Thu, 4 May 2017 04:48:02 +0000 (14:48 +1000)]
mesa: add KHR_no_error support to copy buffer subdata functions

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: remove _mesa from static function
Timothy Arceri [Thu, 4 May 2017 04:32:28 +0000 (14:32 +1000)]
mesa: remove _mesa from static function

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agost/mesa: stop calling _mesa_init_buffer_object_functions()
Timothy Arceri [Thu, 4 May 2017 04:23:16 +0000 (14:23 +1000)]
st/mesa: stop calling _mesa_init_buffer_object_functions()

After calling this we were then overriding all the functions with
st versions.

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: make _mesa_buffer_storage() static
Timothy Arceri [Thu, 4 May 2017 04:06:57 +0000 (14:06 +1000)]
mesa: make _mesa_buffer_storage() static

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: make _mesa_copy_buffer_sub_data() static
Timothy Arceri [Thu, 4 May 2017 04:02:10 +0000 (14:02 +1000)]
mesa: make _mesa_copy_buffer_sub_data() static

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: make _mesa_clear_buffer_sub_data() static
Timothy Arceri [Thu, 4 May 2017 03:59:29 +0000 (13:59 +1000)]
mesa: make _mesa_clear_buffer_sub_data() static

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add KHR_no_error support for flush mapped buffer functions
Timothy Arceri [Thu, 4 May 2017 03:49:02 +0000 (13:49 +1000)]
mesa: add KHR_no_error support for flush mapped buffer functions

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: make _mesa_flush_mapped_buffer_range() static
Timothy Arceri [Thu, 4 May 2017 03:39:59 +0000 (13:39 +1000)]
mesa: make _mesa_flush_mapped_buffer_range() static

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add KHR_no_error support for unmap buffer functions
Timothy Arceri [Thu, 4 May 2017 03:31:27 +0000 (13:31 +1000)]
mesa: add KHR_no_error support for unmap buffer functions

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: split unmap_buffer() in two
Timothy Arceri [Thu, 4 May 2017 03:26:45 +0000 (13:26 +1000)]
mesa: split unmap_buffer() in two

This will allow us to implement KHR_no_error support for unmap
functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: make _mesa_unmap_buffer() static
Timothy Arceri [Thu, 4 May 2017 03:14:27 +0000 (13:14 +1000)]
mesa: make _mesa_unmap_buffer() static

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add KHR_no_error support for some map buffer functions
Timothy Arceri [Thu, 4 May 2017 03:08:57 +0000 (13:08 +1000)]
mesa: add KHR_no_error support for some map buffer functions

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: split out validation from map_buffer_range()
Timothy Arceri [Thu, 4 May 2017 02:28:09 +0000 (12:28 +1000)]
mesa: split out validation from map_buffer_range()

This will allow us to add KHR_no_error support for *BufferRange
functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: make map_buffer_range() static
Timothy Arceri [Thu, 4 May 2017 02:16:48 +0000 (12:16 +1000)]
mesa: make map_buffer_range() static

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agoi965: Drop BRW_NEW_BLORP from 3DSTATE_VF atom.
Kenneth Graunke [Thu, 4 May 2017 08:25:21 +0000 (01:25 -0700)]
i965: Drop BRW_NEW_BLORP from 3DSTATE_VF atom.

BLORP doesn't program 3DSTATE_VF, since it doesn't use index buffers,
making the setting irrelevant.  So there's no need to re-emit it after
a BLORP operation - the old setting will still be in place.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Port 3DSTATE_VF to genxml and simplify the implementation.
Kenneth Graunke [Thu, 4 May 2017 08:17:29 +0000 (01:17 -0700)]
i965: Port 3DSTATE_VF to genxml and simplify the implementation.

The whole "it might be used for non-indexed draws" thing is no longer
true - it turns out this was a mistake, and removed in OpenGL 4.5.
(See Marek's commit 96cbc1ca29e0b1f4f4d6c868b8449999aecb9080.)  So
we can simplify this and just program 0 for non-indexed draws.

We can also use #if blocks to remove the atom on Ivybridge/Baytrail,
now that they have a separate atom list from Haswell.  No more runtime
checks.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agomesa: Simplify _mesa_primitive_restart_index().
Kenneth Graunke [Thu, 4 May 2017 08:08:25 +0000 (01:08 -0700)]
mesa: Simplify _mesa_primitive_restart_index().

We can use a simple shift equation rather than a switch statement.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoRevert "radeonsi: constify a bunch of the perfcounter structs."
Marek Olšák [Sat, 6 May 2017 19:15:53 +0000 (21:15 +0200)]
Revert "radeonsi: constify a bunch of the perfcounter structs."

This reverts commit 7088b655e8828bb960f528dd33132de27c505b8f.

It breaks performance counters. If you use them with this commit, they hang
the machine hard. Sysrq and ssh don't work.

7 years agoRevert "radeonsi: fix build with GCC 4.8"
Marek Olšák [Sat, 6 May 2017 19:15:51 +0000 (21:15 +0200)]
Revert "radeonsi: fix build with GCC 4.8"

This reverts commit 485ece83aceb3a35792efbc6fe2bca57ba46c04a.

It's needed to revert 7088b655e8828bb960f528dd33132de27c505b8f.

7 years agofreedreno/a3xx: fix hang w/ large render targets and small gmem
Rob Clark [Sat, 6 May 2017 18:00:35 +0000 (14:00 -0400)]
freedreno/a3xx: fix hang w/ large render targets and small gmem

Possibly other gen's have a similar limit.  Fixes glmark2 -b shadow
with larger resolutions on devices with small gmem (for example,
fullscreen 1080p on 8x16/db410c).

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agofreedreno/ir3: add macro to declare variable length arrays
Rob Clark [Thu, 4 May 2017 18:57:48 +0000 (14:57 -0400)]
freedreno/ir3: add macro to declare variable length arrays

We have enough of these, that we should stop open coding this.

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agoglsl: skip tree grafting for sampler and image types
Nicolai Hähnle [Wed, 26 Apr 2017 16:34:27 +0000 (18:34 +0200)]
glsl: skip tree grafting for sampler and image types

v2: - use is_sampler()/is_image() instead (Samuel Pitoiset)

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: teach lower_ubo_reference about samplers inside structures
Samuel Pitoiset [Mon, 1 May 2017 13:53:56 +0000 (15:53 +0200)]
glsl: teach lower_ubo_reference about samplers inside structures

In a situation like:

(tex vec4 (record_ref (var_ref f)  tex)  (constant vec2 (0.000000 0.000000))  0 1 () )

The sampler needs to be lowered, otherwise this ends up with
"ir_dereference_variable @ 0x229a100 specifies undeclared variable
`ubo_load_temp' @ 0x2290440"

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: link bindless layout qualifiers
Samuel Pitoiset [Tue, 21 Mar 2017 12:31:05 +0000 (13:31 +0100)]
glsl: link bindless layout qualifiers

From section 4.4.6 of the ARB_bindless_texture spec:

   "If both bindless_sampler and bound_sampler, or bindless_image
    and bound_image, are declared at global scope in any
    compilation unit, a link- time error will be generated."

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: do not count bindless samplers/images when linking uniforms
Samuel Pitoiset [Wed, 19 Apr 2017 19:57:02 +0000 (21:57 +0200)]
glsl: do not count bindless samplers/images when linking uniforms

From section 2.14.8 of the ARB_bindless_texture spec:

    "(modify second paragraph, p. 126) ... against the
     MAX_COMBINED_TEXTURE_IMAGE_UNITS limit.  Samplers accessed
     using texture handles (section 3.9.X) are not counted against
     this limit."

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: lower bindless sampler/image packed varyings
Samuel Pitoiset [Fri, 21 Apr 2017 12:37:24 +0000 (14:37 +0200)]
glsl: lower bindless sampler/image packed varyings

v3: - rebase (and remove (sampler) ? 1 : vector_elements)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: implement ARB_bindless_texture conversions
Samuel Pitoiset [Fri, 21 Apr 2017 13:27:15 +0000 (15:27 +0200)]
glsl: implement ARB_bindless_texture conversions

From section 5.4.1 of the ARB_bindless_texture spec:

   "In the following four constructors, the low 32 bits of the
    sampler type correspond to the .x component of the uvec2 and
    the high 32 bits correspond to the .y component."

    uvec2(any sampler type)     // Converts a sampler type to a
                                //   pair of 32-bit unsigned integers
    any sampler type(uvec2)     // Converts a pair of 32-bit unsigned integers to
                                //   a sampler type
    uvec2(any image type)       // Converts an image type to a
                                //   pair of 32-bit unsigned integers
    any image type(uvec2)       // Converts a pair of 32-bit unsigned integers to
                                //   an image type

v4: - fix up comment style
v3: - rebase (and remove (sampler) ? 1 : vector_elements)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: allow bindless samplers/images to be used with constructors
Samuel Pitoiset [Fri, 21 Apr 2017 16:45:42 +0000 (18:45 +0200)]
glsl: allow bindless samplers/images to be used with constructors

For the explicit conversions.

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers are represented using 64-bit integer handles, and
    may be converted to and from 64-bit integers using constructors."

From section 4.1.X of the ARB_bindless_texture spec:

   "Images are represented using 64-bit integer handles, and
    may be converted to and from 64-bit integers using constructors."

v3: - add spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> (v2)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add is_valid_constructor() helper function
Samuel Pitoiset [Fri, 21 Apr 2017 14:31:52 +0000 (16:31 +0200)]
glsl: add is_valid_constructor() helper function

This will help for the explicit conversions for sampler and
image types as specified by ARB_bindless_texture.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add ARB_bindless_texture operations
Samuel Pitoiset [Fri, 21 Apr 2017 12:35:32 +0000 (14:35 +0200)]
glsl: add ARB_bindless_texture operations

For the explicit pack/unpack conversions.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images to be initialized
Samuel Pitoiset [Fri, 21 Apr 2017 17:27:16 +0000 (19:27 +0200)]
glsl: allow bindless samplers/images to be initialized

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers may be declared as shader inputs and outputs, as uniform
    variables, as temporary variables, and as function parameters."

From section 4.1.X of the ARB_bindless_texture spec:

   "Images may be declared as shader inputs and outputs, as uniform
    variables, as temporary variables, and as function parameters."

v3: - add spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images to be l-values
Samuel Pitoiset [Wed, 19 Apr 2017 16:39:38 +0000 (18:39 +0200)]
glsl: allow bindless samplers/images to be l-values

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers can be used as l-values, so can be assigned into and
   used as "out" and "inout" function parameters."

From section 4.1.X of the ARB_bindless_texture spec:

   "Images can be used as l-values, so can be assigned into and
    used as "out" and "inout" function parameters."

v4: - invert the logic
v3: - update spec comment formatting
    - keep the read_only check

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add _mesa_glsl_parse_state object to is_lvalue()
Samuel Pitoiset [Wed, 19 Apr 2017 16:08:28 +0000 (18:08 +0200)]
glsl: add _mesa_glsl_parse_state object to is_lvalue()

Yes, this is a bit hacky but we don't really have the choice.
Plain GLSL doesn't accept bindless samplers/images as l-values
while it's allowed when ARB_bindless_texture is enabled.

The default NULL parameter is because we can't access the
_mesa_glsl_parse_state object in few places in the compiler.
One is_lvalue(NULL) call is for IR validation but other checks
happen elsewhere, should be safe.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: relax bindless sampler arrays indexing
Samuel Pitoiset [Wed, 19 Apr 2017 16:52:54 +0000 (18:52 +0200)]
glsl: relax bindless sampler arrays indexing

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers aggregated into arrays within a shader (using square
    brackets []) can be indexed with arbitrary integer expressions."

v3: - update spec comment formatting

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: reject bindless samplers/images frag inputs without 'flat'
Samuel Pitoiset [Wed, 22 Mar 2017 17:34:23 +0000 (18:34 +0100)]
glsl: reject bindless samplers/images frag inputs without 'flat'

From section 4.3.4 of the ARB_bindless_texture spec

   "(modify last paragraph, p. 35, allowing samplers and images as
    fragment shader inputs) ... Fragment inputs can only be signed
    and unsigned integers and integer vectors, floating point scalars,
    floating-point vectors, matrices, sampler and image types, or
    arrays or structures of these.  Fragment shader inputs that are
    signed or unsigned integers, integer vectors, or any
    double-precision floating- point type, or any sampler or image
    type must be qualified with the interpolation qualifier "flat"."

v3: - update spec comment formatting

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images as vertex shader inputs
Samuel Pitoiset [Mon, 20 Mar 2017 20:37:03 +0000 (21:37 +0100)]
glsl: allow bindless samplers/images as vertex shader inputs

From section 4.3.4 of the ARB_bindless_texture spec:

   "(modify third paragraph of the section to allow sampler and
    image types) ...  Vertex shader inputs can only be float,
    single-precision floating-point scalars, single-precision
    floating-point vectors, matrices, signed and unsigned integers
    and integer vectors, sampler and image types."

v3: - update spec comment formatting

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images as varying variables
Samuel Pitoiset [Wed, 22 Mar 2017 17:16:10 +0000 (18:16 +0100)]
glsl: allow bindless samplers/images as varying variables

From section 4.3.4 of the ARB_bindless_texture spec:

   "(modify third paragraph of the section to allow sampler and image
    types) ...  Vertex shader inputs can only be float,
    single-precision floating-point scalars, single-precision
    floating-point vectors, matrices, signed and unsigned integers
    and integer vectors, sampler and image types."

From section 4.3.6 of the ARB_bindless_texture spec:

   "Output variables can only be floating-point scalars,
    floating-point vectors, matrices, signed or unsigned integers or
    integer vectors, sampler or image types, or arrays or structures
    of any these."

v3: - add spec comment

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow input memory qualifiers for images
Samuel Pitoiset [Mon, 3 Apr 2017 14:06:40 +0000 (16:06 +0200)]
glsl: allow input memory qualifiers for images

ARB_bindless_texture spec allows images to be declared as
shader inputs.

v2: - put the */ on the following line (Timothy Arceri)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow image qualifiers inside structures
Samuel Pitoiset [Fri, 7 Apr 2017 12:34:55 +0000 (14:34 +0200)]
glsl: allow image qualifiers inside structures

ARB_bindless_texture allows to declare images inside structures
which means that qualifiers like writeonly should be allowed.

I have a got a confirmation from Jeff Bolz (one author of the spec),
because the spec doesn't clearly explain this.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless images to be declared inside structures
Samuel Pitoiset [Wed, 19 Apr 2017 14:44:19 +0000 (16:44 +0200)]
glsl: allow bindless images to be declared inside structures

The spec doesn't clearly state this, but I have got clarification
from the spec authors.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images inside interface blocks
Samuel Pitoiset [Wed, 19 Apr 2017 14:46:14 +0000 (16:46 +0200)]
glsl: allow bindless samplers/images inside interface blocks

From section 4.3.7 of the ARB_bindless_texture spec:

   "(remove the following bullet from the last list on p. 39, thereby
    permitting sampler types in interface blocks; image types are also
    permitted in blocks by this extension)"

    * sampler types are not allowed

v3: - update the spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images as function return
Samuel Pitoiset [Wed, 19 Apr 2017 14:40:38 +0000 (16:40 +0200)]
glsl: allow bindless samplers/images as function return

The ARB_bindless_texture spec doesn't clearly state this, but as
it says "Replace Section 4.1.7 (Samplers), p. 25" and,
"Replace Section 4.1.X, (Images)", this should be allowed.

v3: - add spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images as out and inout parameters
Samuel Pitoiset [Wed, 19 Apr 2017 14:38:39 +0000 (16:38 +0200)]
glsl: allow bindless samplers/images as out and inout parameters

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers can be used as l-values, so can be assigned into and used
    as "out" and "inout" function parameters."

From section 4.1.X of the ARB_bindless_texture spec:

   "Images can be used as l-values, so can be assigned into and used as
    "out" and "inout" function parameters."

v3: - add spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow to declare bindless samplers/images as non-uniform
Samuel Pitoiset [Wed, 19 Apr 2017 11:43:29 +0000 (13:43 +0200)]
glsl: allow to declare bindless samplers/images as non-uniform

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers may be declared as shader inputs and outputs, as uniform
    variables, as temporary variables, and as function parameters."

From section 4.1.X of the ARB_bindless_texture spec:

   "Images may be declared as shader inputs and outputs, as uniform
    variables, as temporary variables, and as function parameters."

v3: - add validate_storage_for_sampler_image_types()
    - update spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: process bindless/bound layout qualifiers
Samuel Pitoiset [Tue, 21 Mar 2017 12:30:49 +0000 (13:30 +0100)]
glsl: process bindless/bound layout qualifiers

This adds bindless_sampler and bound_sampler (and respectively
bindless_image and bound_image) to the parser.

v3: - add an extra space in apply_bindless_qualifier_to_variable()
    - fix indentation in merge_qualifier()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: do not make sampler/image types readonly variables
Samuel Pitoiset [Thu, 27 Apr 2017 11:45:16 +0000 (13:45 +0200)]
glsl: do not make sampler/image types readonly variables

In plain GLSL, sampler and image types can only be declared
uniform-qualified global variables or 'in' function parameters.

Setting the read_only flag seems quite useless because other
checks will prevent sampler/image variables to be assigned and
also because the flag is not set for atomic_uint types which are
opaque types.

This will also help for ARB_bindless_texture because samplers
and images can be assigned when they are considered bindless.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: make sampler/image scalar types
Samuel Pitoiset [Wed, 26 Apr 2017 14:02:32 +0000 (16:02 +0200)]
glsl: make sampler/image scalar types

As a side effect, this will magically fix std140/std430 interfaces
for bindless samplers/images and will help for implementing the
explicit conversions with constructors.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: make count_attribute_slots() returns 1 for samplers/images
Samuel Pitoiset [Mon, 1 May 2017 20:24:52 +0000 (22:24 +0200)]
glsl: make count_attribute_slots() returns 1 for samplers/images

For packed varyings.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: make component_slots() returns 2 for samplers/images
Samuel Pitoiset [Thu, 20 Apr 2017 12:42:49 +0000 (14:42 +0200)]
glsl: make component_slots() returns 2 for samplers/images

Bindless samplers/images are 64-bit unsigned integers, which
means they consume two components as specified by
ARB_bindless_texture.

It looks like we are not wasting uniform storage by changing
this because default-block uniforms are not packed. So, if
we use N uint uniforms, they occupy N * 16 bytes in the
constant buffer. This is something that could be improved.

Though, count_uniform_size needs to be adjusted to not count
a sampler (or image) twice.

As a side effect, this will probably break the cache if you
have one because it will consider sampler/image types as
two components.

v3: - update the comments

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: make sampler/image types as 64-bit
Samuel Pitoiset [Thu, 20 Apr 2017 17:13:50 +0000 (19:13 +0200)]
glsl: make sampler/image types as 64-bit

The ARB_bindless_texture spec says:

   "Samplers are represented using 64-bit integer handles."

and,

   "Images are represented using 64-bit integer handles."

It seems simpler to always consider sampler and image types
as 64-bit unsigned integer.

This introduces a temporary workaround in _mesa_get_uniform()
because at this point no flag are used to distinguish between
bound and bindless samplers. This is going to be removed in a
separate series. This avoids breaking arb_shader_image_load_store-state.

v3: - update the comment slightly

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>