Matt Turner [Thu, 31 Mar 2016 02:18:16 +0000 (19:18 -0700)]
nir: Fix typo from commit
6702f1acde9.
Timothy Arceri [Thu, 10 Mar 2016 05:41:03 +0000 (16:41 +1100)]
docs: mark xfb_* qualifiers as DONE
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Thu, 10 Mar 2016 05:17:13 +0000 (16:17 +1100)]
mesa: add query support for GL_TRANSFORM_FEEDBACK_BUFFER interface
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Thu, 10 Mar 2016 04:04:02 +0000 (15:04 +1100)]
glsl: add transform feedback buffers to resource list
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Thu, 10 Mar 2016 04:57:19 +0000 (15:57 +1100)]
mesa: add support to query GL_TRANSFORM_FEEDBACK_BUFFER_INDEX
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Thu, 10 Mar 2016 00:40:37 +0000 (11:40 +1100)]
mesa: add support to query GL_OFFSET for GL_TRANSFORM_FEEDBACK_VARYING
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Thu, 10 Mar 2016 04:20:32 +0000 (15:20 +1100)]
mesa: rename tranform feeback varying macro XFB to XFV
A latter patch will use XFB for buffers.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Mon, 14 Mar 2016 00:16:55 +0000 (11:16 +1100)]
glsl: always enable transform feedback mode when xfb_stride defined
This enables in shader defined transform feedback mode even if the
only place xfb_stride is defined is on the global out.
We don't worry about xfb_buffer since Issue 22 c) in the spec says:
"If the shader has an "xfb_buffer" qualifier identifying a buffer,
but doesn't declare "xfb_offset" on anything associated with it,
what happens?
...
variables not qualified with "xfb_offset" are not captured, which
makes the associated "xfb_buffer" qualifier irrelevant."
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Sun, 13 Mar 2016 23:32:17 +0000 (10:32 +1100)]
glsl: handle varyings that are not written to but have an xfb_offset
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Sun, 13 Mar 2016 23:17:48 +0000 (10:17 +1100)]
glsl: when lowering named interface set assigned flag
This will be used when checking if xfb should attempt to capture
a varying.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Sun, 13 Mar 2016 05:36:25 +0000 (16:36 +1100)]
glsl: reset current stream tracker
When we move to the next buffer we need to reset the stream
so that we don't generate an error message about streams not
matching.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Fri, 11 Mar 2016 02:53:13 +0000 (13:53 +1100)]
glsl: generate link error when implicit stride is to large
This moves the check until after we have done the stride
calculation and applies it to the xfb_* qualifiers.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Thu, 3 Mar 2016 04:26:53 +0000 (15:26 +1100)]
glsl: add xfb_stride link time validation
From the ARB_enhanced_layous spec:
"It is a compile-time or link-time error to have any *xfb_offset*
that overflows *xfb_stride*, whether stated on declarations before
or after the *xfb_stride*, or in different compilation units.
...
When no *xfb_stride* is specified for a buffer, the stride of a
buffer will be the smallest needed to hold the variable placed at
the highest offset, including any required padding."
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Fri, 11 Mar 2016 00:57:52 +0000 (11:57 +1100)]
glsl: validate global out xfb_stride qualifiers and set stride on empty buffers
Here we use the built-in validation in
ast_layout_expression::process_qualifier_constant() to check for mismatching
global out strides on buffers in a single shader.
From the ARB_enhanced_layouts spec:
"While *xfb_stride* can be declared multiple times for the same buffer,
it is a compile-time or link-time error to have different values
specified for the stride for the same buffer."
For intrastage validation a new helper link_xfb_stride_layout_qualifiers()
is created. We also take this opportunity to make sure stride is at least
a multiple of 4, we will validate doubles at a later stage.
From the ARB_enhanced_layouts spec:
"If the buffer is capturing any double-typed outputs, the stride must
be a multiple of 8, otherwise it must be a multiple of 4, or a
compile-time or link-time error results."
Finally we update store_tfeedback_info() to apply the strides to
LinkedTransformFeedback and update the buffers bitmask to mark any global
buffers with a stride as active. For example a shader with:
layout (xfb_buffer = 0, xfb_offset = 0) out vec4 gs_fs;
layout (xfb_buffer = 1, xfb_stride = 64) out;
Is expected to have a buffer bound to both 0 and 1.
From the ARB_enhanced_layouts spec:
"A binding point requires a bound buffer object if and only if its
associated stride in the program object used for transform feedback
primitive capture is non-zero."
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Thu, 10 Mar 2016 04:00:00 +0000 (15:00 +1100)]
mesa: split transform feedback buffer into its own struct
This will be used in a following patch to implement interface
query support for TRANSFORM_FEEDBACK_BUFFER.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Thu, 3 Mar 2016 02:20:01 +0000 (13:20 +1100)]
glsl: use bitmask of active xfb buffer indices
This allows us to print the correct binding point when not all
buffers declared in the shader are bound.
For example if we use a single buffer:
layout(xfb_buffer=2, offset=0) out vec4 v;
We now print '2' when the buffer is not bound rather than '0'.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Fri, 11 Mar 2016 12:16:16 +0000 (23:16 +1100)]
glsl: sort xfb varyings in offset/buffer order
The existing transform feedback code expects to receive the list
of varyings in increasing buffer order.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Wed, 24 Feb 2016 05:40:32 +0000 (16:40 +1100)]
glsl: basic linking support for xfb qualifiers
This adds the initial infrastructure for enabling transform feedback
mode via in shader qualifiers and adds initial buffer support.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Wed, 24 Feb 2016 05:37:02 +0000 (16:37 +1100)]
glsl: add xfb helpers and fields to the tfeedback_decl class
We also apply any array/struct offsets.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Wed, 24 Feb 2016 05:27:03 +0000 (16:27 +1100)]
glsl: add helper to process xfb qualifiers during linking
This function checks for any xfb_* qualifiers which will enable
transform feedback mode and cause any API defined xfb varyings
to be ignored.
It also counts the number of varyings that have a xfb_offset
qualifier and finally it calls the create_xfb_varying_names()
helper to generate the names of varyings to be caputured.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Wed, 24 Feb 2016 04:40:31 +0000 (15:40 +1100)]
glsl: add helper to generate xfb varying names
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Tue, 15 Mar 2016 06:52:06 +0000 (17:52 +1100)]
glsl: add helper for counting varyings
This will be used to get a count of the number of varying name
strings we are required to generate for use with the query api.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Mon, 15 Feb 2016 02:27:55 +0000 (13:27 +1100)]
glsl: add xfb qualifier lowering support for named blocks
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Fri, 22 Jan 2016 05:22:40 +0000 (16:22 +1100)]
glsl: add xfb qualifiers to has_layout helper
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Thu, 10 Mar 2016 00:51:48 +0000 (11:51 +1100)]
glsl: apply xfb_stride to implicit offsets for ifc block members
When we have an interface block like:
layout (xfb_buffer = 0, xfb_offset = 0) out Block {
vec4 var1;
layout (xfb_stride = 32) vec4 var2;
vec4 var3;
};
We take into account the stride of var2 when calculating the offset
for var3.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Sat, 13 Feb 2016 03:53:45 +0000 (14:53 +1100)]
glsl: add xfb_stride compile time rules
From the ARB_enhanced_layouts spec:
"The *xfb_stride* qualifier specifies how many bytes are consumed
by each captured vertex. It applies to the transform feedback
buffer for that declaration, whether it is inherited or explicitly
declared. It can be applied to variables, blocks, block members,
or just the qualifier out. If the buffer is capturing any
double-typed outputs, the stride must be a multiple of 8, otherwise
it must be a multiple of 4, or a compile-time or link-time error
results.
...
The resulting stride (implicit or explicit) must be less than or
equal to the implementation-dependent constant
gl_MaxTransformFeedbackInterleavedComponents."
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Wed, 24 Feb 2016 04:21:59 +0000 (15:21 +1100)]
glsl: add xfb_offset compile time rules
We also copy the qualifier values to the IR in this step.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Fri, 11 Mar 2016 12:00:16 +0000 (23:00 +1100)]
glsl: add xfb_buffer compile time rules
Also copies the qualifier values to GLSL IR.
From the ARB_enhanced_layouts spec:
"The *xfb_buffer* qualifier can be applied to the qualifier out,
to output variables, to output blocks, and to output block
members. Shaders in the transform feedback capturing mode have
an initial global default of
layout(xfb_buffer = 0) out;
This default can be changed by declaring a different buffer with
xfb_buffer on the interface qualifier out. This is the only way
the global default can be changed. When a variable or output block
is declared without an xfb_buffer qualifier, it inherits the global
default buffer. When a variable or output block is declared with an
xfb_buffer qualifier, it has that declared buffer. All members of a
block inherit the block's buffer. A member is allowed to declare
an xfb_buffer, but it must match the buffer inherited from its
block, or a compile-time error results.
The *xfb_buffer* qualifier follows the same conventions, behavior,
defaults, and inheritance rules as the qualifier stream, and the
examples for stream apply here as well. This includes a block's
inheritance of the current global default buffer, a block member's
inheritance of the block's buffer, and the requirement that any
*xfb_buffer* declared on a block member must match the buffer
inherited from the block.
...
It is a compile-time error to specify an *xfb_buffer* that is
greater than the implementation-dependent constant
gl_MaxTransformFeedbackBuffers."
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Wed, 24 Feb 2016 04:18:09 +0000 (15:18 +1100)]
glsl: add field to track if xfb_buffer is an explicit or implicit value
Since any of the xfb_* qualifiers trigger the shader to be in
transform feedback mode we need an extra field to track if
the xfb_buffer on interface members was set explicitly since
xfb_buffer will always have a default value.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Wed, 24 Feb 2016 05:06:00 +0000 (16:06 +1100)]
glsl: add xfb_* qualifiers to glsl_struct_field
These will be used to hold qualifier values for interface and
struct members.
Support is added to the struct/interface constructors to copy these
fields upon creation.
We also update record_compare() to ensure we don't reuse a glsl_type
with the wrong xfb_* qualifier values.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Thu, 21 Jan 2016 05:22:12 +0000 (16:22 +1100)]
glsl: add IR fields for transform feedback layout qualifiers
Adds xfb_buffer/stride fields and adds comment to offset field
which is reused for xfb_offset.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Tue, 9 Feb 2016 11:24:30 +0000 (22:24 +1100)]
glsl: add validation for out layout qualifiers
This adds validation for all qualifiers as allowed by the
table in Section 4.4 (Layout Qualifiers) of the GLSL 4.5 spec.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Mon, 18 Jan 2016 09:46:29 +0000 (20:46 +1100)]
glsl: relax stage restrictions on layout defaults for outputs
The new xfb_buffer and xfb_stride global qualifiers are allowed in
geom, tess and vertex stages.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Fri, 22 Jan 2016 01:45:10 +0000 (12:45 +1100)]
glsl: parse new transform feedback layout qualifiers
We reuse the existing offset field for holding the xfb_offset
expression but create a new flag as to avoid hitting the rules
for the offset qualifier for UBOs.
xfb_buffer qualifiers require extra processing when merging as
they can be applied to global out defaults. We just apply the
same rules as we do for the stream qualifier as the spec says:
"The *xfb_buffer* qualifier follows the same conventions,
behavior, defaults, and inheritance rules as the qualifier
stream, and the examples for stream apply here as well."
For xfb_stride we push everything into a global out field for
later processing as xfb_stride applies to the entire buffer.
We still need to have a separate field to store per variable
strides because they can still effect implicit offsets
e.g. when applied to block members with implicit offsets.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Sat, 5 Mar 2016 01:16:22 +0000 (12:16 +1100)]
glsl: move process_qualifier_constant() to ast_type.cpp
We will make use of this function being here in the following patch.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Wed, 13 Jan 2016 03:40:05 +0000 (14:40 +1100)]
glsl: add transform feedback built-in constants
These are new built-ins added by ARB_enhanced_layouts.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Fri, 11 Mar 2016 05:15:02 +0000 (16:15 +1100)]
glsl: generate named interface block names correctly
Firstly this updates the named interface lowering pass to store the
interface without the arrays removed.
Note we need to remove the arrays in the interface/varying matching
code to not regress things but in future this should be fixed
futher as it would seem we currently successfully match interface
blocks with differnt array sizes.
Since we now know if the interface was an array we can reduce the
IR flags from_named_ifc_block_array and from_named_ifc_block_nonarray
to just from_named_ifc_block.
Next rather than having a different code path for named interface
blocks in program_resource_visitor we just make use of the one used
by UBOs this allows us to now handle arrays of arrays correctly.
Finally we add a new param to the recursion function
named_ifc_member this is because we only want to process a single
member at a time. Note that this is also the glsl_struct_field
from the original ifc type before lowering rather than the type
from the lowered variable. This fixes a bug in Mesa where we would
generate the names like WithInstArray[0].g[0][0] when it should be
WithInstArray[0].g[0] for the following interface.
out WithInstArray {
float g[3];
} instArray[2];
Reviewed-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Wed, 9 Mar 2016 05:58:29 +0000 (16:58 +1100)]
glsl: Fix segfault when lhs is error_type in TCS
It seems expected that both lhs and rhs could be of type error_type
in this code however the TCS case wasn't expecting it.
Fixes segfault in an enhanced layouts GL CTS test.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Mon, 21 Mar 2016 22:00:52 +0000 (08:00 +1000)]
docs: update softpipe status for shader_image_load_store.
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Mon, 21 Mar 2016 21:59:35 +0000 (07:59 +1000)]
softpipe: add image support to softpipe (v3)
This adds support for ARB_shader_image_load_store to softpipe.
v2: add RESQ support (Ilia)
v3: constify, cleanup internals, add some comments (Brian).
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Mon, 21 Mar 2016 21:58:39 +0000 (07:58 +1000)]
draw: add support for passing images to vs/gs shaders.
This just adds support for passing through images to the
tgsi execution stage.
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Mon, 21 Mar 2016 21:53:48 +0000 (07:53 +1000)]
tgsi: add support for image operations to tgsi_exec. (v2.1)
This adds support for load/store/atomic operations on images
along with image tracking support.
v2: add RESQ support. (Ilia)
v2.1: constify interface (Brian)
split get_image_coord_dim (Brian)
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Mon, 21 Mar 2016 21:52:26 +0000 (07:52 +1000)]
softpipe: add support for explicit early depth testing
ARB_shader_image_load_store adds support for explicit early
depth testing. However we need to make sure we don't overwrite
values using the shader written values in this case.
This fixes early depth testing in softpipe to conform with
those requirements.
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Mon, 21 Mar 2016 21:50:37 +0000 (07:50 +1000)]
tgsi: introduce NonHelperMask
This is a mask of which of the current 2x2 grid are non-helper
invocations. This allows us to mask off the helper invocations
later for the image operations.
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Sun, 20 Mar 2016 22:52:14 +0000 (08:52 +1000)]
tgsi_exec: handle execmask when doing indirect lookups
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Sun, 20 Mar 2016 22:51:54 +0000 (08:51 +1000)]
tgsi_exec: add support for up to 3 address registers (v2)
v2: be consistent with other definitions.
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Matt Turner [Mon, 22 Feb 2016 23:16:49 +0000 (15:16 -0800)]
nir: Propagate negates up multiplication chains.
total instructions in shared programs:
7112159 ->
7088092 (-0.34%)
instructions in affected programs:
1374915 ->
1350848 (-1.75%)
helped: 7392
HURT: 621
GAINED: 2
LOST: 2
Matt Turner [Wed, 25 Nov 2015 01:17:29 +0000 (17:17 -0800)]
i965: Don't inline intel_batchbuffer_require_space().
It's called by the inline intel_batchbuffer_begin() function which
itself is used in BEGIN_BATCH. So in sequence of code emitting multiple
packets, we have inlined this ~200 byte function multiple times. Making
it an out-of-line function presumably improved icache usage.
Improves performance of Gl32Batch7 by 3.39898% +/- 0.358674% (n=155) on
Ivybridge.
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Christian König [Wed, 30 Mar 2016 13:38:29 +0000 (15:38 +0200)]
r600: ignore PIPE_BIND_LINEAR in *_is_format_supported
Similar to radeonsi linear layout should work for all not compressed
or depth/stencil formats. Fixes issues with VDPAU on r600.
Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Thomas Hindoe Paaboel Andersen [Wed, 30 Mar 2016 06:13:24 +0000 (08:13 +0200)]
st/vdpau: correct null check
The null check of result was the wrong way around. Also, move memset
and dereference of result after the null check.
Reviewed-by: Christian König <christian.koenig@amd.com>
Brian Paul [Wed, 30 Mar 2016 17:22:07 +0000 (11:22 -0600)]
docs: remove docs/COPYING which contains GPL license
There hasn't been GPL code in Mesa for a long time now.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Samuel Pitoiset [Tue, 29 Mar 2016 21:11:07 +0000 (23:11 +0200)]
glsl: add missing types for buffer images
Type of GLSL_SAMPLER_DIM_BUF can be sampler or image.
Spotted while trying to run dEQP tests related to
ARB_shader_image_load_store.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Lars Hamre [Tue, 29 Mar 2016 00:42:14 +0000 (20:42 -0400)]
glsl: invalidate float suffixes for GLSL 1.10 and GLSL ES 1.00
Float suffixes are not allowed in GLSL 1.10 nor GLSL ES 1.00.
Fixes the following piglit tests:
tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-capital-f.vert
tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-f.vert`
v2: modify error message
v3: parse the float instead of returning an ERROR_TOK
v4: (by Ken) Change to is_version(120, 300) to avoid breaking ES3
shaders; update commit message accordingly.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81585
Signed-off-by: Lars Hamre <chemecse@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Roland Scheidegger [Wed, 30 Mar 2016 02:25:45 +0000 (04:25 +0200)]
tgsi: (trivial) only verify target for is_tex instructions
d3d10 state tracker does not encode (valid) target (only offsets are
really used from the texture bits), since that information always comes
from the sview dcl, and not the instruction (note the meaning of target
is actually slightly different between gl and d3d10 in any case, because
d3d10 target does never include shadow bit).
Also move the msaa sampler identification as well - would need to set that
on the sview not sampler, so while this does not fix it make it at least
obvious it won't work with sample instructions.
Ilia Mirkin [Tue, 29 Mar 2016 19:31:05 +0000 (15:31 -0400)]
mesa: allow mutable buffer textures to back GL ES images
Since there is no way to create immutable texture buffers in GL ES,
mutable buffer textures are allowed to back images. See issue 7 of the
GL_OES_texture_buffer specification.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Brian Paul [Mon, 28 Mar 2016 23:27:27 +0000 (17:27 -0600)]
mesa: make _mesa_prepare_mipmap_level() static
No longer called from any other file.
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
Brian Paul [Tue, 29 Mar 2016 23:44:00 +0000 (17:44 -0600)]
meta: use _mesa_prepare_mipmap_levels()
The prepare_mipmap_level() wrapper for _mesa_prepare_mipmap_level() is
not needed. It only served to undo the GL_TEXTURE_1D_ARRAY height/depth
change was was made before the call to prepare_mipmap_level()
Said another way, regardless of how the meta code manipulates the height/
depth dims for GL_TEXTURE_1D_ARRAY, the gl_texture_image dimensions are
correctly set up by _mesa_prepare_mipmap_levels().
Tested by plugging _mesa_meta_GenerateMipmap() into the swrast driver
and testing with piglit.
v2 (idr): Early out of the mipmap generation loop with dstImage is NULL.
This can occur for immutable textures that have a limited range of
levels or in the presense of memory allocation failures. Fixes
arb_texture_view-mipgen on Intel platforms.
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Brian Paul [Tue, 29 Mar 2016 18:54:10 +0000 (12:54 -0600)]
docs: add HTTP link for Mesa downloads
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92628
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Brian Paul [Tue, 29 Mar 2016 17:43:02 +0000 (11:43 -0600)]
tgsi: simplify tgsi_shader_info::is_msaa_sampler checking
We assert that fullinst->Instruction.Texture != 0 above so no need to
check it in the conditional. We also have the fullinst->Texture.Texture
value in a local variable, so use it.
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Brian Paul [Sat, 26 Mar 2016 17:46:53 +0000 (11:46 -0600)]
tgsi: collect texture sampler target info in tgsi_scan_shader()
Texture sample instructions specify a sampler unit and texture target
such as "1D", "2D", "CUBE", etc. Sampler view declarations also specify
the sampler unit and texture target.
This patch checks that the texture instructions agree with the declarations
and collects the texture target type for each sampler unit.
v2: only compare instruction's texture target to the sampler view declaration
target if the instruction is a TEX instruction, not a SAMPLE instruction.
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Brian Paul [Tue, 29 Mar 2016 17:32:24 +0000 (11:32 -0600)]
gallium/docs: s/gven/given/
Brian Paul [Sat, 26 Mar 2016 17:35:00 +0000 (11:35 -0600)]
xlib: add support for GLX_ARB_create_context
This adds the glXCreateContextAttribsARB() function for the xlib/swrast
driver. This allows more piglit tests to run with this driver.
For example, without this patch we get:
$ bin/fbo-generatemipmap-1d -auto
piglit: error: waffle_config_choose failed due to WAFFLE_ERROR_UNSUPPORTED_
ON_PLATFORM: GLX_ARB_create_context is required in order to request an OpenGL
version not equal to the default value 1.0
piglit: error: Failed to create waffle_config for OpenGL 2.0 Compatibility Context
piglit: info: Failed to create any GL context
PIGLIT: {"result": "skip" }
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>
Brian Paul [Thu, 24 Mar 2016 20:09:24 +0000 (14:09 -0600)]
st/mesa: simplify st_generate_mipmap()
The whole st_generate_mipmap() function was overly complicated. Now
we just call the new _mesa_prepare_mipmap_levels() function to prepare
the texture mipmap memory, then call the generate function which fills
in the texture images.
This fixes a failed assertion in llvmpipe/softpipe which is hit with the
new piglit generatemipmap-base-change test. Also fixes some device errors
(format mismatches) with the VMware svga driver.
v2: fix a comment typo, per Sinclair
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Brian Paul [Thu, 24 Mar 2016 17:24:33 +0000 (11:24 -0600)]
mesa: new _mesa_prepare_mipmap_levels() function for mipmap generation
Simplifies the loops in generate_mipmap_uncompressed() and
generate_mipmap_compressed(). Will be used in the state tracker too.
Could probably be used in the meta code. If so, some additional
clean-ups can be done after that.
v2: use unsigned types instead of GLuint, per Ian
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Kenneth Graunke [Tue, 29 Mar 2016 03:07:13 +0000 (20:07 -0700)]
i965: Don't use CUBE wrap modes for integer formats on IVB/BYT.
There is no linear filtering for integer formats, so we should always
be using CLAMP_TO_EDGE mode.
Fixes 46 dEQP cases on Ivybridge (which were likely broken by commit
0faf26e6a0a34c3544644852802484f2404cc83e).
This workaround doesn't appear to be necessary on any other hardware;
I haven't found any documentation mentioning errata in this area.
v2: Only apply on Ivybridge/Baytrail to avoid regressing GLES3.1 tests.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> [v1]
Kenneth Graunke [Tue, 29 Mar 2016 22:35:07 +0000 (15:35 -0700)]
Revert "i965: Set address rounding bits for GL_NEAREST filtering as well."
This reverts commit
60d6a8989ab44cf47accee6bc692ba6fb98f6a9f.
It's pretty sketchy, and apparently regressed a bunch of dEQP tests
on Sandybridge.
Rovanion Luckey [Tue, 29 Mar 2016 19:43:00 +0000 (13:43 -0600)]
gallium: Format code in pb_buffer_fenced.c according to style guide.
This is a tiny housekeeping patch which does the following:
* Replaced tabs with three spaces.
* Formatted oneline and multiline code comments. Some doxygen
comments weren't marked as such and some code comments were marked
as doxygen comments.
* Spaces between if- and while-statements and their parenthesis.
According to the mesa coding style guidelines.
Reviewed-by: Brian Paul <brianp@vmware.com>
Charmaine Lee [Tue, 29 Mar 2016 19:34:36 +0000 (13:34 -0600)]
svga: emit sampler declarations in the helper function for non vgpu10
With commit
dc9ecf58c0c5c8a97cd41362e78c2fcd9f6e3b80,
we are now getting the sampler target from the sampler view
declaration. But since a sampler view declaration can be defined
after a sampler declaration, we need to emit the
sampler declarations in the pre-helpers function, otherwise,
the sampler target might not have defined yet for the sampler declaration.
Fixes viewperf maya-03 and various gl trace regressions in hwv11.
Reviewed-by: Brian Paul <brianp@vmware.com>
Brian Paul [Tue, 29 Mar 2016 19:34:36 +0000 (13:34 -0600)]
svga: avoid freeing non-malloced memory
svga_shader_expand() will fall back to using non-malloced memory for
emit.buf if malloc fails. We should check if the memory is malloced
before freeing it in the error path of svga_tgsi_vgpu9_translate.
Original patch by Thomas Hindoe Paaboel Andersen <phomes@gmail.com>.
Remove trivial svga_destroy_shader_emitter() function, by BrianP.
Signed-off-by: Brian Paul <brianp@vmware.com>
Samuel Pitoiset [Tue, 29 Mar 2016 17:27:49 +0000 (19:27 +0200)]
nvc0/ir: move load/store lowering pass to handleLDST()
Having all this code in a big switch is not really a good pratice.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Christian König [Thu, 14 Jan 2016 15:46:57 +0000 (16:46 +0100)]
st/mesa: implement new DMA-buf based VDPAU interop v2
Avoid using internal structures from another API.
v2: rebase and moved includes so they don't cause problem when VDPAU isn't installed.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
Reviewed-by: Leo Liu <leo.liu@amd.com>
Christian König [Thu, 14 Jan 2016 15:45:29 +0000 (16:45 +0100)]
st/vdpau: implement the new DMA-buf based interop v2
That should allow us to get away from passing internal structures around.
v2: rebased
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Christian König [Wed, 13 Jan 2016 15:42:44 +0000 (16:42 +0100)]
st/vdpau: move FormatRGBAToPipe into the interop
We are going to need that in the Mesa state tracker as well.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Christian König [Tue, 12 Jan 2016 15:07:58 +0000 (16:07 +0100)]
st/vdpau: add new interop interface
Use DMA-buf for the VDPAU interop interface instead of using
internal structures.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Christian König [Thu, 14 Jan 2016 12:40:25 +0000 (13:40 +0100)]
st/vdpau: use linear layout for output surfaces
Works around a bug in radeonsi and tiling is actually
not very beneficial in this use case.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Christian König [Thu, 14 Jan 2016 12:38:10 +0000 (13:38 +0100)]
radeonsi: ignore PIPE_BIND_LINEAR in si_is_format_supported v2
Linear layout should work for all not compressed or depth/stencil formats.
v2: restrict it a bit more
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Ilia Mirkin [Tue, 29 Mar 2016 00:59:13 +0000 (20:59 -0400)]
st/mesa: enable OES_texture_buffer when all components available
OES_texture_buffer combines bits from a number of desktop extensions.
When they're all available, turn it on.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Adam Jackson [Thu, 24 Mar 2016 17:57:58 +0000 (13:57 -0400)]
glapi/glx: Mark the indirect swapped dispatch functions _X_COLD
A modest size savings:
text data bss dec hex filename
264143 15608 232 279983 445af libglx.so.before
254303 15608 232 270143 41f3f libglx.so.after
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Adam Jackson [Thu, 24 Mar 2016 17:57:58 +0000 (13:57 -0400)]
glapi/glx: Sync some additional error checking from xserver
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Alejandro Piñeiro [Tue, 23 Feb 2016 10:48:52 +0000 (11:48 +0100)]
glsl: raise warning when using uninitialized variables
v2:
* Take into account out varyings too (Timothy Arceri)
* Fix style (Timothy Arceri)
* Use a new ast_expression variable, instead of an
ast_expression::hir new parameter (Timothy Arceri)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94129
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Alejandro Piñeiro [Thu, 25 Feb 2016 10:11:54 +0000 (11:11 +0100)]
glsl: add is_lhs bool on ast_expression
Useful to know if a expression is the recipient of an assignment
or not, that would be used to (for example) raise warnings of
"use of uninitialized variable" without getting a false positive
when assigning first a variable.
By default the value is false, and it is assigned to true on
the following cases:
* The lhs assignments subexpression
* At ast_array_index, on the array itself.
* While handling the method on an array, to avoid the warning
calling array.length
* When computed the cached test expression at test_to_hir, to
avoid a duplicate warning on the test expression of a switch.
set_is_lhs setter is added, because in some cases (like ast_field_selection)
the value need to be propagated on the expression tree. To avoid doing the
propatagion if not needed, it skips if no primary_expression.identifier is
available.
v2: use a new bool on ast_expression, instead of a new parameter
on ast_expression::hir (Timothy Arceri)
v3: fix style and some typos on comments, initialize is_lhs default value
on constructor, to avoid a c++11 feature (Ian Romanick)
v4: some tweaks on comments (Timothy Arceri)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94129
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Jason Ekstrand [Fri, 25 Mar 2016 21:16:47 +0000 (14:16 -0700)]
nir: Add a helper for getting the current block from a cursor
Reviewed-by: Rob Clark <robdclark@gmail.com>
Jason Ekstrand [Fri, 25 Mar 2016 21:11:19 +0000 (14:11 -0700)]
nir/lower_out_to_temp: Add an "entrypoint" parameter
Previously, the pass assumed that the entrypoint would be whatever function
happened to have the name "main". We really shouldn't trust in the
function names.
Reviewed-by: Rob Clark <robdclark@gmail.com>
Jason Ekstrand [Fri, 25 Mar 2016 21:17:18 +0000 (14:17 -0700)]
nir/lower_out_to_temp: Steal the output's constant initializer
Reviewed-by: Rob Clark <robdclark@gmail.com>
Jason Ekstrand [Fri, 25 Mar 2016 21:07:41 +0000 (14:07 -0700)]
nir: Add a helper for getting the unique function in a shader
Reviewed-by: Rob Clark <robdclark@gmail.com>
Jason Ekstrand [Fri, 25 Mar 2016 18:10:30 +0000 (11:10 -0700)]
nir/sweep: Sweep function parameters
They are no longer in the list of local variables so we need to explicitly
sweep them.
Reviewed-by: Rob Clark <robdclark@gmail.com>
Jason Ekstrand [Fri, 25 Mar 2016 17:43:46 +0000 (10:43 -0700)]
nir/builder: Add a helper for creating undefs
Reviewed-by: Rob Clark <robdclark@gmail.com>
Jason Ekstrand [Fri, 25 Mar 2016 17:35:03 +0000 (10:35 -0700)]
nir/builder: Add a helper for storing to variable derefs
Reviewed-by: Rob Clark <robdclark@gmail.com>
Jason Ekstrand [Fri, 25 Mar 2016 17:34:17 +0000 (10:34 -0700)]
nir/builder: Add a helper for building fdot instructions
Reviewed-by: Rob Clark <robdclark@gmail.com>
Jason Ekstrand [Fri, 25 Mar 2016 17:18:35 +0000 (10:18 -0700)]
nir: Add a variable_foreach_safe helper
Reviewed-by: Rob Clark <robdclark@gmail.com>
Jason Ekstrand [Fri, 25 Mar 2016 17:08:50 +0000 (10:08 -0700)]
nir/Makefile: Fix alphabetization
Reviewed-by: Rob Clark <robdclark@gmail.com>
Ilia Mirkin [Sat, 27 Feb 2016 21:16:28 +0000 (16:16 -0500)]
mesa: add OES_texture_buffer and EXT_texture_buffer support
Allow ES 3.1 contexts to access the texture buffer functionality.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Ilia Mirkin [Sat, 27 Feb 2016 21:13:50 +0000 (16:13 -0500)]
glsl: add OES_texture_buffer and EXT_texture_buffer support
Expose the samplerBuffer/imageBuffer types, and allow the various
functions to operate on them.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Ilia Mirkin [Sat, 27 Feb 2016 21:06:42 +0000 (16:06 -0500)]
mesa: add OES_texture_buffer and EXT_texture_buffer extension to table
We need to add a new bit since the GL ES exts require functionality from
a combination of texture buffer extensions as well as images (for
imageBuffer) support. Additionally, not all GPUs support all the texture
buffer functionality (e.g. rgb32 isn't supported by nv50).
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Ilia Mirkin [Sat, 27 Feb 2016 21:04:51 +0000 (16:04 -0500)]
mesa: properly return GetTexLevelParameter queries for buffer textures
This fixes all failures with dEQP tests in this area. While
ARB_texture_buffer_object explicitly says that GetTexLevelParameter & co
should not be supported, GL 3.1 reverses this decision and allows all of
these queries there.
Conversely, there is no text that forbids the buffer-specific queries
from being used with non-buffer images.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
Kenneth Graunke [Mon, 28 Mar 2016 23:57:19 +0000 (16:57 -0700)]
glsl: Delete initialized field from uniform storage test.
Timothy deleted this field. Fixes "make check".
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Timothy Arceri [Sun, 27 Mar 2016 03:51:02 +0000 (14:51 +1100)]
mesa: remove initialized field from uniform storage
The only place this was used was in a gallium debug function that
had to be manually enabled.
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Samuel Pitoiset [Mon, 28 Mar 2016 10:43:01 +0000 (12:43 +0200)]
nvc0: use a different offset for buffers and surfaces
To not overwrite buffers and surfaces information, we need to use
a different offset in the driver constant buffer. Currently, OP_SUQ
is only supported for buffers but this will be slightly updated for
images support.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Kenneth Graunke [Tue, 8 Mar 2016 07:54:53 +0000 (23:54 -0800)]
i965: Set address rounding bits for GL_NEAREST filtering as well.
Yuanhan Liu decided these were useful for linear filtering in
commit
76669381 (circa 2011). Prior to that, we never set them;
it seems he tried to preserve that behavior for nearest filtering.
It turns out they're useful for nearest filtering, too: setting
these fixes the following dEQP-GLES3 tests:
functional.fbo.blit.rect.nearest_consistency_mag
functional.fbo.blit.rect.nearest_consistency_mag_reverse_src_x
functional.fbo.blit.rect.nearest_consistency_mag_reverse_src_y
functional.fbo.blit.rect.nearest_consistency_mag_reverse_dst_x
functional.fbo.blit.rect.nearest_consistency_mag_reverse_dst_y
functional.fbo.blit.rect.nearest_consistency_mag_reverse_src_dst_x
functional.fbo.blit.rect.nearest_consistency_mag_reverse_src_dst_y
functional.fbo.blit.rect.nearest_consistency_min
functional.fbo.blit.rect.nearest_consistency_min_reverse_src_x
functional.fbo.blit.rect.nearest_consistency_min_reverse_src_y
functional.fbo.blit.rect.nearest_consistency_min_reverse_dst_x
functional.fbo.blit.rect.nearest_consistency_min_reverse_dst_y
functional.fbo.blit.rect.nearest_consistency_min_reverse_src_dst_x
functional.fbo.blit.rect.nearest_consistency_min_reverse_src_dst_y
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_src_x
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_src_y
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_dst_x
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_dst_y
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_src_dst_x
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_src_dst_y
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_src_x
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_src_y
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_dst_x
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_dst_y
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_src_dst_x
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_src_dst_y
Apparently, BLORP has always set these bits unconditionally.
However, setting them unconditionally appears to regress tests using
texture projection, 3D samplers, integer formats, and vertex shaders,
all in combination, such as:
functional.shaders.texture_functions.textureprojlod.isampler3d_vertex
Setting them on Gen4-5 appears to regress Piglit's
tests/spec/arb_sampler_objects/framebufferblit.
Honestly, it looks like the real problem here is a lack of precision.
I'm just hacking around problems here (as embarassing as it is).
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Kenneth Graunke [Wed, 23 Mar 2016 18:56:39 +0000 (11:56 -0700)]
i965: Always use BRW_TEXCOORDMODE_CUBE when seamless filtering.
When using seamless cube map mode and NEAREST filtering, we explicitly
overrode the wrap modes to CLAMP_TO_EDGE. This was to implement the
following spec text:
"If NEAREST filtering is done within a miplevel, always apply apply
wrap mode CLAMP_TO_EDGE."
However, textureGather() ignores the sampler's filtering mode, and
instead returns the four pixels that would be blended by LINEAR
filtering. This implies that we should do proper seamless filtering,
and include pixels from adjacent cube faces.
It turns out that we can simply delete the NEAREST -> CLAMP_TO_EDGE
overrides. Normal cube map sampling works by first selecting the
face, and then nearest filtering fetches the closest texel. If the
nearest texel was on a different face, then that face would have been
chosen. So it should always be within the face anyway, which
effectively performs CLAMP_TO_EDGE.
Fixes 86 dEQP-GLES31.texture.gather.basic.cube.* tests.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Suggested-by: Ian Romanick <idr@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>