mesa.git
9 years agoi965/cs: Add a binding table entry for gl_NumWorkGroups
Jordan Justen [Thu, 24 Sep 2015 08:20:55 +0000 (01:20 -0700)]
i965/cs: Add a binding table entry for gl_NumWorkGroups

If glDispatchComputeIndirect is used, then the value for this variable
must be read from the indirect BO.

To allow the same generated code to support indirect and
glDispatchCompute, we will also setup a BO for the number of work
groups using the intel_upload_data mechanism. This will only be
required if the gl_NumWorkGroups variable is accessed.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965/cs: Store compute invocation information in brw context
Jordan Justen [Thu, 24 Sep 2015 08:06:56 +0000 (01:06 -0700)]
i965/cs: Store compute invocation information in brw context

We will need this in an atom to setup a surface to read the
gl_NumWorkGroups values from.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965/cs: Re-emit cs_state when surfaces have changed
Jordan Justen [Thu, 24 Sep 2015 07:26:59 +0000 (00:26 -0700)]
i965/cs: Re-emit cs_state when surfaces have changed

Unlike rendering (BINDING_TABLE_POINTERS_*S), compute doesn't have a
binding table pointers command. Instead it is part of the
MEDIA_INTERFACE_DESCRIPTOR structure loaded by the brw_cs_state atom.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965/cs: Re-emit push constants and cs_state on new batches
Jordan Justen [Thu, 24 Sep 2015 07:25:27 +0000 (00:25 -0700)]
i965/cs: Re-emit push constants and cs_state on new batches

We need to re-emit push constansts when a new batch is started since
the push constants are stored in the batch. We also need to re-emit
the MEDIA_INTERFACE_DESCRIPTOR (in brw_cs_state) since it is stored in
the batch.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agomesa/cs: Add MESA_VERBOSE=api support in DispatchCompute*
Jordan Justen [Thu, 24 Sep 2015 07:19:58 +0000 (00:19 -0700)]
mesa/cs: Add MESA_VERBOSE=api support in DispatchCompute*

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoutil: Fix strndup prototype on C++.
Jose Fonseca [Tue, 29 Sep 2015 15:01:22 +0000 (16:01 +0100)]
util: Fix strndup prototype on C++.

Trivial.

9 years agomesa: fix ARRAY_SIZE query for GetProgramResourceiv
Tapani Pälli [Mon, 3 Aug 2015 05:58:20 +0000 (08:58 +0300)]
mesa: fix ARRAY_SIZE query for GetProgramResourceiv

Patch also refactors name length queries which were using array size
in computation, this has to be done in same time to avoid regression in
arb_program_interface_query-resource-query Piglit test.

Fixes rest of the failures with
   ES31-CTS.program_interface_query.no-locations

v2: make additional check only for GS inputs
v3: create helper function for resource name length
    so that it gets calculated only in one place

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
9 years agoglsl: Fix forward NULL dereference coverity warning
Iago Toral Quiroga [Mon, 28 Sep 2015 10:59:35 +0000 (12:59 +0200)]
glsl: Fix forward NULL dereference coverity warning

The comment says that it should be impossible for decl_type to be NULL
here, so don't try to handle the case where it is, simply add an assert.

>>>     CID 1324977:  Null pointer dereferences  (FORWARD_NULL)
>>>     Comparing "decl_type" to null implies that "decl_type" might be null.

No piglit regressions observed.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agoglsl: Fix null return coverity warning
Iago Toral Quiroga [Mon, 28 Sep 2015 10:59:34 +0000 (12:59 +0200)]
glsl: Fix null return coverity warning

Add an assert on the result of as_dereference() not being NULL:

>>>     CID 1324978:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing a null pointer "deref_record->record->as_dereference()".

Since we are introducing a new variable to hold the result of
as_dereference(), take the opportunity to rename deref_record_type to
interface_type and just name the new variable interface_deref, which is
less confusing.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: Fix unused value warning reported by Coverity
Iago Toral Quiroga [Mon, 28 Sep 2015 10:59:33 +0000 (12:59 +0200)]
glsl: Fix unused value warning reported by Coverity

We don't use param in this part of the code, so no point in advancing
the pointer forward:

>>>     CID 1324983:  Code maintainability issues  (UNUSED_VALUE)
>>>     Assigning value from "param->get_next()" to "param" here, but that stored value is overwritten before it can be used.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoutil: implement strndup for WIN32
Samuel Iglesias Gonsalvez [Mon, 28 Sep 2015 12:23:34 +0000 (14:23 +0200)]
util: implement strndup for WIN32

v2:
- Add strndup.h to Makefile.sources (Emil)
- Use calloc instead of malloc (Emil).
- Check if allocation fails (Emil, Jose)
- Add '#pragma once' and include stdlib.h to strndup.h (Jose)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92124
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoglsl: use correct number of uniform blocks in error message
Samuel Iglesias Gonsalvez [Fri, 11 Sep 2015 10:31:10 +0000 (12:31 +0200)]
glsl: use correct number of uniform blocks in error message

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agomesa: rename gl_shader_program's NumUniformBlocks to NumBufferInterfaceBlocks
Samuel Iglesias Gonsalvez [Fri, 11 Sep 2015 10:29:37 +0000 (12:29 +0200)]
mesa: rename gl_shader_program's NumUniformBlocks to NumBufferInterfaceBlocks

Because it counts shader storage blocks too.

v2:
- Use NumBufferInterfaceBlocks instead (Jordan).

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agomain: fix ACTIVE_UNIFORM_BLOCKS value
Samuel Iglesias Gonsalvez [Fri, 11 Sep 2015 08:02:56 +0000 (10:02 +0200)]
main: fix ACTIVE_UNIFORM_BLOCKS value

NumUniformBlocks also counts shader storage blocks.
NumUniformBlocks variable will be renamed in a later patch to avoid
misunderstandings.

v2:

- Modify the condition to use !IsShaderStorage and the list of
  uniform blocks (Timothy)

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agodocs: add news item and link release notes for 11.0.2
Emil Velikov [Mon, 28 Sep 2015 23:22:32 +0000 (00:22 +0100)]
docs: add news item and link release notes for 11.0.2

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodocs: add sha256 checksums for 11.0.2
Emil Velikov [Mon, 28 Sep 2015 23:19:36 +0000 (00:19 +0100)]
docs: add sha256 checksums for 11.0.2

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 4c0b48461269d3ede0c5446d86ebe3e81f16788e)

9 years agodocs: add release notes for 11.0.2
Emil Velikov [Mon, 28 Sep 2015 19:45:37 +0000 (20:45 +0100)]
docs: add release notes for 11.0.2

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 51e0b06d9916e126060c0d218de1aaa4e5a4ce26)

9 years agoi965/gen9: Add a condition for starting pixel in fast copy blit
Anuj Phogat [Fri, 24 Jul 2015 21:52:01 +0000 (14:52 -0700)]
i965/gen9: Add a condition for starting pixel in fast copy blit

This condition restricts the use of fast copy blit to cases
where starting pixel of src and dst is oword (16 byte) aligned.

Many piglit tests (if using fast copy blit in Mesa) failed earlier
because I missed adding this condition.Fast copy blit is currently
enabled for use only with Yf/Ys tiling.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agonouveau: wait to unref the transfer's bo until it's no longer used
Ilia Mirkin [Mon, 28 Sep 2015 19:18:08 +0000 (15:18 -0400)]
nouveau: wait to unref the transfer's bo until it's no longer used

The bo will often come from a slab in which case it doesn't matter. But
for larger allocations this will be in its own bo, and we have to make
sure to wait until it's no longer used in order for it to be freed.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
Tested-by: Marcin Ślusarz <marcin.slusarz@gmail.com>
9 years agonouveau: delay deleting buffer with unflushed fence
Ilia Mirkin [Fri, 25 Sep 2015 23:05:14 +0000 (19:05 -0400)]
nouveau: delay deleting buffer with unflushed fence

If there is an unflushed fence on the bo, then the resource may still be
used in commands built up in the local pushbuf. Flushing can cause all
sorts of unwanted effects, so just free the bo when the relevant fence
is hit.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
Tested-by: Marcin Ślusarz <marcin.slusarz@gmail.com>
9 years agonouveau: be more careful about freeing temporary transfer buffers
Ilia Mirkin [Fri, 25 Sep 2015 20:34:07 +0000 (16:34 -0400)]
nouveau: be more careful about freeing temporary transfer buffers

Deleting a buffer does not flush the command stream. Make sure that we
wait for the copies to finish before deleting the temporary bo.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
Tested-by: Marcin Ślusarz <marcin.slusarz@gmail.com>
9 years agoi965: Rename intel_miptree_get_dimensions_for_image()
Anuj Phogat [Wed, 19 Aug 2015 23:26:59 +0000 (16:26 -0700)]
i965: Rename intel_miptree_get_dimensions_for_image()

This function isn't specific to miptrees. So, drop the "miptree"
from function name.

V3: Add a comment explaining how the 1D Array texture height and
    depth is interpreted by Intel hardware.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoi965/gen9: Fix {src, dst}_pitch alignment check for XY_FAST_COPY_BLT
Anuj Phogat [Tue, 11 Aug 2015 23:36:44 +0000 (16:36 -0700)]
i965/gen9: Fix {src, dst}_pitch alignment check for XY_FAST_COPY_BLT

I misinterpreted the alignmnet restriction in XY_FAST_COPY_BLT earlier.
Instead of checking pitch for 64KB alignmnet we need to check it for
tile widh alignment.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoi965: Fix {src, dst}_pitch alignment check for XY_SRC_COPY_BLT
Anuj Phogat [Tue, 11 Aug 2015 23:31:39 +0000 (16:31 -0700)]
i965: Fix {src, dst}_pitch alignment check for XY_SRC_COPY_BLT

Current code checks the alignment restrictions only for Y tiling.
From Broadwell PRM vol 10:

 "pitch is of 512Byte granularity for Tile-X: This means the tiled-x
  surface pitch can be (512, 1024, 1536, 2048...)/4 (in Dwords)."

This patch adds the restriction for X tiling as well.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoi965: Move conversion of {src, dst}_pitch to dwords outside if/else
Anuj Phogat [Tue, 11 Aug 2015 23:30:34 +0000 (16:30 -0700)]
i965: Move conversion of {src, dst}_pitch to dwords outside if/else

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoi965: Delete temporary variable 'src_pitch'
Anuj Phogat [Tue, 11 Aug 2015 23:26:39 +0000 (16:26 -0700)]
i965: Delete temporary variable 'src_pitch'

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoi965: Use helper function intel_get_tile_dims() in surface setup
Anuj Phogat [Thu, 9 Jul 2015 17:47:17 +0000 (10:47 -0700)]
i965: Use helper function intel_get_tile_dims() in surface setup

It takes care of using the correct tile width if we later use other
tiling patterns for aux miptree.

V2: Remove the comment about using Yf for aux miptree.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoi965: Use intel_get_tile_dims() to get tile masks
Anuj Phogat [Tue, 18 Aug 2015 22:47:13 +0000 (15:47 -0700)]
i965: Use intel_get_tile_dims() to get tile masks

This will require change in the parameters passed to
intel_miptree_get_tile_masks().

V2: Rearrange the order of parameters. (Ben)
    Change the name to intel_get_tile_masks(). (Topi)

V3: Use temporary variables in intel_get_tile_masks()
    for clarity. Fix mask_y computation.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoi965: Add a helper function intel_get_tile_dims()
Anuj Phogat [Tue, 18 Aug 2015 22:48:56 +0000 (15:48 -0700)]
i965: Add a helper function intel_get_tile_dims()

V2:
- Do the tile width/height computations in the new helper
  function and use it later in intel_miptree_get_tile_masks().
- Change the name to intel_get_tile_dims().

V3: Return the tile_h in number of rows in place of bytes.
    Document the units of tile_w, tile_h parameters.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agomesa: Use the effective internal format instead for validation
Eduardo Lima Mitev [Thu, 24 Sep 2015 08:57:43 +0000 (10:57 +0200)]
mesa: Use the effective internal format instead for validation

When validating format+type+internalFormat for texture pixel operations
on GLES3, the effective internal format should be used if the one
specified is an unsized internal format. Page 127, section "3.8 Texturing"
of the GLES 3.0.4 spec says:

    "if internalformat is a base internal format, the effective internal
     format is a sized internal format that is derived from the format and
     type for internal use by the GL. Table 3.12 specifies the mapping of
     format and type to effective internal formats. The effective internal
     format is used by the GL for purposes such as texture completeness or
     type checks for CopyTex* commands. In these cases, the GL is required
     to operate as if the effective internal format was used as the
     internalformat when specifying the texture data."

v2: Per the spec, Luminance8Alpha8, Luminance8 and Alpha8 should not be
considered sized internal formats. Return the corresponding unsize format
instead.

v4: * Improved comments in
      _mesa_es3_effective_internal_format_for_format_and_type().
    * Splitted patch to separate chunk about reordering of
      error_check_subtexture_dimensions() error check, which is not directly
      related with this patch.
v5: Dropped the splitted patch because it was actually a work around 3
    dEQP tests that are buggy:

    dEQP-GLES2.functional.negative_api.texture.texsubimage2d_neg_offset
    dEQP-GLES2.functional.negative_api.texture.texsubimage2d_offset_allowed
    dEQP-GLES2.functional.negative_api.texture.texsubimage2d_neg_wdt_hgt

Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
9 years agomesa: Move _mesa_base_tex_format() from teximage to glformats files
Eduardo Lima Mitev [Thu, 24 Sep 2015 08:57:42 +0000 (10:57 +0200)]
mesa: Move _mesa_base_tex_format() from teximage to glformats files

This function will be needed as part of validating the combination of format,
type and internal format of texture pixel operations, which happens in
glformats files. Specifically, we want to be able to obtain the base format
of a resolved effective internal format, to compare it with the original
internal format passed.

Also, since this function deals solely with GL formats, it fits better in
glformats where the rest of similar format functionality rests.

The function is moved as-is, without any modification.

Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
9 years agomesa: Fix order of format+type and internal format checks for glTexImageXD ops
Eduardo Lima Mitev [Thu, 24 Sep 2015 08:57:41 +0000 (10:57 +0200)]
mesa: Fix order of format+type and internal format checks for glTexImageXD ops

The more specific GLES constrains should be checked after the general
validation performed by _mesa_error_check_format_and_type(). This is also
for consistency with the error checks order of glTexSubImage ops.

v3: The change of order uncovered a bug that regresses a couple of piglit
tests written against OpenGL-ES 1.1 spec, which expects an INVALID_VALUE
instead of the INVALID_ENUM returned by _mesa_error_check_format_and_type()
when an invalid format is passed to glTexImage2D. This version of the patch
accounts for those cases.

Fixes 1 dEQP test:
* dEQP-GLES3.functional.negative_api.texture.teximage2d

Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
9 years agoegl: Fix missing Haiku include path
Alexander von Gluck IV [Sat, 26 Sep 2015 16:49:36 +0000 (11:49 -0500)]
egl: Fix missing Haiku include path

9 years agostate_trackers/hgl: Fix missing include path
Alexander von Gluck IV [Sat, 26 Sep 2015 16:39:09 +0000 (11:39 -0500)]
state_trackers/hgl: Fix missing include path

9 years agoi965/fs: Fix hang on IVB and VLV with image format mismatch.
Francisco Jerez [Wed, 26 Aug 2015 18:59:46 +0000 (21:59 +0300)]
i965/fs: Fix hang on IVB and VLV with image format mismatch.

IVB and VLV hang sporadically when an untyped surface read or write
message is used to access a surface of format other than RAW, as may
happen when there is a mismatch between the format qualifier of the
image uniform and the format of the actual image bound to the
pipeline.  According to the spec this condition gives undefined
results but may not lead to program termination (which is one of the
possible outcomes of the hang).  Fix it by checking at runtime whether
the surface is of the right type.

Fixes the "arb_shader_image_load_store.invalid/format mismatch" piglit
subtest.

Reported-by: Mark Janes <mark.a.janes@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91718
CC: mesa-stable@lists.freedesktop.org
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoclover: Implement clCreateImage?D w/ clCreateImage.
Serge Martin [Sat, 19 Sep 2015 21:16:10 +0000 (23:16 +0200)]
clover: Implement clCreateImage?D w/ clCreateImage.

Remplace clCreateImage2D and clCreateImage3D implementation with call
to clCreateImage.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoclover: Implement CL1.2 clCreateImage().
Serge Martin [Sat, 19 Sep 2015 21:16:09 +0000 (23:16 +0200)]
clover: Implement CL1.2 clCreateImage().

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoclover: Move down canonicalization of memory object flags into validate_flags().
Francisco Jerez [Fri, 18 Sep 2015 16:42:55 +0000 (18:42 +0200)]
clover: Move down canonicalization of memory object flags into validate_flags().

This will be used to share the same logic between buffer and image
creation.

v2: Make memory flag set constants local to validate_flags. (Serge
    Martin)

9 years agodocs: mention ARB_shader_storage_buffer_object on 11.1.0 release notes
Samuel Iglesias Gonsalvez [Fri, 25 Sep 2015 07:52:45 +0000 (09:52 +0200)]
docs: mention ARB_shader_storage_buffer_object on 11.1.0 release notes

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agoglsl: revert "glsl: atomic counters can be declared as buffer-qualified variables"
Iago Toral Quiroga [Mon, 28 Sep 2015 11:56:28 +0000 (13:56 +0200)]
glsl: revert "glsl: atomic counters can be declared as buffer-qualified variables"

This reverts commit 586142658e2927a68c.

The specs are not explicit about any restrictions related to the types allowed
on buffer variables, however, the description of opaque types (like atomic
counters) is in conclict with the purpose of buffer variables:

"The opaque types declare variables that are effectively opaque
 handles to other objects. These objects are
 accessed through built-in functions, not through direct reading or
 writing of the declared variable.
 (...)
 Opaque variables cannot be treated as l-values;(...)"

Also, Mesa is already disallowing opaque types in interface blocks anyway, so
that commit was not really achieving anything.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agogallium/util: avoid unreferencing random memory on buffer alloc failure
Ilia Mirkin [Sat, 26 Sep 2015 17:45:28 +0000 (13:45 -0400)]
gallium/util: avoid unreferencing random memory on buffer alloc failure

Found by Coverity

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Albert Freeman <albertwdfreeman@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agomesa: don't leak interface_name
Ilia Mirkin [Sat, 26 Sep 2015 17:37:02 +0000 (13:37 -0400)]
mesa: don't leak interface_name

Found by Coverity

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agoglsl: fix component size calculation for tessellation and geom shaders
Timothy Arceri [Mon, 28 Sep 2015 01:03:19 +0000 (11:03 +1000)]
glsl: fix component size calculation for tessellation and geom shaders

Broken in commit abdab88b30ab when adding arrays of arrays support

Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agodocs/GL3.txt: fix typo
Boyan Ding [Sun, 27 Sep 2015 09:15:28 +0000 (17:15 +0800)]
docs/GL3.txt: fix typo

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Albert Freeman <albertwdfreeman@gmail.com>
9 years agoi965/gs: Optimize away the EOT write on Gen8+ with static vertex count.
Kenneth Graunke [Fri, 25 Sep 2015 15:21:57 +0000 (08:21 -0700)]
i965/gs: Optimize away the EOT write on Gen8+ with static vertex count.

With static vertex counts, the final EOT write doesn't actually write
any data - it's just there to end the thread.  Typically, the last
thing before ending the thread will be an EmitVertex() call, resulting
in a URB write.  We can just set EOT on that.

Note that this isn't always possible - there might be an intervening
SSBO write/image store, or the URB write may have been in a loop.

shader-db statistics for geometry shaders only:

total instructions in shared programs: 3173 -> 3149 (-0.76%)
instructions in affected programs:     176 -> 152 (-13.64%)
helped:                                8

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/gs: Allow src0 immediates in GS_OPCODE_SET_WRITE_OFFSET.
Kenneth Graunke [Fri, 25 Sep 2015 06:47:29 +0000 (23:47 -0700)]
i965/gs: Allow src0 immediates in GS_OPCODE_SET_WRITE_OFFSET.

GS_OPCODE_SET_WRITE_OFFSET is a MUL with a constant src[1] and special
strides.  We can easily make the generator handle constant src[0]
arguments by instead generating a MOV with the product of both operands.

This isn't necessarily a win in and of itself - instead of a MUL, we
generate a MOV, which should be basically the same cost.  However, we
can probably avoid the earlier MOV to put src[0] into a register.

shader-db statistics for geometry shaders only:

total instructions in shared programs: 3207 -> 3173 (-1.06%)
instructions in affected programs:     3207 -> 3173 (-1.06%)
helped:                                11

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Implement "Static Vertex Count" geometry shader optimization.
Kenneth Graunke [Fri, 25 Sep 2015 01:21:59 +0000 (18:21 -0700)]
i965: Implement "Static Vertex Count" geometry shader optimization.

Broadwell's 3DSTATE_GS contains new "Static Output" and "Static Vertex
Count" fields, which control a new optimization.  Normally, geometry
shaders can output arbitrary numbers of vertices, which means that
resource allocation has to be done on the fly.  However, if the number
of vertices is statically known, the hardware can pre-allocate resources
up front, which is more efficient.

Thanks to the new NIR GS intrinsics, this is easy.  We just call the
function introduced in the previous commit to get the vertex count.
If it obtains a count, we stop emitting the extra 32-bit "Vertex Count"
field in the VUE, and instead fill out the 3DSTATE_GS fields.

Improves performance of Gl32GSCloth by 5.16347% +/- 0.12611% (n=91)
on my Lenovo X250 laptop (Broadwell GT2) at 1024x768.

shader-db statistics for geometry shaders only:

total instructions in shared programs: 3227 -> 3207 (-0.62%)
instructions in affected programs:     242 -> 222 (-8.26%)
helped:                                10

v2: Don't break non-NIR paths (just skip this optimization).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agoi965: Move GS_THREAD_END mlen calculations out of the generator.
Kenneth Graunke [Fri, 25 Sep 2015 03:58:05 +0000 (20:58 -0700)]
i965: Move GS_THREAD_END mlen calculations out of the generator.

The visitor was setting a mlen that was wrong for Broadwell, but the
generator was ignoring it and doing the right thing regardless.  We may
as well move the logic fully into the visitor.  This will be useful in
the next commit as well.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agonir: Add a function to count the number of vertices a GS emits.
Kenneth Graunke [Fri, 25 Sep 2015 00:01:23 +0000 (17:01 -0700)]
nir: Add a function to count the number of vertices a GS emits.

Some hardware (such as Broadwell) can run geometry shaders more
efficiently when the number of vertices emitted is statically known.

This pass provides a way to obtain the constant vertex count, or
-1 indicating that the vertex count is unknown/non-constant.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agoi965: Simplify handling of VUE map changes.
Kenneth Graunke [Sat, 29 Aug 2015 07:33:10 +0000 (00:33 -0700)]
i965: Simplify handling of VUE map changes.

The old code was disasterously complex - spread across multiple atoms
which may not even run, inspecting the dirty bits to try and decide
whether it was necessary to do checks...storing VS information in
brw_context...extra flagging...

This code tripped me and Carl up very badly when working on the
shader cache code.  It's very fragile and hard to maintain.

Now that geometry shaders only depend on their inputs and don't have
to worry about the VS VUE map, we can dramatically simplify this:
just compute the VUE map coming out of the geometry shader stage
in brw_upload_programs.  If it changes, flag it.  Done.

v2: Also check vue_map.separable.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965/gs: Remove the dependency on the VS VUE map.
Kenneth Graunke [Sat, 29 Aug 2015 07:01:15 +0000 (00:01 -0700)]
i965/gs: Remove the dependency on the VS VUE map.

Because we only support geometry shaders in core profile, we can safely
ignore any driver-extending of VS outputs.

Those are:
- Legacy userclipping (doesn't exist in core profile)
- Edgeflag copying (Gen4-5 only, no GS support)
- Point coord replacement (Gen4-5 only, no GS support)
- front/back color hacks (Gen4-5 only, no GS support)

v2: Rebase; leave a comment about why SSO works.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Don't re-layout varyings for separate shader programs.
Kenneth Graunke [Wed, 9 Sep 2015 23:21:56 +0000 (16:21 -0700)]
i965: Don't re-layout varyings for separate shader programs.

Previously, our VUE map code always assigned slots to varyings
sequentially, in one contiguous block.

This was a bad fit for separate shaders - the GS input layout depended
or the VS output layout, so if we swapped out vertex shaders, we might
have to recompile the GS on the fly - which rather defeats the point of
using separate shader objects.  (Tessellation would suffer from this
as well - we could have to recompile the HS, DS, and GS.)

Instead, this patch makes the VUE map for separate shaders use a fixed
layout, based on the input/output variable's location field.  (This is
either specified by layout(location = ...) or assigned by the linker.)
Corresponding inputs/outputs will match up by location; if there's a
mismatch, we're allowed to have undefined behavior.

This may be less efficient - depending what locations were chosen, we
may have empty padding slots in the VUE.  But applications presumably
use small consecutive integers for locations, so it hopefully won't be
much worse in practice.

3% of Dota 2 Reborn shaders are hurt, but only by 2 instructions.
This seems like a small price to pay for avoiding recompiles.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965/vue: Make assign_vue_map() take an explicit slot.
Kenneth Graunke [Wed, 9 Sep 2015 23:09:35 +0000 (16:09 -0700)]
i965/vue: Make assign_vue_map() take an explicit slot.

Our plan of assigning consecutive slots doesn't work properly for
separate shader objects - at least, if we want to avoid recompiling them
whenever the interface changes.

As a first step, make assign_vue_map take an explicit slot parameter,
rather than implicitly incrementing it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Initialize unused VUE map slots to BRW_VARYING_SLOT_PAD.
Kenneth Graunke [Thu, 10 Sep 2015 03:21:59 +0000 (20:21 -0700)]
i965: Initialize unused VUE map slots to BRW_VARYING_SLOT_PAD.

Nothing actually relies on unused slots being initialized to
BRW_VARYING_SLOT_COUNT.  Soon, we're going to have VUE maps with holes
in them, at which point pre-filling with BRW_VARYING_SLOT_PAD make a lot
more sense.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Fix BRW_VARYING_SLOT_PAD handling in the scalar VS backend.
Kenneth Graunke [Thu, 10 Sep 2015 03:23:04 +0000 (20:23 -0700)]
i965: Fix BRW_VARYING_SLOT_PAD handling in the scalar VS backend.

We can't just break for padding slots.  Instead, treat them like
unwritten output variables, so we handle flushing and incrementing
urb_offset correctly.

Paul introduced the concept of padding slots back in 2011, but we've
never actually used them for anything.  So it's unsurprising that the
scalar VS backend didn't handle them quite right.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agomain/tests: Enable glShaderStorageBlockBinding() check in dispatch_sanity test
Samuel Iglesias Gonsalvez [Tue, 15 Sep 2015 06:18:39 +0000 (08:18 +0200)]
main/tests: Enable glShaderStorageBlockBinding() check in dispatch_sanity test

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agodocs: add news item and link release notes for 11.0.1
Emil Velikov [Sat, 26 Sep 2015 13:25:19 +0000 (14:25 +0100)]
docs: add news item and link release notes for 11.0.1

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodocs: add sha256 checksums for 11.0.1
Emil Velikov [Sat, 26 Sep 2015 13:08:52 +0000 (14:08 +0100)]
docs: add sha256 checksums for 11.0.1

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 7f1a77ae664cca29208edc32ff82dc7ff4faa02b)

9 years agodocs: add release notes for 11.0.1
Emil Velikov [Sat, 26 Sep 2015 12:32:07 +0000 (13:32 +0100)]
docs: add release notes for 11.0.1

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit bcb9e1d26ba4198359300b50e5c188977cef932e)

9 years agoglsl: calculate component size for arrays of arrays when varying packing disabled
Timothy Arceri [Sun, 4 May 2014 11:13:25 +0000 (21:13 +1000)]
glsl: calculate component size for arrays of arrays when varying packing disabled

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: validate binding qualifier for AoA
Timothy Arceri [Wed, 27 May 2015 11:33:45 +0000 (21:33 +1000)]
glsl: validate binding qualifier for AoA

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: add helper for calculating size of AoA
Timothy Arceri [Wed, 27 May 2015 11:31:59 +0000 (21:31 +1000)]
glsl: add helper for calculating size of AoA

V2: return 0 if not array rather than -1

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: clean-up link uniform code
Timothy Arceri [Sat, 18 Jul 2015 00:51:51 +0000 (10:51 +1000)]
glsl: clean-up link uniform code

These changes are also needed to allow linking of
struct and interface arrays of arrays.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
9 years agoradeonsi: add scratch buffer to the buffer list when it's re-allocated
Marek Olšák [Thu, 24 Sep 2015 21:50:01 +0000 (23:50 +0200)]
radeonsi: add scratch buffer to the buffer list when it's re-allocated

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Cc: mesa-stable@lists.freedesktop.org
9 years agoradeon/vce: fix vui time_scale zero error
Leo Liu [Fri, 18 Sep 2015 19:51:26 +0000 (15:51 -0400)]
radeon/vce: fix vui time_scale zero error

if app pass 0 as frame_rate_num, it should not be encoded to the VUI.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agomesa: Add locking to programs.
Matt Turner [Thu, 30 Jul 2015 18:25:27 +0000 (11:25 -0700)]
mesa: Add locking to programs.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa: Add locking to sampler objects.
Matt Turner [Fri, 12 Jun 2015 16:07:09 +0000 (09:07 -0700)]
mesa: Add locking to sampler objects.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa: Remove debugging code from _mesa_reference_*.
Matt Turner [Wed, 10 Jun 2015 20:31:06 +0000 (13:31 -0700)]
mesa: Remove debugging code from _mesa_reference_*.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoc11/threads: Assert that mtx is non-NULL and check return values.
Matt Turner [Mon, 29 Jun 2015 17:25:41 +0000 (10:25 -0700)]
c11/threads: Assert that mtx is non-NULL and check return values.

Passing NULL to C11 threads functions isn't safe, so there's no need for
our implementation to handle it. Cuts about 1k of .text.

   text     data      bss      dec      hex  filename
5009514   198440    26328  5234282   4fde6a  i965_dri.so before
5008346   198440    26328  5233114   4fd9da  i965_dri.so after

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoglsl: fix packed varyings interface type and add default case
Tapani Pälli [Fri, 25 Sep 2015 06:56:39 +0000 (09:56 +0300)]
glsl: fix packed varyings interface type and add default case

fixes Piglit test:
   arb_program_interface_query/linker/query-varyings.shader_test

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: Mark as active all elements of shared/std140 block arrays
Antia Puentes [Wed, 29 Jul 2015 14:01:24 +0000 (16:01 +0200)]
glsl: Mark as active all elements of shared/std140 block arrays

Commit 1ca25ab (glsl: Do not eliminate 'shared' or 'std140' blocks
or block members) considered as active 'shared' and 'std140' uniform
blocks and uniform block arrays, but did not include the block array
elements. Because of that, it was possible to have an active uniform
block array without any elements marked as used, making the assertion
   ((b->num_array_elements > 0) == b->type->is_array())
in link_uniform_blocks() fail.

Fixes the following 5 dEQP tests:

 * dEQP-GLES3.functional.ubo.random.nested_structs_instance_arrays.18
 * dEQP-GLES3.functional.ubo.random.nested_structs_instance_arrays.24
 * dEQP-GLES3.functional.ubo.random.nested_structs_arrays_instance_arrays.19
 * dEQP-GLES3.functional.ubo.random.all_per_block_buffers.49
 * dEQP-GLES3.functional.ubo.random.all_shared_buffer.36

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83508
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agodocs: Mark ARB_shader_storage_buffer_object as done for i965
Iago Toral Quiroga [Wed, 13 May 2015 11:37:42 +0000 (13:37 +0200)]
docs: Mark ARB_shader_storage_buffer_object as done for i965

v2:
- Mark it too for GLES 3.1

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Enable ARB_shader_storage_buffer_object extension for gen7+
Samuel Iglesias Gonsalvez [Wed, 18 Mar 2015 06:36:24 +0000 (07:36 +0100)]
i965: Enable ARB_shader_storage_buffer_object extension for gen7+

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agomesa: enable ARB_shader_storage_buffer_object extension for GLES 3.1
Samuel Iglesias Gonsalvez [Tue, 14 Jul 2015 10:23:42 +0000 (12:23 +0200)]
mesa: enable ARB_shader_storage_buffer_object extension for GLES 3.1

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agomesa: Add getters for the GL_ARB_shader_storage_buffer_object max constants
Samuel Iglesias Gonsalvez [Wed, 22 Apr 2015 14:11:13 +0000 (16:11 +0200)]
mesa: Add getters for the GL_ARB_shader_storage_buffer_object max constants

v2:
- Add tessellation shader constants support

v3:
- Add GLES 3.1 support.

v4:
- Move the getters to the proper place

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglapi: add ARB_shader_storage_block_buffer_object
Samuel Iglesias Gonsalvez [Mon, 20 Apr 2015 14:10:44 +0000 (16:10 +0200)]
glapi: add ARB_shader_storage_block_buffer_object

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agomain/tests: add ARB_shader_storage_buffer_object tokens to enum_strings
Samuel Iglesias Gonsalvez [Tue, 21 Apr 2015 06:23:36 +0000 (08:23 +0200)]
main/tests: add ARB_shader_storage_buffer_object tokens to enum_strings

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agomain: Add SHADER_STORAGE_BLOCK and BUFFER_VARIABLE support for ARB_program_interface_...
Samuel Iglesias Gonsalvez [Wed, 6 May 2015 06:11:02 +0000 (08:11 +0200)]
main: Add SHADER_STORAGE_BLOCK and BUFFER_VARIABLE support for ARB_program_interface_query

Including TOP_LEVEL_ARRAY_SIZE and TOP_LEVEL_ARRAY_STRIDE queries.

v2:
- Use std430_array_stride() to get top level array stride following std430's rules.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: Do not allow reads from write-only buffer variables
Iago Toral Quiroga [Tue, 28 Apr 2015 12:25:56 +0000 (14:25 +0200)]
glsl: Do not allow reads from write-only buffer variables

The error location won't be right, but fixing that would require to check
for this as we process each type of AST node that can involve a variable
read.

v2:
  - Limit the check to buffer variables, image variables have different
    semantics involved.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: Do not allow assignments to read-only buffer variables
Iago Toral Quiroga [Wed, 5 Aug 2015 08:30:46 +0000 (10:30 +0200)]
glsl: Do not allow assignments to read-only buffer variables

v2:
  - Merge the error check for the readonly qualifier with the already
    existing check for variables flagged as readonly (Timothy).
  - Limit the check to buffer variables, image variables have different
    semantics involved (Curro).

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: Allow memory qualifiers on shader storage buffer blocks
Samuel Iglesias Gonsalvez [Fri, 8 May 2015 07:41:58 +0000 (09:41 +0200)]
glsl: Allow memory qualifiers on shader storage buffer blocks

v2:
  - Memory qualifiers on shader storage buffer objects do not come in the form
    of layout qualifiers, they are block-level qualifiers.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: Apply memory qualifiers to buffer variables
Iago Toral Quiroga [Tue, 28 Apr 2015 10:09:58 +0000 (12:09 +0200)]
glsl: Apply memory qualifiers to buffer variables

v2:
  - Save memory qualifier info in the top level members of a shader
    storage block.
  - Add a checks to record_compare() which is used when comparing
    shader storage buffer declarations in different shaders.
  - Always report an error for incompatible readonly/writeonly
    definitions, whether they are present at block or field level.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: Allow use of memory qualifiers with ARB_shader_storage_buffer_object.
Iago Toral Quiroga [Tue, 28 Apr 2015 09:27:24 +0000 (11:27 +0200)]
glsl: Allow use of memory qualifiers with ARB_shader_storage_buffer_object.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: fix UNIFORM_BUFFER_START or UNIFORM_BUFFER_SIZE query when no buffer object...
Samuel Iglesias Gonsalvez [Thu, 14 May 2015 05:39:52 +0000 (07:39 +0200)]
glsl: fix UNIFORM_BUFFER_START or UNIFORM_BUFFER_SIZE query when no buffer object is bound

According to ARB_uniform_buffer_object spec:

"If the parameter (starting offset or size) was not specified when the
 buffer object was bound (e.g. if bound with BindBufferBase), or if no
 buffer object is bound to <index>, zero is returned."

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agomesa: Add queries for GL_SHADER_STORAGE_BUFFER
Iago Toral Quiroga [Tue, 28 Apr 2015 08:08:17 +0000 (10:08 +0200)]
mesa: Add queries for GL_SHADER_STORAGE_BUFFER

These handle querying the buffer name attached to a giving binding point
as well as the start offset and size of that buffer.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agomesa: add glShaderStorageBlockBinding()
Samuel Iglesias Gonsalvez [Tue, 21 Apr 2015 14:58:29 +0000 (16:58 +0200)]
mesa: add glShaderStorageBlockBinding()

Defined in ARB_shader_storage_buffer_object extension.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: First argument to atomic functions must be a buffer variable
Iago Toral Quiroga [Fri, 24 Apr 2015 10:34:00 +0000 (12:34 +0200)]
glsl: First argument to atomic functions must be a buffer variable

v2:
  - Add ssbo_in the names of the static functions so it is clear that this
    is specific to SSBO atomics.

v3:
  - Move the check after the loop (Kristian Høgsberg)

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965/nir/vec4: Implement nir_intrinsic_ssbo_atomic_*
Iago Toral Quiroga [Fri, 7 Aug 2015 09:31:13 +0000 (11:31 +0200)]
i965/nir/vec4: Implement nir_intrinsic_ssbo_atomic_*

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965/nir/fs: Implement nir_intrinsic_ssbo_atomic_*
Iago Toral Quiroga [Mon, 1 Jun 2015 07:41:47 +0000 (09:41 +0200)]
i965/nir/fs: Implement nir_intrinsic_ssbo_atomic_*

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agonir: Implement lowered SSBO atomic intrinsics
Iago Toral Quiroga [Mon, 1 Jun 2015 07:40:39 +0000 (09:40 +0200)]
nir: Implement lowered SSBO atomic intrinsics

The original GLSL IR intrinsics have been lowered to an internal
version that accepts a block index and an offset instead of a
SSBO reference.

v2 (Connor):
  - Document the sources used by the atomic intrinsics.

Reviewed-by: Connor Abbott <connor.w.abbott@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: lower SSBO atomic intrinsics
Iago Toral Quiroga [Wed, 8 Jul 2015 13:59:05 +0000 (15:59 +0200)]
glsl: lower SSBO atomic intrinsics

The first argument to SSBO atomics is a reference to a SSBO buffer variable
so we want to compute its block index and offset and provide these values
to an internal version of the intrinsic that takes them instead of the
buffer variable reference.

v2:
- Support single components of integer vectors to be passed in as arguments.
- Get interface packing information from interface's type.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: use ir_rvalue instead of ir_dereference in auxiliary functions
Samuel Iglesias Gonsalvez [Tue, 1 Sep 2015 09:57:07 +0000 (11:57 +0200)]
glsl: use ir_rvalue instead of ir_dereference in auxiliary functions

In a later commit we will need to handle ir_swizzle nodes too, which are
not an ir_dereference. That can happen, for example, when we pass a
component of an integer vector as argument to any of the SSBO atomic
functions.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: Add atomic functions from ARB_shader_storage_buffer_object
Iago Toral Quiroga [Thu, 23 Apr 2015 09:21:54 +0000 (11:21 +0200)]
glsl: Add atomic functions from ARB_shader_storage_buffer_object

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: Rename atomic counter functions
Iago Toral Quiroga [Thu, 23 Apr 2015 09:06:12 +0000 (11:06 +0200)]
glsl: Rename atomic counter functions

Shader Storage Buffer Object will add new atomic functions that are not
associated with counters, so better have atomic counter-specific functions
explicitly include the word "counter" in their names.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: atomic counters can be declared as buffer-qualified variables
Samuel Iglesias Gonsalvez [Wed, 23 Sep 2015 07:04:53 +0000 (09:04 +0200)]
glsl: atomic counters can be declared as buffer-qualified variables

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agonir/glsl_to_nir: ignore an instruction's dest if it hasn't any
Iago Toral Quiroga [Tue, 19 May 2015 07:02:06 +0000 (09:02 +0200)]
nir/glsl_to_nir: ignore an instruction's dest if it hasn't any

Reviewed-by: Connor Abbott <connor.w.abbott@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965/nir/vec4: Implement nir_intrinsic_load_ssbo
Iago Toral Quiroga [Thu, 10 Sep 2015 10:01:02 +0000 (12:01 +0200)]
i965/nir/vec4: Implement nir_intrinsic_load_ssbo

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965/nir/fs: Implement nir_intrinsic_load_ssbo
Iago Toral Quiroga [Mon, 1 Jun 2015 07:28:29 +0000 (09:28 +0200)]
i965/nir/fs: Implement nir_intrinsic_load_ssbo

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agonir: Implement __intrinsic_load_ssbo
Iago Toral Quiroga [Thu, 9 Jul 2015 08:29:18 +0000 (10:29 +0200)]
nir: Implement __intrinsic_load_ssbo

v2:
- Fix ssbo loads with boolean variables.

v3:
- Simplify the changes (Kristian)

Reviewed-by: Connor Abbott <connor.w.abbott@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agonir: modify the instruction insertion in nir_visitor::visit(ir_call *ir)
Samuel Iglesias Gonsalvez [Wed, 23 Sep 2015 06:48:21 +0000 (08:48 +0200)]
nir: modify the instruction insertion in nir_visitor::visit(ir_call *ir)

This patch moves nir_instr_insert_after_cf_list call into each case
in the intrinsics switch at nir_visitor::visit(ir_call *ir) and
define a nir_dest variable which will be used when handling
ir->return_deref after the switch.

This patch simplifies the code for nir_intrinsic_load_ssbo
implementation changes we are going to do next.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>