Commit Graph

81824 Commits

Author SHA1 Message Date
Ilia Mirkin ccd58015a2 docs: true up nvc0 status - images, etc
Images aren't supported on maxwell, but neither is tessellation. Don't
overly confuse matters by trying to expose those subtleties in the
GL3.txt file/relnotes.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Dave Airlie <airlied@redhat.com>
2016-05-23 23:47:11 -04:00
Ilia Mirkin 856587909c st/mesa: enable ARB_ES3_1_compatibility when ES 3.1 would be exposed
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-05-23 23:47:11 -04:00
Ilia Mirkin 5878254545 mesa: remove separate enable for KHR_robust_buffer_access_behavior
This extension appears to be a strict subset of the ARB version. Also
remove it from GL3.txt since it doesn't seem relevant.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 23:47:11 -04:00
Timothy Arceri 72449c477e glsl: add support for explicit components to frag outputs
V2: fix error checking for arrays and components. V1 was
only taking into account all the array elements and all the
components of one of the varyings during the comparision
and treating the other as a single slot/component.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2016-05-24 12:46:48 +10:00
Ilia Mirkin 37266dfb7c mesa: add view classes for 3d astc formats
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2016-05-23 22:34:37 -04:00
Ilia Mirkin 979bcb9f42 glsl: add EXT_clip_cull_distance support based on ARB_cull_distance
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-05-23 22:22:06 -04:00
Ilia Mirkin f236f1f506 nvc0: expose robust buffer access
We apparently pass all the relevant CTS tests. There are probably some
shortcomings, but they can be addressed down the line.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2016-05-23 22:22:05 -04:00
Jason Ekstrand 9f5ccaf4dc i965: Use ISL for surface format introspection
With this, we can delete the surface format table in brw_surface_formats.c
because all of the information we need is now in ISL.
2016-05-23 19:12:34 -07:00
Jason Ekstrand d68acde1cb anv/formats: Use isl_format_supports* for format introspection 2016-05-23 19:12:34 -07:00
Jason Ekstrand 7374d006b6 isl: Add per-gen format introspection
This is just a copy-and-paste from brw_surface_formats.c.  For the
supports_vertex_fetch function, we do a bit more work so that it properly
handles Bay Trail.
2016-05-23 19:12:34 -07:00
Jason Ekstrand 03a82dc5d1 isl: Add the ISL_FORMAT_R32G32_FLOAT_LD format 2016-05-23 19:12:34 -07:00
Jason Ekstrand 35a514e6ff isl: Add support for quering the string name of a format 2016-05-23 19:12:34 -07:00
Jason Ekstrand 75d10dff0b i965: Enable ARB/KHR_robust_buffer_access_behavior on BYT and HSW+
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand 1a092fcf3b main: Add extension enable bits for KHR_robust_buffer_access_behavior
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand 66e137ecf1 nir/lower_samplers: Protect against sampler index overflow
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand 27b9481d03 glsl: Add an option to clamp block indices when lowering UBO/SSBOs
This prevents array overflow when the block is actually an array of UBOs or
SSBOs.  On some hardware such as i965, such overflows can cause GPU hangs.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand ac242aac3d glsl/linker: Add a helper variable for compiler options
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand aec10a1d5b i965/draw: Use the real size for index buffers
Previously, we were using the size of the whole BO which may be
substantially larger than the actual index buffer size.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand 7c8dfa78b9 i965/draw: Use the real size for vertex buffers
Previously, we were using the size of the BO which may be substantially
larger than the actual vertex buffer size.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand a643bc6246 i965/draw: Use 3-channel formats for vertex fetch when possible.
For a long time, several of the 3-channel vertex formats didn't exist so we
faked them with 4-channel versions.  Starting with Sandy Bridge, we can use
R16G16B16_FLOAT and 8 and 16-bit integer formats become available on
Haswell and Bay Trail.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand ab3d8d5ea4 i965/surface_formats: Update the VB column for new formats added on BYT
Bay Trail and Haswell added a bunch of new vertex formats.  There was also
the addition of 64-bit passthrough formats for BDW+.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand d5b4ab2c5f i965/draw: Properly handle rounding when dividing by InstanceDivisor
The old code always divided rounded down and then subtracted 1.  What we
wanted was to divide rounded up and then subtract 1 which is equivalent to
subtracting 1 and then dividing rounded down.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand ad42ab473c i965/draw: Account for BaseInstance in VBO bounds
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand ad3deec8ca i965/draw: Use worst-case VBO bounds if brw->num_instances == 0
Previously, we only handled the "I don't know what's going on" case for
things with InstanceDivisor == 0.  However, in the DrawIndirect case we can
get num_instances == 0 and we don't know what's going on with the instanced
ones either.  This commit makes the worst-case bound the default and then
conservatively tightens the bound.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand 8892519751 i965/draw: Delay when we get the bo for vertex buffers
The previous code got the BO the first time we encountered it.  However,
this can potentially lead to problems if the BO is used for multiple arrays
with the same buffer object because the range we declare as busy may not be
quite right.  By delaying the call to intel_bufferobj_buffer, we can ensure
that we have the full range for the given buffer.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand a01a1eb9e4 i965/draw: Stop relying on min_index == -1 for invalid index bounds
The vbo layer passes an index_bounds_valid flag that we should be using
instead.  This also fixes a bug when min_index == -1 and basevertex != 0
where we were actually comparing min_index + basevertex == -1 which was
false and we were getting the wrong buffer-sizing path.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand a7011922f1 vbo: Declare the index range invalid for DrawTransformFeedback
Right now, we're setting the range to [0, 0] which is obviously bogus.
Instead, we should set it to be invalid like we do for DrawIndirect.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Jason Ekstrand df6ec2aba5 vbo: Declare the index range invalid for DrawIndirect
Right now, we're just setting the range to [0, MAX_UINT32] which, while
correct isn't helpful.  With DrawIndirect, you can't really know what the
actual range is so we may as well flag it as being an invalid range.  This
is what we do for draws with index buffer which is similar (the indices
aren't statically known) if a bit simpler.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-23 19:12:34 -07:00
Ilia Mirkin 21f3df0820 mesa/teximage: fix GL_FLOAT in comment
Noticed by Brian. Trivial.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2016-05-23 21:44:41 -04:00
Timothy Arceri 2d9308012c glsl: fix explicit location validation for doubles
Previously we would fail to find a match for the second half of a
dvec4 as 'i' would get incremented to 1 before we added the var to
the array at component 0.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2016-05-24 11:30:51 +10:00
Dave Airlie 33397bf7fd docs: update ARB_cull_distance status.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-24 11:27:58 +10:00
Dave Airlie 5c10d47bae st/mesa: reenable culling
Now the lowering pass is fixed, reenable ARB_cull_distance.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-24 11:27:54 +10:00
Dave Airlie a88c5d7e55 i965: reenable ARB_cull_distance.
Now the lowering pass is fixed we can reenable culling.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-24 11:27:29 +10:00
Dave Airlie a08c4ebbe8 glsl: rewrite clip/cull distance lowering pass
The last version of this broke clipping, and I had to spend
sometime getting this working properly.

I had to introduce a third pass to count the clip/cull totals,
all due to one messy corner case. We have a piglit test
tes-input-gl_ClipDistance.shader_test
that doesn't actually output the clip distances, it just passes
them like a varying from TCS->TES, the older lowering pass worked
but to lower clip/cull we need to know the total number of clip+culls
used to defined the new variable correctly, and to offset culls
properly.

This adds an extra pass that works out the sizes for clip/cull,
then lowers gl_ClipDistance then gl_CullDistance into the new
gl_ClipDistanceMESA.

The pass checks using the fixed array sizes code if they array
has been referenced, or is actually never used, and ignores
it in the latter case.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-24 11:27:29 +10:00
Dave Airlie 8c628ab13e glsl: make max array trackers ints and use -1 as base. (v2)
This fixes a bug that breaks cull distances. The problem
is the max array accessors can't tell the difference between
an never accessed unsized array and an accessed at location 0
unsized array. This leads to converting an undeclared unused
gl_ClipDistance inside or outside gl_PerVertex to a size 1
array. However we need to the number of active clip distances
to work out the starting point for the cull distances, and
this offset by one when it's not being used isn't possible
to distinguish from the case were only the first element is
accessed. I tried to use ->used for this, but that doesn't
work when gl_ClipDistance is part of an interface block.

So this changes things so that max_array_access is an int
and initialised to -1. This also allows unsized arrays to
proceed further than that could before, but we really shouldn't
mind as they will get eliminated if nothing uses them later.

For initialised uniforms we no longer change their array
size at runtime, if these are unused they will get eliminated
eventually.

v2: use ralloc_array (Ilia)

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-24 11:27:29 +10:00
Nanley Chery 2ae493d686 anv/formats: Make alpha blending a property of render targets
In agreement with the SNB PRM, alpha blending is a property that render
targets may or may not support.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-05-23 17:26:17 -07:00
Nanley Chery 9721be6681 i965: Unset alpha blend for R10G10B10_SNORM_A2_UNORM
This format does not support alpha blending, according to the SNB PRM.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-05-23 17:26:17 -07:00
Dave Airlie 8b89c92ef6 i965: deindent blorp code.
gcc6 warns about this.

Acked-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-24 10:14:31 +10:00
Dave Airlie e257284481 glsl: reindent line in ast_function.cpp
This fixes a warning with gcc -Wmisleading-indentation.

Acked-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-24 10:14:31 +10:00
Ilia Mirkin 82d756f3af mesa: allow GL_FRAMEBUFFER_DEFAULT_LAYERS to be queried with ES geometry
When we have the geometry extensions, enable querying of the new param.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2016-05-23 20:03:40 -04:00
Ilia Mirkin 2dabd49704 mesa: allow xfb to be active in GLES when geometry shader is enabled.
OES_geometry_shader has wording to allow xfb when using Draw*Indirect
and DrawElements.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2016-05-23 20:03:20 -04:00
Ilia Mirkin 2e8e1e8909 main: check driver float texture support before upgrading to 16F/32F
When passing in GL_RGBA or other base formats, we will try to upgrade
the format to whatever the passed in type was. However not all drivers
(notably nv30) support 32F textures, and so this would lead to crashes
down the line. Only upgrade when the relevant extensions are available.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-05-23 20:00:39 -04:00
Ilia Mirkin 1e99a46b44 st/mesa: update inst->info along with inst->op
Otherwise we still have TGSI_OPCODE_CMP's info, which causes a number of
later logic to go wrong. This fixes

dEQP-GLES2.functional.shaders.functions.control_flow.return_in_if_vertex

on nv30.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-05-23 19:58:53 -04:00
Bas Nieuwenhuizen 533d1e9085 glsl: Use correct mode for split components.
The mode should stay the same as the original struct. In
particular, shared should not be changed to temporary.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
2016-05-24 09:55:38 +10:00
Kenneth Graunke 1c1873b93b mesa: Implement glGet*(GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED).
Technically, this was introduced with GL 4.4.  However, I believe it
was intended to be retroactive.  As far as I know, AMD has never
supported primitive restart with patches, while NVidia and Intel do.
This necessitated the need for a query which would allow applications
to figure out whether this was usable or not.

I decided to expose it everywhere ARB_tessellation_shader is exposed.
(It's also in both OES and EXT_tessellation_shader.)

Enable this for i965 and Gallium drivers which expose the capability.

v2: Fix a bug in the state_tracker code (caught by Ilia Mirkin).

Bugzilla: https://cvs.khronos.org/bugzilla/show_bug.cgi?id=10364
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2016-05-23 16:44:22 -07:00
Kenneth Graunke 70048eb1e3 gallium: Add a pipe cap for whether primitive restart works for patches.
Some hardware supports primitive restart on patch primitives, and other
hardware does not.  Modern GL and ES include a query for this feature;
adding a capability bit will allow us to answer it.

As far as I know, AMD hardware does not support this feature, while
NVIDIA and Intel hardware does.  However, most Gallium drivers do not
appear to support tessellation shaders yet.  So, I've enabled it for
nvc0 and disabled it everywhere else.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-05-23 16:44:11 -07:00
Francisco Jerez 015035027b i965/fs: Mark UBO uniform pull constant loads as force_writemask_all.
This lets the rest of the backend know that the uniform pull constant
load opcodes don't respect channel enables -- Without this the
register allocator has no way to know that the return payload of a
pull constant load is not per-channel and spills of the destination
will be broken under non-uniform control flow.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-05-23 14:07:23 -07:00
Francisco Jerez 7eb4966887 i965/fs: Allow spilling of non-contiguous registers.
This should be working fine now.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94997
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-05-23 14:05:21 -07:00
Francisco Jerez 6fc5dd5b6a i965/fs: Calculate the (un)spill block size correctly.
Currently the spilling code attempts to guess the scratch message
block size from the dispatch width of the shader, which is plain wrong
for SIMD-lowered instructions (frequently but not exclusively
encountered in SIMD32 shaders) or for instructions with register
region data types of size other than 32 bit.

Instead try to use the SIMD component size of the instruction which in
some cases will allow the dataport to apply the correct channel mask
to the scratch data read or written.  In the spill case the block size
needs to be clamped to the number of MRF registers reserved for
spilling.  In the unspill case I didn't even bother because we
currently have no 100% accurate way to determine whether a source
region is per-channel or whether it contains things like headers that
don't respect channel boundaries -- That's fine, because the unspill
is marked force_writemask_all we can just use the largest allowable
scratch message size.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-05-23 14:05:21 -07:00
Francisco Jerez 11260cc54f i965/fs: Set exec_all on spills not matching the channel layout of the instruction.
This prevents the application of an incorrect channel mask by the
scratch write instruction for spilled variables that don't have an
exact one-to-one correspondence between channels of the variable and
32-bit components of the scratch write instruction.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-05-23 14:05:21 -07:00