mesa.git
8 years agost/mesa: add ES sample-shading support
Ilia Mirkin [Tue, 16 Feb 2016 06:27:27 +0000 (01:27 -0500)]
st/mesa: add ES sample-shading support

We require the full ARB_gpu_shader5 for now, but in the future some
other CAP could get exposed to indicate that only the multisample-related
behavior of ARB_gpu_shader5 is available.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agomesa: add GL_OES_shader_multisample_interpolation support
Ilia Mirkin [Sat, 20 Feb 2016 20:03:55 +0000 (15:03 -0500)]
mesa: add GL_OES_shader_multisample_interpolation support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: add GL_OES_sample_shading support
Ilia Mirkin [Tue, 16 Feb 2016 19:29:38 +0000 (14:29 -0500)]
mesa: add GL_OES_sample_shading support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: add GL_OES_sample_variables support
Ilia Mirkin [Fri, 19 Feb 2016 18:23:10 +0000 (13:23 -0500)]
glsl: add GL_OES_sample_variables support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: add OES_sample_variables to extension table, add enable bit
Ilia Mirkin [Tue, 16 Feb 2016 06:20:15 +0000 (01:20 -0500)]
mesa: add OES_sample_variables to extension table, add enable bit

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: add gl_MaxSamples, new in GL 4.5 / GL ES 3.2
Ilia Mirkin [Fri, 19 Feb 2016 18:20:48 +0000 (13:20 -0500)]
glsl: add gl_MaxSamples, new in GL 4.5 / GL ES 3.2

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Don't add barrier deps for FB write messages.
Matt Turner [Sun, 13 Mar 2016 05:16:03 +0000 (21:16 -0800)]
i965: Don't add barrier deps for FB write messages.

Ken did this earlier, and this is just me reimplementing his patch a
little differently.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Add and use is_scheduling_barrier() function.
Matt Turner [Sun, 13 Mar 2016 05:15:19 +0000 (21:15 -0800)]
i965: Add and use is_scheduling_barrier() function.

8 years agoi965: Remove NOP insertion kludge in scheduler.
Matt Turner [Mon, 15 Feb 2016 18:43:39 +0000 (10:43 -0800)]
i965: Remove NOP insertion kludge in scheduler.

Instead of removing every instruction in add_insts_from_block(), just
move the instruction to its scheduled location. This is a step towards
doing both bottom-up and top-down scheduling without conflicts.

Note that this patch changes cycle counts for programs because it begins
including control flow instructions in the estimates.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Assert that an instruction is not inserted around itself.
Matt Turner [Mon, 15 Feb 2016 18:42:14 +0000 (10:42 -0800)]
i965: Assert that an instruction is not inserted around itself.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Relax restriction on scheduling last instruction.
Matt Turner [Mon, 15 Feb 2016 18:05:33 +0000 (10:05 -0800)]
i965: Relax restriction on scheduling last instruction.

I think when this code was written, basic blocks were always ended by a
control flow instruction or an end-of-thread message. That's no longer
the case, and removing this restriction actually helps things:

   instructions in affected programs: 7267 -> 7244 (-0.32%)
   helped: 4

   total cycles in shared programs: 66559580 -> 66431900 (-0.19%)
   cycles in affected programs: 28310152 -> 28182472 (-0.45%)
   helped: 9577
   HURT: 879

   GAINED: 2

The addition of the is_control_flow() checks is not a functional change,
since the add_insts_from_block() does not put them in the list of
instructions to schedule. I plan to change this in a later patch.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/vec4/tcs: Set conditional mod on TCS_OPCODE_SRC0_010_IS_ZERO.
Matt Turner [Tue, 15 Mar 2016 00:39:19 +0000 (17:39 -0700)]
i965/vec4/tcs: Set conditional mod on TCS_OPCODE_SRC0_010_IS_ZERO.

Missing this causes an assertion failure in the scheduler with the next
patch.

Additionally, this gives cmod propagation enough information to optimize
code better.

total instructions in shared programs: 7112991 -> 7112852 (-0.00%)
instructions in affected programs: 25704 -> 25565 (-0.54%)
helped: 139

total cycles in shared programs: 64812898 -> 64810674 (-0.00%)
cycles in affected programs: 127224 -> 125000 (-1.75%)
helped: 139

Acked-by: Francisco Jerez <currojerez@riseup.net>
8 years agoRevert "i965: Don't add barrier deps for FB write messages."
Matt Turner [Wed, 17 Feb 2016 19:04:50 +0000 (11:04 -0800)]
Revert "i965: Don't add barrier deps for FB write messages."

This reverts commit d0e1d6b7e27bf5f05436e47080d326d7daa63af2.

The change in the vec4 code is a mistake -- there's never an
FS_OPCODE_FB_WRITE in vec4 code.

The change in the fs code had the (harmless) effect of not recognizing
an FB_WRITE as a scheduling barrier even if it was marked EOT --
harmless because the scheduler marked the last instruction of a block as
a barrier, something I'm changing in the following patches.

This will be reimplemented later in the series.

8 years agoi965: Simplify full scheduling-barrier conditions.
Matt Turner [Mon, 15 Feb 2016 07:21:03 +0000 (23:21 -0800)]
i965: Simplify full scheduling-barrier conditions.

All of these were simply code for "architecture register file" (and in
the case of destinations, "not the null register").

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Remove incorrect cycle estimates.
Matt Turner [Mon, 15 Feb 2016 07:23:53 +0000 (23:23 -0800)]
i965: Remove incorrect cycle estimates.

These printed the cycle count the last basic block (sched.time is set
per basic block!). We have accurate, full program, data printed
elsewhere.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agost/mesa: fix fallout from xfb changes.
Dave Airlie [Thu, 31 Mar 2016 02:35:25 +0000 (12:35 +1000)]
st/mesa: fix fallout from xfb changes.

Failed to update state tracker with new buffer interface.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agonir: Fix typo from commit 6702f1acde9.
Matt Turner [Thu, 31 Mar 2016 02:18:16 +0000 (19:18 -0700)]
nir: Fix typo from commit 6702f1acde9.

8 years agodocs: mark xfb_* qualifiers as DONE
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>
8 years agomesa: add query support for GL_TRANSFORM_FEEDBACK_BUFFER interface
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>
8 years agoglsl: add transform feedback buffers to resource list
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>
8 years agomesa: add support to query GL_TRANSFORM_FEEDBACK_BUFFER_INDEX
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>
8 years agomesa: add support to query GL_OFFSET for GL_TRANSFORM_FEEDBACK_VARYING
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>
8 years agomesa: rename tranform feeback varying macro XFB to XFV
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>
8 years agoglsl: always enable transform feedback mode when xfb_stride defined
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>
8 years agoglsl: handle varyings that are not written to but have an xfb_offset
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>
8 years agoglsl: when lowering named interface set assigned flag
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>
8 years agoglsl: reset current stream tracker
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>
8 years agoglsl: generate link error when implicit stride is to large
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>
8 years agoglsl: add xfb_stride link time validation
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>
8 years agoglsl: validate global out xfb_stride qualifiers and set stride on empty buffers
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>
8 years agomesa: split transform feedback buffer into its own struct
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>
8 years agoglsl: use bitmask of active xfb buffer indices
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>
8 years agoglsl: sort xfb varyings in offset/buffer order
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>
8 years agoglsl: basic linking support for xfb qualifiers
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>
8 years agoglsl: add xfb helpers and fields to the tfeedback_decl class
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>
8 years agoglsl: add helper to process xfb qualifiers during linking
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>
8 years agoglsl: add helper to generate xfb varying names
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>
8 years agoglsl: add helper for counting varyings
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>
8 years agoglsl: add xfb qualifier lowering support for named blocks
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>
8 years agoglsl: add xfb qualifiers to has_layout helper
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>
8 years agoglsl: apply xfb_stride to implicit offsets for ifc block members
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>
8 years agoglsl: add xfb_stride compile time rules
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>
8 years agoglsl: add xfb_offset compile time rules
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>
8 years agoglsl: add xfb_buffer compile time rules
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>
8 years agoglsl: add field to track if xfb_buffer is an explicit or implicit value
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>
8 years agoglsl: add xfb_* qualifiers to glsl_struct_field
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>
8 years agoglsl: add IR fields for transform feedback layout qualifiers
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>
8 years agoglsl: add validation for out layout qualifiers
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>
8 years agoglsl: relax stage restrictions on layout defaults for outputs
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>
8 years agoglsl: parse new transform feedback layout qualifiers
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>
8 years agoglsl: move process_qualifier_constant() to ast_type.cpp
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>
8 years agoglsl: add transform feedback built-in constants
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>
8 years agoglsl: generate named interface block names correctly
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>
8 years agoglsl: Fix segfault when lhs is error_type in TCS
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>
8 years agodocs: update softpipe status for shader_image_load_store.
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>
8 years agosoftpipe: add image support to softpipe (v3)
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>
8 years agodraw: add support for passing images to vs/gs shaders.
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>
8 years agotgsi: add support for image operations to tgsi_exec. (v2.1)
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>
8 years agosoftpipe: add support for explicit early depth testing
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>
8 years agotgsi: introduce NonHelperMask
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>
8 years agotgsi_exec: handle execmask when doing indirect lookups
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>
8 years agotgsi_exec: add support for up to 3 address registers (v2)
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>
8 years agonir: Propagate negates up multiplication chains.
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

8 years agoi965: Don't inline intel_batchbuffer_require_space().
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>
8 years agor600: ignore PIPE_BIND_LINEAR in *_is_format_supported
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>
8 years agost/vdpau: correct null check
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>
8 years agodocs: remove docs/COPYING which contains GPL license
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>
8 years agoglsl: add missing types for buffer images
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>
8 years agoglsl: invalidate float suffixes for GLSL 1.10 and GLSL ES 1.00
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>
8 years agotgsi: (trivial) only verify target for is_tex instructions
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.

8 years agomesa: allow mutable buffer textures to back GL ES images
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>
8 years agomesa: make _mesa_prepare_mipmap_level() static
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>
8 years agometa: use _mesa_prepare_mipmap_levels()
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>
8 years agodocs: add HTTP link for Mesa downloads
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>
8 years agotgsi: simplify tgsi_shader_info::is_msaa_sampler checking
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>
8 years agotgsi: collect texture sampler target info in tgsi_scan_shader()
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>
8 years agogallium/docs: s/gven/given/
Brian Paul [Tue, 29 Mar 2016 17:32:24 +0000 (11:32 -0600)]
gallium/docs: s/gven/given/

8 years agoxlib: add support for GLX_ARB_create_context
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>
8 years agost/mesa: simplify st_generate_mipmap()
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>
8 years agomesa: new _mesa_prepare_mipmap_levels() function for mipmap generation
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>
8 years agoi965: Don't use CUBE wrap modes for integer formats on IVB/BYT.
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]
8 years agoRevert "i965: Set address rounding bits for GL_NEAREST filtering as well."
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.

8 years agogallium: Format code in pb_buffer_fenced.c according to style guide.
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>
8 years agosvga: emit sampler declarations in the helper function for non vgpu10
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>
8 years agosvga: avoid freeing non-malloced memory
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>
8 years agonvc0/ir: move load/store lowering pass to handleLDST()
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>
8 years agost/mesa: implement new DMA-buf based VDPAU interop v2
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>
8 years agost/vdpau: implement the new DMA-buf based interop v2
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>
8 years agost/vdpau: move FormatRGBAToPipe into the interop
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>
8 years agost/vdpau: add new interop interface
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>
8 years agost/vdpau: use linear layout for output surfaces
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>
8 years agoradeonsi: ignore PIPE_BIND_LINEAR in si_is_format_supported v2
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>
8 years agost/mesa: enable OES_texture_buffer when all components available
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>
8 years agoglapi/glx: Mark the indirect swapped dispatch functions _X_COLD
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>
8 years agoglapi/glx: Sync some additional error checking from xserver
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>
8 years agoglsl: raise warning when using uninitialized variables
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>
8 years agoglsl: add is_lhs bool on ast_expression
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>
8 years agonir: Add a helper for getting the current block from a cursor
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>
8 years agonir/lower_out_to_temp: Add an "entrypoint" parameter
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>
8 years agonir/lower_out_to_temp: Steal the output's constant initializer
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>