mesa.git
9 years agotargets/clover: link against libmesautil.la
Jan Vesely [Mon, 4 Aug 2014 22:50:03 +0000 (18:50 -0400)]
targets/clover: link against libmesautil.la

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agogallivm: Fix build with latest LLVM
Jan Vesely [Mon, 4 Aug 2014 22:50:02 +0000 (18:50 -0400)]
gallivm: Fix build with latest LLVM

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agotargets/dri: link with mesautil
Roland Scheidegger [Tue, 5 Aug 2014 02:03:59 +0000 (04:03 +0200)]
targets/dri: link with mesautil

Similar to other recent build fixes.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agogallium/docs: Document TEX2/TXL2/TXB2 instructions and fix up other tex doc
Roland Scheidegger [Sat, 2 Aug 2014 02:12:03 +0000 (04:12 +0200)]
gallium/docs: Document TEX2/TXL2/TXB2 instructions and fix up other tex doc

Add documentation for TEX2/TXL2/TXB2 tgsi opcodes. Also, the texture opcode
documentation wasn't very accurate so fix this up a bit.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agogallivm: fix cube map array (and cube map shadow with bias) handling
Roland Scheidegger [Fri, 1 Aug 2014 23:49:39 +0000 (01:49 +0200)]
gallivm: fix cube map array (and cube map shadow with bias) handling

In particular need to handle TEX2/TXB2/TXL2 opcodes.
cube map shadow with bias already used TXB2 which didn't work before
at all, despite that there's by default no piglit change (but using
no_quad_lod and no_rho_opt indeed passes some more tex-miplevel-selection
tests).
The actual sampling code still won't handle cube map arrays.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agollvmpipe: implement support for cube map arrays
Roland Scheidegger [Fri, 1 Aug 2014 21:50:35 +0000 (23:50 +0200)]
llvmpipe: implement support for cube map arrays

This just covers the resource side of things, not the actual sampling.
Here things are trivial as cube map arrays are identical to 2d arrays in
all respects.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoegl: Fix OpenGL ES version checks in _eglParseContextAttribList()
Anuj Phogat [Thu, 19 Jun 2014 00:35:18 +0000 (17:35 -0700)]
egl: Fix OpenGL ES version checks in _eglParseContextAttribList()

We would generate EGL_BAD_CONFIG because _eglGetContextAPIBit
returns zero for the combination of EGL_OPENGL_ES_API and a major
version > 3.  By just returning zero, the caller can't tell the
difference between a bad version (which should generate
EGL_BAD_MATCH) and a bad API (which should generate
EGL_BAD_CONFIG).  This patch causes us to filter out major
versions > 3 at a point where we can generate the correct error.

Fixes gles3 Khronos CTS test:
egl_create_context.egl_create_context

V2: Fix commit message as suggested by Ian.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agometa: Fix datatype computation in get_temp_image_type()
Anuj Phogat [Thu, 12 Jun 2014 21:49:50 +0000 (14:49 -0700)]
meta: Fix datatype computation in get_temp_image_type()

Changes in the patch will cause datatype to be computed
correctly for 8 and 16 bit integer formats. For example:
GL_RG8I, GL_RG16I etc.

Fixes many failures in gles3 Khronos CTS test:
copy_tex_image_conversions_required
copy_tex_image_conversions_forbidden

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agometa: Move the call to _mesa_get_format_datatype() out of switch
Anuj Phogat [Thu, 12 Jun 2014 21:14:53 +0000 (14:14 -0700)]
meta: Move the call to _mesa_get_format_datatype() out of switch

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agometa: Use _mesa_get_format_bits() to get the GL_RED_BITS
Anuj Phogat [Thu, 12 Jun 2014 01:07:36 +0000 (18:07 -0700)]
meta: Use _mesa_get_format_bits() to get the GL_RED_BITS

We currently get red bits from ctx->DrawBuffer->Visual.redBits
by making a false assumption that the texture we're writing to
(in glCopyTexImage2D()) is used as a DrawBuffer.

Fixes many failures in gles3 Khronos CTS test:
copy_tex_image_conversions_required

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agometa: Initialize the variable in declaration statement
Anuj Phogat [Thu, 12 Jun 2014 00:57:30 +0000 (17:57 -0700)]
meta: Initialize the variable in declaration statement

Saves one line of code :)

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agomesa: Allow GL_TEXTURE_CUBE_MAP target with compressed internal formats
Anuj Phogat [Tue, 10 Jun 2014 00:28:33 +0000 (17:28 -0700)]
mesa: Allow GL_TEXTURE_CUBE_MAP target with compressed internal formats

GL_TEXTURE_CUBE_MAP is an allowed texture target in glTexStorage2D()
and is allowed to be used (like GL_TEXTURE_2D) with compressed internal
formats.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agomesa: Add gles3 condition for normalized internal formats in glCopyTexImage*()
Anuj Phogat [Fri, 6 Jun 2014 18:46:55 +0000 (11:46 -0700)]
mesa: Add gles3 condition for normalized internal formats in glCopyTexImage*()

Fixes many failures in gles3 Khronos CTS test: packed_pixels

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa: Add utility function _mesa_is_enum_format_unorm()
Anuj Phogat [Fri, 6 Jun 2014 19:35:55 +0000 (12:35 -0700)]
mesa: Add utility function _mesa_is_enum_format_unorm()

V2: Add missing formats.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa: Add gles3 error condition for GL_RGBA10_A2 buffer format in glCopyTexImage*()
Anuj Phogat [Fri, 6 Jun 2014 18:59:28 +0000 (11:59 -0700)]
mesa: Add gles3 error condition for GL_RGBA10_A2 buffer format in glCopyTexImage*()

Fixes many failures in gles3 Khronos CTS test: packed_pixels

Khronos bug# 9807
Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa: Add a gles3 error condition for sized internalformat in glCopyTexImage*()
Anuj Phogat [Thu, 5 Jun 2014 18:48:34 +0000 (11:48 -0700)]
mesa: Add a gles3 error condition for sized internalformat in glCopyTexImage*()

Fixes many failures in gles3 Khronos CTS test: packed_pixels

V2: Add the check for alpha bits to avoid confusion.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa: Add a helper function _mesa_is_enum_format_unsized()
Anuj Phogat [Thu, 5 Jun 2014 18:13:16 +0000 (11:13 -0700)]
mesa: Add a helper function _mesa_is_enum_format_unsized()

Function is utilized by next patch in the series.

V2: Add missing formats.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa: Don't allow snorm internal formats in glCopyTexImage*() in GLES3
Anuj Phogat [Fri, 6 Jun 2014 21:53:12 +0000 (14:53 -0700)]
mesa: Don't allow snorm internal formats in glCopyTexImage*() in GLES3

Fixes few failures in gles3 Khronos CTS test: packed_pixels

Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa: Add utility function _mesa_is_enum_format_snorm()
Anuj Phogat [Fri, 6 Jun 2014 21:47:52 +0000 (14:47 -0700)]
mesa: Add utility function _mesa_is_enum_format_snorm()

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa: Fix condition for using compressed internalformat in glCompressedTexImage3D()
Anuj Phogat [Sat, 31 May 2014 00:48:34 +0000 (17:48 -0700)]
mesa: Fix condition for using compressed internalformat in glCompressedTexImage3D()

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa: Add error condition for using compressed internalformat in glTexStorage3D()
Anuj Phogat [Fri, 30 May 2014 23:24:39 +0000 (16:24 -0700)]
mesa: Add error condition for using compressed internalformat in glTexStorage3D()

Fixes gles3 Khronos CTS test: texture_storage_texture_internal_formats

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa: Turn target_can_be_compressed() in to a utility function
Anuj Phogat [Sat, 31 May 2014 00:33:54 +0000 (17:33 -0700)]
mesa: Turn target_can_be_compressed() in to a utility function

V2:  Declare the function in teximage.h

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa: Fix error condition for valid texture targets in glTexStorage* functions
Anuj Phogat [Fri, 30 May 2014 21:55:28 +0000 (14:55 -0700)]
mesa: Fix error condition for valid texture targets in glTexStorage* functions

Fixes gles3 Khronos CTS test: texture_storage_texture_targets

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agoglsl: Rebuild the symbol table without unreachable symbols
Ian Romanick [Mon, 14 Jul 2014 22:48:34 +0000 (15:48 -0700)]
glsl: Rebuild the symbol table without unreachable symbols

Previously we had to keep unreachable global symbols in the symbol table
because the symbol table is used during linking.  Having the symbol
table retain pointers to freed memory... what could possibly go wrong?
At the same time, this meant that we kept live references to tons of
memory that was no longer needed.

New strategy:  destroy the old symbol table, and make a new one from the
reachable symbols.

Valgrind massif results for a trimmed apitrace of dota2:

                  n        time(i)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
Before (32-bit): 59 40,642,425,451       76,337,968       69,720,886     6,617,082            0
After  (32-bit): 46 40,661,487,174       75,116,800       68,854,065     6,262,735            0

Before (64-bit): 79 37,179,441,771      106,986,512       98,112,095     8,874,417            0
After  (64-bit): 64 37,200,329,700      104,872,672       96,514,546     8,358,126            0

A real savings of 846KiB on 32-bit and 1.5MiB on 64-bit.

v2: (by Kenneth Graunke) Just add the ir_function from the IR stream,
    rather than looking it up in the symbol table; they're now
    identical.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: Only create one ir_function for a given name.
Kenneth Graunke [Thu, 24 Jul 2014 21:05:41 +0000 (14:05 -0700)]
glsl: Only create one ir_function for a given name.

Piglit's spec/glsl-1.10/linker/override-builtin-{const,uniform}-05 tests
do the following:

1. Call abs(float) - a built-in function.
2. Create a user-defined replacement for abs(float).
3. Call abs(float) again - now the user function.

At step 1, we created an ir_function which included the built-in
signature, added it to the symbol table, and emitted it into the IR
stream.

Then, when processing the function definition at step 2, we'd see that
there was already an ir_function.  But, since there were no user-defined
functions, we skipped over a bunch of code, and ended up creating a
second one.  This new ir_function shadowed the original in the symbol
table, but both ended up in the IR stream.

This results in an awkward situation where searching for an ir_function
via the symbol table, a forward linked list walk, and a reverse linked
list walk may return different ir_functions.  This seems undesirable.

This patch instead re-uses the existing ir_function, putting both
built-in and user-defined signatures in the same one.  The previous
patch's additional filtering ensures everything continues working.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: Make it possible to ignore built-ins when matching signatures.
Kenneth Graunke [Thu, 24 Jul 2014 21:05:40 +0000 (14:05 -0700)]
glsl: Make it possible to ignore built-ins when matching signatures.

Historically, we've implemented the rules for overriding built-in
functions by creating multiple ir_functions and relying on the symbol
table to hide the one containing built-in functions.  That works, but
has a few drawbacks, so the next patch will change it.

Instead, we'll have a single ir_function for a particular name, which
will contain both built-in and user-defined signatures.  Passing an
extra parameter to matching_signature makes it easy to ignore built-ins
when they're supposed to be hidden.

I didn't add the parameter to exact_matching_signature since it wasn't
necessary.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agomesa: Actually use the Mesa IR optimizer for ARB programs.
Kenneth Graunke [Sat, 2 Aug 2014 12:33:14 +0000 (05:33 -0700)]
mesa: Actually use the Mesa IR optimizer for ARB programs.

On Haswell, this cuts 1-3 instructions from 183 vertex shaders in
"Shadowrun Returns", "Shatter", and "Trine 2."  It adds 2 instructions
to a single fragment shader in "Closure."

total instructions in shared programs: 278803 -> 278546 (-0.09%)
instructions in affected programs:     41930 -> 41673 (-0.61%)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoglsl: Do not add extra padding to structures
Ian Romanick [Sat, 19 Jul 2014 21:14:29 +0000 (14:14 -0700)]
glsl: Do not add extra padding to structures

This code was attemping to align the base of the structure to the required
alignment of the structure.  However, it had two problems:

1. It was aligning the target structure member, not the base of the
structure.

2. It was calculating the alignment based on the members previous to the
target member instead of all the members of the structure.

Fixes gles3conform failures in:

ES3-CTS.shaders.uniform_block.random.nested_structs.6
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.2
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.6
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.5
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.19
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.0
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.2
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.6
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.12

v2: Fix rebase failure noticed by Matt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: Correctly determine when the field of a UBO is row-major
Ian Romanick [Mon, 30 Jun 2014 17:05:27 +0000 (10:05 -0700)]
glsl: Correctly determine when the field of a UBO is row-major

Previously if a field of an block with an instance name was marked
row-major (but block itself was not), we would think the field (and it's
sub-fields) were column-major.

Fixes gles3conform failures in:

ES3-CTS.shaders.uniform_block.random.basic_types.7
ES3-CTS.shaders.uniform_block.random.basic_types.9
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.1
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.3
ES3-CTS.shaders.uniform_block.random.nested_structs.3
ES3-CTS.shaders.uniform_block.random.nested_structs.5
ES3-CTS.shaders.uniform_block.random.nested_structs.8
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.3
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.6
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.7
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.8
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.9
ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.0
ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.1
ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.2
ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.3
ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.4
ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.6
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.0
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.1
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.5
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.0
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.4
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.7
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.8
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.12
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.14
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.15
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.16
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.1
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.8
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.9
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.10
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.11
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.13
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.14
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.15
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.16
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.17

Fixes gles3conform failures (caused by previous commits) in:

ES3-CTS.shaders.uniform_block.random.basic_types.8
ES3-CTS.shaders.uniform_block.random.basic_arrays.3
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.0
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.2
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.9
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.13
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.18
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.4

v2: Fix rebase failure noticed by Matt.

v3: Use without_array() instead of older predicates.

v4: s/GLSL_MATRIX_LAYOUT_DEFAULT/GLSL_MATRIX_LAYOUT_INHERITED/g

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com> [v2]
9 years agolinker: Use the matrix layout information in ir_variable and glsl_type for UBO layout
Ian Romanick [Fri, 18 Jul 2014 19:18:21 +0000 (12:18 -0700)]
linker: Use the matrix layout information in ir_variable and glsl_type for UBO layout

Use the data that is stored in the ir_variable and the glsl_type to
determine whether or not a UBO member is row-major.

Fixes gles3conform failures in:

ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat2
ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat3
ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat4
ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat2x3
ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat2x4
ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat3x2
ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat3x4
ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat4x2
ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat4x3
ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat2
ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat3
ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat4
ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat2x3
ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat2x4
ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat3x2
ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat3x4
ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat4x2
ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat4x3
ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat2
ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat3
ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat4
ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat2x3
ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat2x4
ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat3x2
ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat3x4
ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat4x2
ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat4x3
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.2
ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.5
ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.9

Causes gles3conform failures in:

ES3-CTS.shaders.uniform_block.random.basic_types.8
ES3-CTS.shaders.uniform_block.random.basic_arrays.3
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.0
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.2
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.13
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.18
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.4

These failures will be fixed shortly.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: Track matrix layout of variables using two bits
Ian Romanick [Fri, 18 Jul 2014 18:23:06 +0000 (11:23 -0700)]
glsl: Track matrix layout of variables using two bits

Fixes gles3conform failures in:

ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.3
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.13

Causes gles3conform failures in:

ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.9

This failure will be fixed shortly.

v2: Use without_array() instead of older predicates.

v3: s/GLSL_MATRIX_LAYOUT_DEFAULT/GLSL_MATRIX_LAYOUT_INHERITED/g

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com> [v1]
9 years agoglsl: Also track matrix layout information into structures
Ian Romanick [Fri, 18 Jul 2014 17:27:21 +0000 (10:27 -0700)]
glsl: Also track matrix layout information into structures

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: Track matrix layout of structure fields using two bits
Ian Romanick [Wed, 16 Jul 2014 23:51:14 +0000 (16:51 -0700)]
glsl: Track matrix layout of structure fields using two bits

v2: Rename GLSL_MATRIX_LAYOUT_DEFAULT to GLSL_MATRIX_LAYOUT_INHERITED.
Add comments in glsl_types.h explaining the layouts.  Suggested by Matt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: Correctly load columns of a row-major matrix
Ian Romanick [Wed, 16 Jul 2014 02:59:18 +0000 (19:59 -0700)]
glsl: Correctly load columns of a row-major matrix

For a row-major matrix, the next column starts at the next element.

Fixes gles3conform failures in:

ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat2
ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat3
ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat4
ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat2x3
ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat2x4
ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat3x2
ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat3x4
ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat4x2
ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat4x3
ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat2
ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat3
ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat4
ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat2x3
ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat2x4
ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat3x2
ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat3x4
ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat4x2
ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat4x3
ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat2
ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat3
ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat4
ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat2x3
ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat2x4
ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat3x2
ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat3x4
ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat4x2
ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat4x3
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.9

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agolinker: Add padding after the last field of a structure
Ian Romanick [Wed, 16 Jul 2014 22:40:32 +0000 (15:40 -0700)]
linker: Add padding after the last field of a structure

This causes the thing following the structure to be vec4-aligned.

Fixes gles3conform failures in:

ES3-CTS.shaders.uniform_block.random.nested_structs.2
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.5

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agolinker: Add a last_field parameter to various program_resource_visitor methods
Ian Romanick [Wed, 16 Jul 2014 22:37:10 +0000 (15:37 -0700)]
linker: Add a last_field parameter to various program_resource_visitor methods

I also considered renaming visit_field(const glsl_struct_field *) to
entry_record and adding an exit_record method.  This would be more
similar to the hierarchical visitor.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: Do not list inactive block members as active
Ian Romanick [Wed, 16 Jul 2014 18:57:53 +0000 (11:57 -0700)]
mesa: Do not list inactive block members as active

Fixes gles3conform failures in:

ES3-CTS.shaders.uniform_block.single_nested_struct.per_block_buffer_packed
ES3-CTS.shaders.uniform_block.single_nested_struct_array.per_block_buffer_packed
ES3-CTS.shaders.uniform_block.random.scalar_types.7
ES3-CTS.shaders.uniform_block.random.basic_arrays.4
ES3-CTS.shaders.uniform_block.random.basic_arrays.6
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.2
ES3-CTS.shaders.uniform_block.random.nested_structs.9
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.3

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: Do not eliminate 'shared' or 'std140' blocks or block members
Ian Romanick [Wed, 25 Jun 2014 03:15:47 +0000 (20:15 -0700)]
glsl: Do not eliminate 'shared' or 'std140' blocks or block members

Commit 32f32292 (glsl: Allow elimination of uniform block members)
enabled elimination of unused uniform block members to fix a gles3
conformance test failure.  This went too far the other way.

Section 2.11.6 (Uniform Variables) of the OpenGL ES 3.0.3 spec says:

    "All members of a named uniform block declared with a shared or
    std140 layout qualifier are considered active, even if they are not
    referenced in any shader in the program. The uniform block itself is
    also considered active, even if no member of the block is
    referenced."

Fixes gles3conform failures in:

ES3-CTS.shaders.uniform_block.single_nested_struct.per_block_buffer_shared
ES3-CTS.shaders.uniform_block.single_nested_struct.per_block_buffer_std140
ES3-CTS.shaders.uniform_block.single_nested_struct_array.per_block_buffer_shared
ES3-CTS.shaders.uniform_block.single_nested_struct_array.per_block_buffer_std140
ES3-CTS.shaders.uniform_block.random.scalar_types.2
ES3-CTS.shaders.uniform_block.random.scalar_types.9
ES3-CTS.shaders.uniform_block.random.vector_types.1
ES3-CTS.shaders.uniform_block.random.vector_types.3
ES3-CTS.shaders.uniform_block.random.vector_types.7
ES3-CTS.shaders.uniform_block.random.vector_types.9
ES3-CTS.shaders.uniform_block.random.basic_types.5
ES3-CTS.shaders.uniform_block.random.basic_types.6
ES3-CTS.shaders.uniform_block.random.basic_arrays.0
ES3-CTS.shaders.uniform_block.random.basic_arrays.2
ES3-CTS.shaders.uniform_block.random.basic_arrays.5
ES3-CTS.shaders.uniform_block.random.basic_arrays.8
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.0
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.4
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.5
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.6
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.9
ES3-CTS.shaders.uniform_block.random.nested_structs.0
ES3-CTS.shaders.uniform_block.random.nested_structs.1
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.4
ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.8
ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.7
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.3
ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.6
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.18

v2: Whitespace and other minor fixes suggested by Matt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: Use the without_array predicate to simplify some code
Ian Romanick [Sat, 19 Jul 2014 21:41:04 +0000 (14:41 -0700)]
glsl: Use the without_array predicate to simplify some code

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com> [v1]
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agoglsl: Add without_array type predicate
Ian Romanick [Sat, 19 Jul 2014 21:07:18 +0000 (14:07 -0700)]
glsl: Add without_array type predicate

Returns the type without any arrays.

This will be used in later patches in this series.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Suggested-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: Use constant_expression_value instead of as_constant
Ian Romanick [Fri, 18 Jul 2014 23:10:16 +0000 (16:10 -0700)]
glsl: Use constant_expression_value instead of as_constant

Just a few lines earlier we may have wrapped the index expression with
ir_unop_i2u expression.  Whenever that happens, as_constant will return
NULL, and that almost always happens.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agotargets/graw-gdi: link with mesautil, not mesautils
Brian Paul [Mon, 4 Aug 2014 20:15:48 +0000 (14:15 -0600)]
targets/graw-gdi: link with mesautil, not mesautils

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agowmesa: link with mesautil
Brian Paul [Mon, 4 Aug 2014 20:15:05 +0000 (14:15 -0600)]
wmesa: link with mesautil

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoosmesa: link with mesautil
Brian Paul [Mon, 4 Aug 2014 20:14:27 +0000 (14:14 -0600)]
osmesa: link with mesautil

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agotargets/libgl-gdi: link with mesautil
Brian Paul [Mon, 4 Aug 2014 20:14:11 +0000 (14:14 -0600)]
targets/libgl-gdi: link with mesautil

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agotargets/egl-static: link with libmesautil.la
Brian Paul [Mon, 4 Aug 2014 20:13:07 +0000 (14:13 -0600)]
targets/egl-static: link with libmesautil.la

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa/x86: put code in braces to silence declarations after code warning
Brian Paul [Mon, 4 Aug 2014 20:29:04 +0000 (14:29 -0600)]
mesa/x86: put code in braces to silence declarations after code warning

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agosrc/Makefile.am: Move gtest before util
Jason Ekstrand [Mon, 4 Aug 2014 19:25:36 +0000 (12:25 -0700)]
src/Makefile.am: Move gtest before util

Since the ralloc test in util/tests needs gtest, we need to make sure that
the gtest subdir is loaded first.  This fixes bug #82148.

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoutil: include c99_compat.h in format_srgb.h to get 'inline' definition
Brian Paul [Mon, 4 Aug 2014 19:38:02 +0000 (13:38 -0600)]
util: include c99_compat.h in format_srgb.h to get 'inline' definition

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoutil: include c99_compat.h in hash_table.h to get 'inline' definition
Brian Paul [Mon, 4 Aug 2014 19:34:54 +0000 (13:34 -0600)]
util: include c99_compat.h in hash_table.h to get 'inline' definition

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agotargets/vdpau: link with libmesautil.la to fix build breakage
Brian Paul [Mon, 4 Aug 2014 19:09:43 +0000 (13:09 -0600)]
targets/vdpau: link with libmesautil.la to fix build breakage

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoxlib: fix missing mesautil build breakage
Brian Paul [Mon, 4 Aug 2014 19:08:58 +0000 (13:08 -0600)]
xlib: fix missing mesautil build breakage

Fixes the non-DRI build.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agosvga: SVGA_3D_CMD_BIND_GB_SHADER needs to reserve two relocations.
Matthew McClure [Fri, 27 Jun 2014 17:24:08 +0000 (10:24 -0700)]
svga: SVGA_3D_CMD_BIND_GB_SHADER needs to reserve two relocations.

With this patch, the SVGA_3D_CMD_BIND_GB_SHADER functionality will reserve
two relocations, one for the shader ID and the second for the MOB ID.

Verified with the WDDM winsys path that the number of relocations and patch
locations required is two.

Fixes Bug 1277406

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
9 years agogallium: Add libmesautil dependency to gdm and xa targets
Jason Ekstrand [Mon, 4 Aug 2014 19:34:04 +0000 (12:34 -0700)]
gallium: Add libmesautil dependency to gdm and xa targets

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa/main: Use the RGB <-> sRGB conversion functions in libmesautil
Jason Ekstrand [Thu, 24 Jul 2014 19:32:49 +0000 (12:32 -0700)]
mesa/main: Use the RGB <-> sRGB conversion functions in libmesautil

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agogallium: Move sRGB <-> RGB handling to libmesautil
Jason Ekstrand [Thu, 24 Jul 2014 18:17:53 +0000 (11:17 -0700)]
gallium: Move sRGB <-> RGB handling to libmesautil

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoutil: Gather some common macros
Jason Ekstrand [Wed, 23 Jul 2014 21:58:52 +0000 (14:58 -0700)]
util: Gather some common macros

This gathers macros that have been included across components into util so
that the include chain can be more vertical.  In particular, this makes
util stand on its own without any dependence whatsoever on the rest of
mesa.

Signed-off-by: "Jason Ekstrand" <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoutil: Move the open-addressing linear-probing hash_table to src/util.
Kenneth Graunke [Tue, 25 Feb 2014 09:08:45 +0000 (01:08 -0800)]
util: Move the open-addressing linear-probing hash_table to src/util.

This hash table is used in core Mesa, the GLSL compiler, and the i965
driver, which makes it a good candidate for the new src/util module.

It's much faster than program/hash_table.[ch] (see commit 6991c2922f5
for data), and José's u_hash_table.c has a comment saying Gallium should
probably consider switching to a linear probing hash table at some point.
So this seems like the best candidate for a shared data structure.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
v2 (Jason Ekstrand): Pick up another hash_table use and patch up scons

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoutil: Move ralloc to a new src/util directory.
Kenneth Graunke [Tue, 25 Feb 2014 07:39:14 +0000 (23:39 -0800)]
util: Move ralloc to a new src/util directory.

For a long time, we've wanted a place to put utility code which isn't
directly tied to Mesa or Gallium internals.  This patch creates a new
src/util directory for exactly that purpose, and builds the contents as
libmesautil.la.

ralloc seemed like a good first candidate.  These days, it's directly
used by mesa/main, i965, i915, and r300g, so keeping it in src/glsl
didn't make much sense.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
v2 (Jason Ekstrand): More realloc uses and some scons fixes

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agomesa/SConscript: Use Makefile.sources instead of duplicating the file lists
Jason Ekstrand [Thu, 24 Jul 2014 00:20:12 +0000 (17:20 -0700)]
mesa/SConscript: Use Makefile.sources instead of duplicating the file lists

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agotargets/dri: resolve the scons build
Emil Velikov [Sat, 2 Aug 2014 03:49:33 +0000 (04:49 +0100)]
targets/dri: resolve the scons build

With earlier commit we've conditionally enabled/added the kms_dri target
for automake builds. Unfortunately the we forgot to add the appropriate
define in the scons build, resulting in a broken library due to the
undefined symbol 'kms_swrast_create_screen'.

Reported-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Roland Scheidegger <sroland@vmware.com>
9 years agomesa/st: Fix compiler warnings
Jan Vesely [Fri, 25 Jul 2014 14:33:00 +0000 (08:33 -0600)]
mesa/st: Fix compiler warnings

both array and index are unsigned types

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agogallium: Fix compiler warning.
Jan Vesely [Fri, 25 Jul 2014 14:33:00 +0000 (08:33 -0600)]
gallium: Fix compiler warning.

warning: type qualifiers ignored on function return type

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoglsl: fix switch statement default case regressions
Tapani Pälli [Fri, 25 Jul 2014 06:40:13 +0000 (09:40 +0300)]
glsl: fix switch statement default case regressions

This patch fixes regressions caused by commit 48deb4d. Regressions
happened because 'run_default' var did not get initialized when default
case was the last one.

Now all the switch tests in es3conform suite are passing.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81857

9 years agost/dri: Fix driver loading if swrast isn't built
Aaron Watry [Sat, 2 Aug 2014 21:10:34 +0000 (16:10 -0500)]
st/dri: Fix driver loading if swrast isn't built

If building hardware drivers only, then kms_swrast_create_screen
won't be defined in inline_drm_helper.h and hardware drivers will
fail to dlopen as a result.

Copy the #if guards from inline_drm_helper.h to dri_kms_init_screen
to make the definition/use of the function match.

Fixes radeonsi_dri.so dlopen with the following configure:

./configure --with-dri-drivers= --with-dri-driverdir=/usr/local/lib/dri/ \
--enable-gbm --enable-gallium-gbm --enable-debug --enable-opencl \
--enable-opencl-icd --with-gallium-drivers=radeonsi \
--with-egl-platforms=drm --enable-glx-tls --enable-texture-float \
--enable-omx

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomesa/st: only convert AND(a, NOT(b)) into MAD when not using native integers
Ilia Mirkin [Sun, 3 Aug 2014 05:27:32 +0000 (01:27 -0400)]
mesa/st: only convert AND(a, NOT(b)) into MAD when not using native integers

Native integers imply a somewhat different handling of booleans. Instead
of being 1.0/0.0 floats, they are 0 (true) / -1 (false) integers. As such
the original optimization no longer applies.

Reported-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
9 years agoRemove XA state tracker support for Radeon
Marek Olšák [Wed, 30 Jul 2014 19:24:59 +0000 (21:24 +0200)]
Remove XA state tracker support for Radeon

We don't support this type of X acceleration and we never did.
Other drivers might want to do the same thing.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodocs: Import 10.2.5 release notes, add news item.
Carl Worth [Sun, 3 Aug 2014 05:54:26 +0000 (22:54 -0700)]
docs: Import 10.2.5 release notes, add news item.

9 years agomesa/st: add support for dynamic ubo selection
Ilia Mirkin [Sun, 6 Jul 2014 05:37:03 +0000 (01:37 -0400)]
mesa/st: add support for dynamic ubo selection

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
v2: fix src register, use index2D for base of 1
Acked-by: Marek Olšák <marek.olsak@amd.com>
9 years agoi965: Delete stale "pre-gen4" comment in texture validation code.
Kenneth Graunke [Sat, 1 Feb 2014 09:10:15 +0000 (01:10 -0800)]
i965: Delete stale "pre-gen4" comment in texture validation code.

In commit 16060c5adcd4d809f97e874fcde763260c17ac18, Eric changed the
code to not relayout just for baselevel changes - only if the range of
miplevels actually increases.  So this comment is now wrong.

Notably, the i915 version of the code actually does what the comment
says.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Delete sampler state structures.
Kenneth Graunke [Sun, 27 Jul 2014 03:30:58 +0000 (20:30 -0700)]
i965: Delete sampler state structures.

We've moved to using bitshifts (like we did for surface state); nothing
uses the structures anymore.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Replace sizeof(struct gen7_sampler_state) with the size itself.
Kenneth Graunke [Sun, 27 Jul 2014 03:36:49 +0000 (20:36 -0700)]
i965: Replace sizeof(struct gen7_sampler_state) with the size itself.

These are the last users of struct gen7_sampler_state.

v2: Use a local sampler_state_size variable, to help distinguish the
    various 16s (suggested by Topi Pohjolainen).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Drop sizeof(struct brw_sampler_state) from estimated prim size.
Kenneth Graunke [Sun, 27 Jul 2014 03:32:41 +0000 (20:32 -0700)]
i965: Drop sizeof(struct brw_sampler_state) from estimated prim size.

This is the last user of the structure.

v2: Use a local variable with a sensible name so people know what 16 is.
    (Suggested by Topi Pohjolainen).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Make BLORP use brw_emit_sampler_state().
Kenneth Graunke [Sun, 27 Jul 2014 03:49:32 +0000 (20:49 -0700)]
i965: Make BLORP use brw_emit_sampler_state().

This simplifies the code, removes use of the old structures, and also
allows us to combine the Gen6 and Gen7+ code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Delete redundant sampler state dumping code.
Kenneth Graunke [Sun, 27 Jul 2014 03:43:40 +0000 (20:43 -0700)]
i965: Delete redundant sampler state dumping code.

Although the Gen4-6 and Gen7+ variants used different structure types,
they didn't use any of the fields - only the size, which is identical.
So both decoders did exactly the same thing.

Someday we should implement useful decoders for SAMPLER_STATE.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Make some brw_sampler_state.c functions static again.
Kenneth Graunke [Sun, 27 Jul 2014 01:10:53 +0000 (18:10 -0700)]
i965: Make some brw_sampler_state.c functions static again.

Now that gen7_sampler_state.c is gone, everything is once again in a
single file.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Stop using gen7_update_sampler_state; rm gen7_sampler_state.c.
Kenneth Graunke [Sat, 26 Jul 2014 20:15:56 +0000 (13:15 -0700)]
i965: Stop using gen7_update_sampler_state; rm gen7_sampler_state.c.

The code in brw_sampler_state.c now handles all generations; we don't
need the extra Gen7+ only code anymore.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Make brw_update_sampler_state use 8 bits for LOD fields on Gen7+.
Kenneth Graunke [Sat, 26 Jul 2014 20:12:37 +0000 (13:12 -0700)]
i965: Make brw_update_sampler_state use 8 bits for LOD fields on Gen7+.

This was the only actual difference between Gen4-6 and Gen7+ in terms of
the values we program.  The rest was just mechanical structure
rearrangement.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Make brw_update_sampler_state() use brw_emit_sampler_state().
Kenneth Graunke [Sat, 26 Jul 2014 10:04:12 +0000 (03:04 -0700)]
i965: Make brw_update_sampler_state() use brw_emit_sampler_state().

Instead of stuffing bits directly into the brw_sampler_state structure,
we now store them in local variables, then use brw_emit_sampler_state()
to assemble the packet.  This separates the decision about what values
to use from the actual packet emission, which makes the code more
reusable across generations.

v2: Put const on a bunch of local variables and move declarations,
    as suggested by Topi Pohjolainen.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Introduce a function to emit a SAMPLER_STATE structure.
Kenneth Graunke [Sat, 26 Jul 2014 19:58:20 +0000 (12:58 -0700)]
i965: Introduce a function to emit a SAMPLER_STATE structure.

This simply assembles all the SAMPLER_STATE fields into their proper bit
locations.  Making it work on all generations was easy enough; some of
the fields are even in the same place.

Not used by anything yet, but will be soon.  I made it non-static so
BLORP can use it too.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Add const to upload_default_color's sampler parameter.
Kenneth Graunke [Wed, 30 Jul 2014 17:50:12 +0000 (10:50 -0700)]
i965: Add const to upload_default_color's sampler parameter.

It doesn't edit the value, and this lets us use const in more places.

Needed to implement Topi's review comments for the next patch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Add #defines for SAMPLER_STATE fields.
Kenneth Graunke [Sat, 26 Jul 2014 19:32:31 +0000 (12:32 -0700)]
i965: Add #defines for SAMPLER_STATE fields.

We'll use these to replace the existing structures.

I've adopted the convention that "BRW" applies to all hardware, and
"GENX" applies starting with generation X, but might be replaced by some
later generation.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Convert wrap mode #defines to an enum.
Kenneth Graunke [Sat, 26 Jul 2014 19:06:20 +0000 (12:06 -0700)]
i965: Convert wrap mode #defines to an enum.

This makes it easy to tell that they're grouped together, and also
improves gdb printing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Delete gen7_upload_sampler_state_table and vtable mechanism.
Kenneth Graunke [Sat, 26 Jul 2014 18:48:50 +0000 (11:48 -0700)]
i965: Delete gen7_upload_sampler_state_table and vtable mechanism.

brw_upload_sampler_state_table now handles all generations, so we don't
need the vtable mechanism either.

There's still a lot of code duplication; the next patches will address
that.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Make brw_upload_sampler_state_table handle Gen7+ as well.
Kenneth Graunke [Sat, 26 Jul 2014 18:36:33 +0000 (11:36 -0700)]
i965: Make brw_upload_sampler_state_table handle Gen7+ as well.

This copies a few changes from gen7_upload_sampler_state_table; the next
patch will delete that function.

Gen7+ has per-stage sampler state pointer update packets, so we emit
them as soon as we emit a new table for a stage.  On Gen6 and earlier,
we have a single packet, so we delay until we've changed everything
that's going to be changed.

v2: Split 3DSTATE_SAMPLER_STATE_POINTERS_XS packet emission into a
    helper function (suggested by Topi Pohjolainen).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Shift brw_upload_sampler_state_table away from structures.
Kenneth Graunke [Sat, 26 Jul 2014 18:27:57 +0000 (11:27 -0700)]
i965: Shift brw_upload_sampler_state_table away from structures.

The Gen4-6 and Gen7+ code is virtually identical, but both use different
structure types.  Switching to use a uint32_t pointer and operate on the
number of DWords will make it possible to share code.

It turns out that SURFACE_STATE is the same number of DWords on every
platform currently; it will be easy to handle a change there, though.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Push computation for sampler state batch offsets up a level.
Kenneth Graunke [Sat, 26 Jul 2014 18:20:02 +0000 (11:20 -0700)]
i965: Push computation for sampler state batch offsets up a level.

Other than this, brw_update_sampler_state only deals with a single
SAMPLER_STATE structure, and doesn't need to know which position it is
in the table.  The caller takes care of dealing with multiple surface
states.

Pushing this up a level allows us to drop the ss_index parameter.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Drop unused 'ss_index' parameter from gen7_update_sampler_state.
Kenneth Graunke [Sat, 26 Jul 2014 18:42:27 +0000 (11:42 -0700)]
i965: Drop unused 'ss_index' parameter from gen7_update_sampler_state.

This was copied from the Gen4-6 code, but is unused.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Stop storing sdc_offset in brw_stage_state.
Kenneth Graunke [Sat, 26 Jul 2014 09:34:02 +0000 (02:34 -0700)]
i965: Stop storing sdc_offset in brw_stage_state.

sdc_offset is produced and consumed in the same function, so there's no
need to store it in the context, nor pass pointers to it through various
call chains.

Saves 128 bytes per brw_stage_state structure, and makes the code
clearer as well.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Drop the degenerate brw_sampler_default_color structure.
Kenneth Graunke [Wed, 7 May 2014 05:35:27 +0000 (22:35 -0700)]
i965: Drop the degenerate brw_sampler_default_color structure.

It's just an array of four floats, and we have an array of four floats,
so this is literally just a memcpy...but with custom structs and strange
macros to give the appearance of doing something more.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Write a better file comment for brw_sampler_state.c.
Kenneth Graunke [Sat, 26 Jul 2014 19:03:21 +0000 (12:03 -0700)]
i965: Write a better file comment for brw_sampler_state.c.

The old one has been inaccurate for years.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Rename brw_wm_sampler_state.c to brw_sampler_state.c.
Kenneth Graunke [Sat, 26 Jul 2014 08:26:54 +0000 (01:26 -0700)]
i965: Rename brw_wm_sampler_state.c to brw_sampler_state.c.

When the driver was originally written, it only supported texturing in
the pixel shader backend; vertex and geometry shader texturing came much
later.  Originally, the pixel shader was referred to as "WM" (the
Windowizer/Masker unit).  So, this code happened to only be relevant for
the WM stage, at the time.

However, sampler state really applies to all stages, so putting "wm" in
the filename doesn't make sense.  I dropped it in gen7_sampler_state.c;
at this point the asymmetry just trips people up.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/blorp: Don't set min_mag_neq bit in Gen6 SAMPLER_STATE.
Kenneth Graunke [Tue, 29 Jul 2014 20:33:43 +0000 (13:33 -0700)]
i965/blorp: Don't set min_mag_neq bit in Gen6 SAMPLER_STATE.

The "Min/Mag State Not Equal" bit is supposed to be set when the min/mag
filters or address rounding modes differ.  BLORP uses identical min/mag
settings, so the bit should be unset.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agodefine GL_OES_standard_derivatives if extension is supported
Kevin Rogovin [Mon, 19 May 2014 07:52:44 +0000 (10:52 +0300)]
define GL_OES_standard_derivatives if extension is supported

Define the macro GL_OES_standard_derivatives as 1 if the extension
GL_OES_standard_derivatives is supported.

V2 [Chris]: Correct trailing whitespace

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agollvmpipe: don't store number of layers per level
Roland Scheidegger [Fri, 1 Aug 2014 21:22:39 +0000 (23:22 +0200)]
llvmpipe: don't store number of layers per level

This could be recalculated, though it turns out the only use of it after
resource allocation is for calculating whole resource size (for scene size
accounting though that isn't quite ideal neither). Thus, instead just store
the whole resource size and drop it (saving a couple bytes of storage per
resource). It makes things simpler too. Note that for the accounting winsys
resources always come back with size 0 but this is unchanged (we don't actually
know the size in any case).
Also reformat llvmpipe_texture_layout (drop unneded indentation).

v2: adapt to previous changes.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agollvmpipe: integrate memory allocation into llvmpipe_texture_layout
Roland Scheidegger [Fri, 1 Aug 2014 01:08:11 +0000 (03:08 +0200)]
llvmpipe: integrate memory allocation into llvmpipe_texture_layout

Seems pointless to just duplicate some of the calculations (the calculation
of actual memory used compared to what was predicted in llvmpipe_texture_layout
actually could have differed slightly in some cases due to different alignment
rules used though this should have been of no consequence).

v2: keep the previous mip alignment of MAX2(64, cacheline). This was added for
ARB_map_buffer_alignment - I'm not convinced it's needed for textures, but
it was supposed to be cleanup without functional change. Also replace div
with 64bit mul / comparison.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agollvmpipe: get rid of impossible code in alloc_image_data
Roland Scheidegger [Thu, 31 Jul 2014 17:13:57 +0000 (19:13 +0200)]
llvmpipe: get rid of impossible code in alloc_image_data

Only used for non display target resources.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoi965/miptree: Layout 1D Array as 2D Array with height of 1
Jordan Justen [Thu, 31 Jul 2014 07:16:19 +0000 (00:16 -0700)]
i965/miptree: Layout 1D Array as 2D Array with height of 1

1D array miptrees were being laid out as a 2D texture with 1 slice.
This happened due to the mesa core storing the 1D array slice count in
the height field. On Intel hardware, we want to create a 2D array with
a height of 1 for the 1D array case.

Fixes assertion failure in piglit (gen6, gen8):
spec/glsl-1.30/execution/tex-miplevel-selection textureOffset 1DArrayShadow

In release builds of Mesa, this test was observed to cause a GPU hang
on gen8.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81450
Tested-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agor600g: Implement gpu_shader5 textureGather
Glenn Kennard [Sun, 20 Jul 2014 13:59:16 +0000 (15:59 +0200)]
r600g: Implement gpu_shader5 textureGather

Adds 0-3 textureGather component selection and non-constant offsets

Caveat: 0 and 1 texture swizzles only work if textureGather component
select is 3 or a component that does not exist in the sampler texture
format. This is a hardware limitation, any other value returns
128/255=0.501961 for both 0 and 1.

Passes all textureGather piglit tests on radeon 6670, except for those
using 0/1 texture swizzles due to aforementioned reason.

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
9 years agomesa: Add missing atomic buffer bindings and unbindings
Aditya Atluri [Thu, 24 Jul 2014 19:18:49 +0000 (15:18 -0400)]
mesa: Add missing atomic buffer bindings and unbindings

Reviewed-by: Marek Olšák <marek.olsak@amd.com>