mesa.git
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 years agoi965/nir/vec4: Implement nir_intrinsic_store_ssbo
Iago Toral Quiroga [Thu, 10 Sep 2015 10:00:04 +0000 (12:00 +0200)]
i965/nir/vec4: Implement nir_intrinsic_store_ssbo

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

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

v2 (Connor):
 - Make the STORE() macro take arguments for the extra sources (and their
   size) and any extra indices required.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965/vec4: Import surface message builder functions.
Francisco Jerez [Sat, 1 Aug 2015 14:15:36 +0000 (17:15 +0300)]
i965/vec4: Import surface message builder functions.

Implement helper functions that can be used to construct and send
untyped and typed surface read, write and atomic messages to the
shared dataport unit.

v2: Split from the FS implementation.
v3: Rewrite to avoid evil array_reg, emit_collect and emit_zip.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965/vec4: Import helpers to convert vectors into arrays and back.
Francisco Jerez [Tue, 28 Apr 2015 23:12:27 +0000 (02:12 +0300)]
i965/vec4: Import helpers to convert vectors into arrays and back.

These functions handle the conversion of a vec4 into the form expected
by the dataport unit in message and message return payloads.  The
conversion is not always trivial because some messages don't support
SIMD4x2 for some generations, in which case a strided copy may be
necessary.

v2: Split from the FS implementation.
v3: Rewrite to avoid evil array_reg, emit_collect and emit_zip.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965/vec4: Introduce VEC4 IR builder.
Francisco Jerez [Fri, 24 Apr 2015 14:42:55 +0000 (17:42 +0300)]
i965/vec4: Introduce VEC4 IR builder.

See "i965/fs: Introduce FS IR builder." for the rationale.

v2: Drop scalarizing VEC4 builder.
v3: Take a backend_shader as constructor argument.  Improve handling
    of debug annotations and execution control flags.  Rename "instr"
    variable.  Initialize cursor to NULL by default and add method to
    explicitly point the builder at the end of the program.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: shader storage blocks use different max block size values than uniforms
Samuel Iglesias Gonsalvez [Tue, 23 Jun 2015 06:53:36 +0000 (08:53 +0200)]
glsl: shader storage blocks use different max block size values than uniforms

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: ignore buffer variables when counting uniform components
Samuel Iglesias Gonsalvez [Fri, 15 May 2015 10:26:42 +0000 (12:26 +0200)]
glsl: ignore buffer variables when counting uniform components

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>
8 years agoglsl: number of active shader storage blocks must be within allowed limits
Samuel Iglesias Gonsalvez [Wed, 22 Apr 2015 14:58:45 +0000 (16:58 +0200)]
glsl: number of active shader storage blocks must be within allowed limits

Notice that we should differentiate between shader storage blocks and
uniform blocks, since they have different limits.

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>
8 years agoglsl: a shader storage buffer must be smaller than the maximum size allowed
Samuel Iglesias Gonsalvez [Tue, 21 Apr 2015 10:12:05 +0000 (12:12 +0200)]
glsl: a shader storage buffer must be smaller than the maximum size allowed

Otherwise, generate a link time error as per the
ARB_shader_storage_buffer_object spec.

v2:
- Fix error message (Jordan)

v3:
- Move std140_size() changes to its own patch (Kristian)

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>
8 years agoglsl: add std430 interface packing support to ssbo related operations
Samuel Iglesias Gonsalvez [Mon, 13 Apr 2015 07:50:53 +0000 (09:50 +0200)]
glsl: add std430 interface packing support to ssbo related operations

v2:
- Get interface packing information from interface's type, not the
  variable type.
- Simplify is_std430 condition in emit_access() for readability (Jordan)
- Add a commment explaing why array of three-component vector case is
  different in std430 than the rest of cases.
- Add calls to std430_array_stride().

v3:
- Simplify size_mul change for std430's case (Jordan)
- Fix commit log lines length (Jordan)
- Pass 'packing' instead of 'is_std430' to emit_access() (Kristian)

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>
8 years agoglsl: Add std430 support to program_resource_visitor's member functions
Samuel Iglesias Gonsalvez [Fri, 4 Sep 2015 15:53:48 +0000 (17:53 +0200)]
glsl: Add std430 support to program_resource_visitor's member functions

They are used to calculate the offset, array stride of uniform/shader
storage buffer variables. Take into account this info to get the right
value for std430.

v2:
- Fix commit log line length and indention. (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>
8 years agoglsl: Add parser/compiler support for std430 interface packing qualifier
Samuel Iglesias Gonsalvez [Mon, 31 Aug 2015 05:45:53 +0000 (07:45 +0200)]
glsl: Add parser/compiler support for std430 interface packing qualifier

v2:
- Fix a missing check in has_layout()

v3:
- Mention shader storage block in error message for layout qualifiers
  (Kristian).

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>
8 years agoglsl: Add std430 related member functions to glsl_type class
Samuel Iglesias Gonsalvez [Mon, 31 Aug 2015 05:44:47 +0000 (07:44 +0200)]
glsl: Add std430 related member functions to glsl_type class

They are used to calculate size, base alignment and array stride values
for a glsl_type following std430 rules.

v2:
- Paste OpenGL 4.3 spec wording as it mentions stride of array. (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>
8 years agoglsl: allow default qualifiers for shader storage block definitions
Samuel Iglesias Gonsalvez [Thu, 3 Sep 2015 10:00:16 +0000 (12:00 +0200)]
glsl: allow default qualifiers for shader storage block definitions

This kind of definitions:

    layout(xxx) buffer;

was not supported by commit 84fc5fece006.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Move interface block processing to glsl_parser_extras.cpp
Samuel Iglesias Gonsalvez [Thu, 10 Sep 2015 08:00:12 +0000 (10:00 +0200)]
glsl: Move interface block processing to glsl_parser_extras.cpp

No functional changes.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: ignore default qualifier declarations when checking for duplicate layout qualifiers
Samuel Iglesias Gonsalvez [Thu, 3 Sep 2015 07:47:56 +0000 (09:47 +0200)]
glsl: ignore default qualifier declarations when checking for duplicate layout qualifiers

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: layout qualifier can appear more than once since OpenGL 4.20
Samuel Iglesias Gonsalvez [Wed, 2 Sep 2015 13:58:01 +0000 (15:58 +0200)]
glsl: layout qualifier can appear more than once since OpenGL 4.20

Also if GL_ARB_shading_language_420pack extension is enabled.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965/wm: surfaces should have the API buffer size, not the drm buffer size
Samuel Iglesias Gonsalvez [Fri, 24 Apr 2015 05:02:19 +0000 (07:02 +0200)]
i965/wm: surfaces should have the API buffer size, not the drm buffer size

The returned drm buffer object has a size multiple of 4096 but that should not
be exposed to the API user, which is working with a different size.

As far as I can see this problem is only visible in the calculation of the
length of unsized arrays used in SSBOs, as the implementation of this needs
to query the underlying buffer size via a message.

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>
8 years agoi965/wm: emit null buffer surfaces when null buffers are attached
Samuel Iglesias Gonsalvez [Thu, 16 Apr 2015 11:18:01 +0000 (13:18 +0200)]
i965/wm: emit null buffer surfaces when null buffers are attached

Otherwise we can expect odd things to happen if, for example, we ask
for the size of the attached buffer from shader code, since that
might query this value from the surface we uploaded and get random
results.

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>
8 years agoi965/fs/nir: implement nir_intrinsic_get_buffer_size
Samuel Iglesias Gonsalvez [Mon, 1 Jun 2015 07:45:51 +0000 (09:45 +0200)]
i965/fs/nir: implement nir_intrinsic_get_buffer_size

v2:
- Remove inst->regs_written assignment as the instruction only
  writes to one register.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965/fs: Implement FS_OPCODE_GET_BUFFER_SIZE
Samuel Iglesias Gonsalvez [Mon, 13 Apr 2015 14:55:49 +0000 (16:55 +0200)]
i965/fs: Implement FS_OPCODE_GET_BUFFER_SIZE

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965/vec4/nir: implement nir_intrinsic_get_buffer_size
Samuel Iglesias Gonsalvez [Wed, 26 Aug 2015 10:21:54 +0000 (12:21 +0200)]
i965/vec4/nir: implement nir_intrinsic_get_buffer_size

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965/vec4: Implement VS_OPCODE_GET_BUFFER_SIZE
Samuel Iglesias Gonsalvez [Fri, 28 Aug 2015 07:39:49 +0000 (09:39 +0200)]
i965/vec4: Implement VS_OPCODE_GET_BUFFER_SIZE

Notice that Skylake needs to include a header in the sampler message
so it will need some tweaks to work there.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agonir: Implement ir_unop_get_buffer_size
Samuel Iglesias Gonsalvez [Mon, 1 Jun 2015 07:44:55 +0000 (09:44 +0200)]
nir: Implement ir_unop_get_buffer_size

This is how backends provide the buffer size required to compute
the size of unsized arrays in the previous patch

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: implement unsized array length
Samuel Iglesias Gonsalvez [Wed, 8 Jul 2015 15:42:14 +0000 (17:42 +0200)]
glsl: implement unsized array length

v2:
- Reduce the number of lines over 80 character line width
  limit. (Thomas Hellan)

v3:
- Inject the formula to compute the array length in the IR, backends
  only need to provide the buffer size (Curro)
- Create an auxiliary function to simplify code (Jordan Justen)
- Rename variables (Jordan Justen)

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Add parser/compiler support for unsized array's length()
Samuel Iglesias Gonsalvez [Mon, 13 Apr 2015 14:17:07 +0000 (16:17 +0200)]
glsl: Add parser/compiler support for unsized array's length()

The unsized array length is computed with the following formula:

array.length() =
   max((buffer_object_size - offset_of_array) / stride_of_array, 0)

Of these, only the buffer size needs to be provided by the backends, the
frontend already knows the values of the two other variables.

This patch identifies the cases where we need to get the length of an
unsized array, injecting ir_unop_ssbo_unsized_array_length expressions
that will be lowered (in a later patch) to inject the formula mentioned
above.

It also adds the ir_unop_get_buffer_size expression that drivers will
implement to provide the buffer length.

v2:
- Do not define a triop that will force backends to implement the
  entire formula, they should only need to provide the buffer size
  since the other values are known by the frontend (Curro).

v3:
- Call state->has_shader_storage_buffer_objects() in ast_function.cpp instead
  of using state->ARB_shader_storage_buffer_object_enable (Tapani).

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Add unsized array support to glsl_type::std140_size()
Samuel Iglesias Gonsalvez [Mon, 21 Sep 2015 07:09:11 +0000 (09:09 +0200)]
glsl: Add unsized array support to glsl_type::std140_size()

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: fix indention in glsl_types.cpp
Samuel Iglesias Gonsalvez [Tue, 22 Sep 2015 09:05:28 +0000 (11:05 +0200)]
glsl: fix indention in glsl_types.cpp

No functional changes.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: add support for unsized arrays in shader storage blocks
Samuel Iglesias Gonsalvez [Wed, 18 Mar 2015 14:32:03 +0000 (15:32 +0100)]
glsl: add support for unsized arrays in shader storage blocks

They only can be defined in the last position of the shader
storage blocks.

When an unsized array is used in different shaders, it might be
converted in different sized arrays, avoid get a linker error
in that case.

v2:
- Rework error condition and error messages (Timothy Arceri)

v3:
- Move OpenGL ES check to its own patch.

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>
8 years agoglsl: return error if unsized arrays are found in OpenGL ES
Samuel Iglesias Gonsalvez [Tue, 25 Aug 2015 06:02:46 +0000 (08:02 +0200)]
glsl: return error if unsized arrays are found in OpenGL ES

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>
8 years agoi965/fs: Do not split buffer variables
Iago Toral Quiroga [Thu, 9 Apr 2015 07:14:38 +0000 (09:14 +0200)]
i965/fs: Do not split buffer variables

Buffer variables are the same as uniforms, only that read/write, so we want
the same treatment.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: handle visiting of ir_var_shader_storage variables
Iago Toral Quiroga [Thu, 9 Apr 2015 08:33:30 +0000 (10:33 +0200)]
i965: handle visiting of ir_var_shader_storage variables

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Upload Shader Storage Buffer Object surfaces
Iago Toral Quiroga [Mon, 23 Mar 2015 12:48:43 +0000 (13:48 +0100)]
i965: Upload Shader Storage Buffer Object surfaces

Since these are a special kind of UBOs we emit them together reusing the
same infrastructure, however, we use a RAW surface so we can reuse
existing untyped read/write/atomic messages which include a pixel mask
header that we need to set to obtain correct behavior with helper
invocations of the fragment shader.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Set MaxShaderStorageBuffers for compute shaders
Iago Toral Quiroga [Thu, 19 Mar 2015 11:11:39 +0000 (12:11 +0100)]
i965: Set MaxShaderStorageBuffers for compute shaders

v2:
- Set it after the driver's MaxShaderStorageBuffers value assignment.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: set ARB_shader_storage_buffer_object related constant values
Samuel Iglesias Gonsalvez [Tue, 9 Jun 2015 07:16:33 +0000 (09:16 +0200)]
i965: set ARB_shader_storage_buffer_object related constant values

v2:
- Add tessellation shader constants assignment

v3:
- Set MaxShaderStorageBufferBindings to 36.

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>
8 years agoi965: Implement DriverFlags.NewShaderStorageBuffer
Iago Toral Quiroga [Thu, 19 Mar 2015 10:07:19 +0000 (11:07 +0100)]
i965: Implement DriverFlags.NewShaderStorageBuffer

We use the same dirty state for SSBOs and UBOs because they share the
same infrastructure.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Use 64-byte offset alignment for shader storage buffers
Iago Toral Quiroga [Thu, 19 Mar 2015 10:27:21 +0000 (11:27 +0100)]
i965: Use 64-byte offset alignment for shader storage buffers

This should be a cacheline (64 bytes) so that we can safely have the
CPU and GPU writing the same SSBO on non-cachecoherent systems (our
Atom CPUs). With UBOs, the GPU never writes, so there's no
problem. For an SSBO, the GPU and the CPU can be updating disjoint
regions of the buffer simultaneously and that will break if the
regions overlap the same cacheline.

v2:
- Use cacheline size (64 bytes) instead of 16 bytes (Kristian).
- Update commit log and add a comment in the code explaining
  why we use cacheline size (Ben).

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agomesa: set MAX_SHADER_STORAGE_BUFFERS to 16.
Samuel Iglesias Gonsalvez [Thu, 3 Sep 2015 11:58:25 +0000 (13:58 +0200)]
mesa: set MAX_SHADER_STORAGE_BUFFERS to 16.

v2:
- Set the value to 16 and drop the comment. (Kristian)

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>
8 years agoglsl: add packed varyings to program resource list
Tapani Pälli [Fri, 4 Sep 2015 08:30:34 +0000 (11:30 +0300)]
glsl: add packed varyings to program resource list

This makes sure that user is still able to query properties about
variables that have gotten packed by lower_packed_varyings pass.

Fixes following OpenGL ES 3.1 test:
   ES31-CTS.program_interface_query.separate-programs-vertex

v2: fix 'name included in packed list' check (Ilia Mirkin)
v3: iterate over instances of name using strtok_r (Ilia Mirkin)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agomesa: add packed_varyings list to gl_shader
Tapani Pälli [Fri, 4 Sep 2015 08:22:15 +0000 (11:22 +0300)]
mesa: add packed_varyings list to gl_shader

This is required to store information about packed varyings, currently
these variables get lost and cannot be retrieved later in sensible way
for program interface queries. List will be utilized by next patch.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agoi965/cs: Implement DispatchComputeIndirect support
Jordan Justen [Thu, 17 Sep 2015 23:25:24 +0000 (16:25 -0700)]
i965/cs: Implement DispatchComputeIndirect support

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agomesa/cs: Implement glDispatchComputeIndirect
Jordan Justen [Thu, 17 Sep 2015 18:14:45 +0000 (11:14 -0700)]
mesa/cs: Implement glDispatchComputeIndirect

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agomesa/cs: Support GL_DISPATCH_INDIRECT_BUFFER
Jordan Justen [Thu, 17 Sep 2015 17:10:07 +0000 (10:10 -0700)]
mesa/cs: Support GL_DISPATCH_INDIRECT_BUFFER

v2:
 * Use _mesa_has_compute_shaders (Ilia)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agomesa/cs: Add _mesa_validate_DispatchCompute
Jordan Justen [Thu, 17 Sep 2015 17:05:22 +0000 (10:05 -0700)]
mesa/cs: Add _mesa_validate_DispatchCompute

Move API validation to _mesa_validate_DispatchCompute in
api_validate.c.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agomesa: fix mipmap generation for immutable, compressed textures
Roland Scheidegger [Sat, 19 Sep 2015 23:33:17 +0000 (01:33 +0200)]
mesa: fix mipmap generation for immutable, compressed textures

If the immutable compressed texture didn't have the full mip pyramid,
this didn't work, because it tried to generate mip levels for non-existing
levels. _mesa_prepare_mipmap_level() would correctly handle this by returning
FALSE if the mip level didn't exist, however we actually created the
non-existing mip level right before that because we used _mesa_get_tex_image()
before calling _mesa_prepare_mipmap_level(). It would then proceed to crash
(we allocated the mip level, which is a bad idea on an immutable texture,
but didn't initialize the values, leading to assertion failures or segfaults).
Fix this by using _mesa_select_tex_image() instead and call it after
_mesa_prepare_mipmap_level(), as that function will allocate missing mip levels
for non-immutable textures already.
This fixes a (2 year old) crash with astromenace which was hack-fixed in ubuntu
packages instead: http://bugs.debian.org/718680 (I guess most apps do full mip
chains - I believe this app not doing it is actually unintentional, always one
level less than full mip chain...).

Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoglsl: Expose gl_MaxTess{Control,Evaluation}AtomicCounters.
Matt Turner [Thu, 24 Sep 2015 01:06:19 +0000 (18:06 -0700)]
glsl: Expose gl_MaxTess{Control,Evaluation}AtomicCounters.

... with only ARB_shader_atomic_counters.

I expected to see interactions with ARB_tessellation_shader in the
ARB_shader_atomic_counters spec, but they do not exist. It seems that we
should unconditionally expose these variables in the presence of
ARB_shader_atomic_counters:

   gl_MaxTessControlAtomicCounters
   gl_MaxTessEvaluationAtomicCounters

This partially reverts commit da7adb99e8. The commit also affected
gl_MaxTessControlImageUniforms and gl_MaxTessEvaluationImageUniforms
similarly but the ARB_shader_image_load_store spec does list an
interaction with ARB_tessellation_shader.

Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92095
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/vec4: check swizzle before discarding a uniform on a 3src operand
Alejandro Piñeiro [Wed, 23 Sep 2015 17:22:17 +0000 (19:22 +0200)]
i965/vec4: check swizzle before discarding a uniform on a 3src operand

Without this commit, copy propagation is discarded if it involves
a uniform with an instruction that has 3 sources. But 3 sourced
instructions can access scalar values.

For example, this is what vec4_visitor::fix_3src_operand() is already
doing:

   if (src.file == UNIFORM && brw_is_single_value_swizzle(src.swizzle))
      return src;

Shader-db results (unfiltered) on NIR:
total instructions in shared programs: 6259650 -> 6241985 (-0.28%)
instructions in affected programs:     812755 -> 795090 (-2.17%)
helped:                                7930
HURT:                                  0

Shader-db results (unfiltered) on IR:
total instructions in shared programs: 6445822 -> 6441788 (-0.06%)
instructions in affected programs:     296630 -> 292596 (-1.36%)
helped:                                2533
HURT:                                  0

v2:
- Updated commit message, using Matt Turner suggestions
- Move the check after we've created the final value, as Jason
  Ekstrand suggested
- Clean up the condition

v3:
- Move the check back to the original place, to keep things
  tidy, as suggested by Jason Ekstrand

v4:
- Fixed missing is_single_value_swizzle() as pointed by Jason Ekstrand

Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoandroid: radeonsi: fix sid_tables.h missing LOCAL_MODULE_CLASS
Mauro Rossi [Wed, 23 Sep 2015 20:30:55 +0000 (22:30 +0200)]
android: radeonsi: fix sid_tables.h missing LOCAL_MODULE_CLASS

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: remove the percentage symbol from HUD temperature
Benjamin Bellec [Fri, 4 Sep 2015 18:27:22 +0000 (20:27 +0200)]
gallium/radeon: remove the percentage symbol from HUD temperature

The HUD adds '%' if max == 100.

Signed-off-by: Benjamin Bellec <b.bellec@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/u_blitter: handle allocation failures
Marek Olšák [Thu, 10 Sep 2015 16:48:12 +0000 (18:48 +0200)]
gallium/u_blitter: handle allocation failures

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: handle dummy constant buffer allocation failure
Marek Olšák [Thu, 10 Sep 2015 17:25:14 +0000 (19:25 +0200)]
radeonsi: handle dummy constant buffer allocation failure

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: don't forget to update scratch relocations for LS, HS, ES shaders
Marek Olšák [Thu, 10 Sep 2015 16:42:22 +0000 (18:42 +0200)]
radeonsi: don't forget to update scratch relocations for LS, HS, ES shaders

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: skip drawing if updating the scratch buffer fails
Marek Olšák [Thu, 10 Sep 2015 16:40:51 +0000 (18:40 +0200)]
radeonsi: skip drawing if updating the scratch buffer fails

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: skip drawing if PS fails to compile or upload
Marek Olšák [Thu, 10 Sep 2015 16:33:10 +0000 (18:33 +0200)]
radeonsi: skip drawing if PS fails to compile or upload

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: skip drawing if VS, TCS, TES, GS fail to compile or upload
Marek Olšák [Thu, 10 Sep 2015 16:32:22 +0000 (18:32 +0200)]
radeonsi: skip drawing if VS, TCS, TES, GS fail to compile or upload

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: handle fixed-func TCS shader create failure
Marek Olšák [Thu, 10 Sep 2015 16:31:33 +0000 (18:31 +0200)]
radeonsi: handle fixed-func TCS shader create failure

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: handle shader precompile failures
Marek Olšák [Thu, 10 Sep 2015 16:30:41 +0000 (18:30 +0200)]
radeonsi: handle shader precompile failures

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: skip drawing if GS ring allocations fail
Marek Olšák [Thu, 10 Sep 2015 16:27:53 +0000 (18:27 +0200)]
radeonsi: skip drawing if GS ring allocations fail

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: skip drawing if the tess factor ring allocation fails
Marek Olšák [Thu, 10 Sep 2015 16:27:53 +0000 (18:27 +0200)]
radeonsi: skip drawing if the tess factor ring allocation fails

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: add malloc fail paths to si_create_shader_state
Marek Olšák [Thu, 10 Sep 2015 16:16:26 +0000 (18:16 +0200)]
radeonsi: add malloc fail paths to si_create_shader_state

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: report alloc failure from si_shader_binary_read
Marek Olšák [Thu, 10 Sep 2015 16:15:40 +0000 (18:15 +0200)]
radeonsi: report alloc failure from si_shader_binary_read

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/radeon: add a fail path for depth MSAA texture readback
Marek Olšák [Thu, 10 Sep 2015 16:14:36 +0000 (18:14 +0200)]
gallium/radeon: add a fail path for depth MSAA texture readback

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/radeon: handle buffer alloc failures in r600_draw_rectangle
Marek Olšák [Thu, 10 Sep 2015 15:54:41 +0000 (17:54 +0200)]
gallium/radeon: handle buffer alloc failures in r600_draw_rectangle

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/radeon: handle buffer_map staging buffer failures better
Marek Olšák [Thu, 10 Sep 2015 15:53:28 +0000 (17:53 +0200)]
gallium/radeon: handle buffer_map staging buffer failures better

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: handle constant buffer alloc failures
Marek Olšák [Thu, 10 Sep 2015 15:42:31 +0000 (17:42 +0200)]
radeonsi: handle constant buffer alloc failures

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: handle index buffer alloc failures
Marek Olšák [Thu, 10 Sep 2015 15:42:31 +0000 (17:42 +0200)]
radeonsi: handle index buffer alloc failures

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agost/mesa: fix front buffer regression after dropping st_validate_state in Blit
Marek Olšák [Wed, 23 Sep 2015 00:33:24 +0000 (02:33 +0200)]
st/mesa: fix front buffer regression after dropping st_validate_state in Blit

Broken by: d082c5324914212f76e45be497229c7a0681f706
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92072

Cc: 10.6 11.0 <mesa-stable@lists.freedesktop.org>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agowayland: Add copyright notice for wayland-egl.c
Kristian Høgsberg Kristensen [Thu, 24 Sep 2015 17:51:10 +0000 (10:51 -0700)]
wayland: Add copyright notice for wayland-egl.c

Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
8 years agoi965: Respect stride and subreg_offset for ATTR registers
Kristian Høgsberg Kristensen [Wed, 23 Sep 2015 23:57:47 +0000 (16:57 -0700)]
i965: Respect stride and subreg_offset for ATTR registers

When we assign hw regs to attributes, we don't incorporate the stride
and subreg_offset from the fs_reg. It's rarely used, but the integer
multiplication lowering uses unusual stride and subreg_offset
combination breaks when one source is an attribute.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91970
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agomesa: rework Driver.CopyImageSubData() and related code
Brian Paul [Fri, 28 Aug 2015 06:42:00 +0000 (00:42 -0600)]
mesa: rework Driver.CopyImageSubData() and related code

Previously, core Mesa's _mesa_CopyImageSubData() created temporary textures
to wrap renderbuffer sources/destinations.  This caused a bit of a mess in
the Mesa/gallium state tracker because we had to basically undo that
wrapping.

Instead, change ctx->Driver.CopyImageSubData() to take both gl_renderbuffer
and gl_texture_image src/dst pointers (one being null, the other non-null)
so the driver can handle renderbuffer vs. texture as needed.

For the i965 driver, we basically moved the code that wrapped textures
around renderbuffers from copyimage.c down into the met and driver code.

The old code in copyimage.c also made some questionable calls to
_mesa_BindTexture(), etc. which weren't undone at the end.

v2 (Jason Ekstrand): Rework the intel bits
v3 (Brian Paul): Update the temporary st_CopyImageSubData() function.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
8 years agost/xa: Fixups for PIPE_FORMAT_R8_UNORM A8 usage v2.
Thomas Hellstrom [Thu, 17 Sep 2015 10:22:53 +0000 (03:22 -0700)]
st/xa: Fixups for PIPE_FORMAT_R8_UNORM A8 usage v2.

Check for PIPE_FORMAT_R8_UNORM when setting up the copy shader.
Also re-enable the dest alpha blending with A8 destination that
actually turned out to be correct.

Verified using rendercheck that the composite operators
overreverse, in, out, atop, atopreverse and xor seem to work fine
with a8 destiation.

v2: Fix a copy-paste error.

Reported-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agost/mesa: keep track of saturated writes when eliminating dead code
Ilia Mirkin [Wed, 23 Sep 2015 04:30:23 +0000 (00:30 -0400)]
st/mesa: keep track of saturated writes when eliminating dead code

It doesn't matter whether a write is saturated or not, in another
implementation it might even have been a separate opcode. This code was
most likely copied from the copy-propagation pass (where one does have
to distinguish saturation).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: correctly detect inactive UBO arrays
Timothy Arceri [Wed, 23 Sep 2015 01:12:57 +0000 (11:12 +1000)]
glsl: correctly detect inactive UBO arrays

Previously the code was trying to get the packing type from the array not the
interface.

Cc: Ian Romanick <ian.d.romanick@intel.com>
Cc: Antia Puentes <apuentes@igalia.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agoi965: add ARB_texture_barrier support
Ilia Mirkin [Thu, 13 Aug 2015 19:39:40 +0000 (15:39 -0400)]
i965: add ARB_texture_barrier support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agoi965/gs: Fix extra level of indentation left by the previous commit.
Kenneth Graunke [Thu, 3 Sep 2015 08:01:29 +0000 (01:01 -0700)]
i965/gs: Fix extra level of indentation left by the previous commit.

I left a bunch of code indented a level in the previous patch to make
the diff easier to read.  But now we should fix that.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agoi965/gs: Use new NIR intrinsics.
Kenneth Graunke [Wed, 5 Aug 2015 16:16:59 +0000 (09:16 -0700)]
i965/gs: Use new NIR intrinsics.

By performing the vertex counting in NIR, we're able to elide a ton of
useless safety checks around every EmitVertex() call:

total instructions in shared programs: 3952 -> 3720 (-5.87%)
instructions in affected programs:     3491 -> 3259 (-6.65%)
helped:                                11
HURT:                                  0

Improves performance in Gl32GSCloth by 0.671742% +/- 0.142202% (n=621)
on Haswell GT3e at 1024x768.

This should also make it easier to implement Broadwell's "Static Vertex
Count" feature someday.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>