The vertex shader always gl_PerVertex, but the tesselation shaders only
define the structure when the point size extension is enabled, otherwise
gl_PointSize is passed as a generic varying and can not be written to.
If one enables the extension based on whether the value gl_PointSize is
actually accessed in the tess shaders then it might happend that tess_ctrl
doesn't touch the value, and the extension isn't enabled, and tess_eval
accesses it and the extension is enabled. In such a case gl_PointSize is
passed as a generic to and from the tess_ctrl shader and linking of the
shaders will fail because of different definitions of gl_PerVertex.
Since in this case there is no indication in the tess_ctrl shader that
point_size is accessed, and it is not known whether the shader will be
linked with a tess_eval shader that uses gl_PointSize the workaround is to
always enable the extension for all tesselation shaders.
Fixes:
dEQP-GLES31.functional.tessellation_geometry_interaction.
point_size.evaluation_set
point_size.vertex_set_control_set
point_size.vertex_set_evaluation_set
point_size.vertex_set_evaluation_set_geometry_default
dEQP-GLES31.functional.primitive_bounding_box.wide_points.
global_state.vertex_tessellation_fragment.
default_framebuffer_bbox_equal
default_framebuffer_bbox_larger
default_framebuffer_bbox_smaller
fbo_bbox_equal
fbo_bbox_larger
fbo_bbox_smaller
dEQP-GLES31.functional.primitive_bounding_box.wide_points.
tessellation_set_per_draw.vertex_tessellation_fragment.
default_framebuffer_bbox_equal
default_framebuffer_bbox_equal
default_framebuffer_bbox_larger
default_framebuffer_bbox_smaller
fbo_bbox_equal
fbo_bbox_larger
fbo_bbox_smaller
tessellation_set_per_primitive.vertex_tessellation_fragment.
default_framebuffer
fragment.fbo
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
GLES 3.1 might support tesselation shaders through the extension, but
this requires the extension to be enabled manually.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(i|u)mulextended require that the all parameters are of the same
signedness. Accordingly create both, the output variabale for MSB and
the (unused) variable for the LSB to be of the same corresponding
signedness. Closes: #17
Fixes:
dEQP-
GLES31.functional.shaders.builtin_functions.integer.imulextended.*
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Certain source regs (GRID_SIZE, THREAD_ID, BLOCK_ID) don't need
to be cast.
Fixes:
dEQP-GLES31.functional.compute.basic.image_atomic_op_local_size_1
dEQP-GLES31.functional.compute.basic.image_atomic_op_local_size_8
dEQP-GLES31.functional.compute.basic.image_barrier_multiple
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Fixes:
tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-mixed-with-const-access.shader_test
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
When using OpenGL ES 3.1, we either need to emit a precision qualifier,
or set a default precision.
Since it's not unthinkable that we'd want to forward lowp/mediump
in the future, let's use the precision qualifier so it's easier
to get this right later on.
This gets rid of a shader compile error.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
OpenGL ES 3.1 only supports writing to a few formats, while it can
read from all of them. So let's make sure we emit readonly, so the
OpenGL driver knows we'll only read.
This avoids a shader-compiler error on OpenGL ES 3.1.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
OpenGL ES 3.1 doesn't support using glUniform1i() for binding
images, so let's use layout qualifiers instead. This should in
theory be slightly more performant as well, as we do less API
calls.
A future improvement would be to also do this on GL 4.2 and later
as well.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
We essentially repeat the same code twice here, with a small
variation. Let's factor out the common code into a helper, so we
don't have to keep updating two copies. This is similar to what's
already done for samplers.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
There's no point in copying the two only members out of the struct and
onto the stack. So let's just pass the struct directly.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
In GLES, these need a precision specifier, otherwise we get
compile errors.
This fixes a shader-compile error on OpenGL ES 3.1.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
We can emit them during the second pass. Since a load
or store can come before an atomic max or min, we have to
type the memory before we emit instructions.
Reviewed-by: Dave Airlie <airlied@redhat.com>
vrend_shader.c:4400: Warning: Comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < ctx->cfg->max_draw_buffers; i++) {
^
vrend_shader.c:4728:28: Warning: Unused variable »i« [-Wunused-variable]
int start, count, i;
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
When emitting an image array, the code errorously used the loop
counter instead of the image entry for looking up the resource.
The rest of the code uses idx, which seems like the right thing
to do. So let's match that instead.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This is needed to make tests/test_virgl_cmd pass
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This fix all dEQP-GLES31.functional.shaders.builtin_functions.* tests on GLES
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This warning was encountered:
vrend_shader.c:4257:57: warning: ‘i’ may be used uninitialized in this function [-Wmaybe-uninitialized]
(ctx->key->coord_replace & (1 << ctx->inputs[i].sid))) {
Fix this.
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Input/output layout qualifiers used by early depth stencil are
glsl 150 feature.
Fixes on SKL:
dEQP-GLES31.functional.image_load_store.early_fragment_tests.early_fragment_tests_depth
dEQP-GLES31.functional.image_load_store.early_fragment_tests.early_fragment_tests_stencil
dEQP-GLES31.functional.image_load_store.early_fragment_tests.early_fragment_tests_depth_fbo
dEQP-GLES31.functional.image_load_store.early_fragment_tests.early_fragment_tests_stencil_fbo
Signed-off-by: Dave Airlie <airlied@redhat.com>
The TGSI FBFETCH instruction is used for implementing framebuffer-reads
when doing for instance advanced blends. It's used by both
EXT_shader_framebuffer_fetch_non_coherent and
KHR_blend_equation_advanced.
Sadly, libepoxy doesn't yet support the glFramebufferFetchBarrierEXT
function needed to implement this on top of
EXT_shader_framebuffer_fetch_non_coherent itself, so let's just implement
it on top of EXT_shader_framebuffer_fetch instead for now.
This means that we'll have slightly higher requirements for enabling
this functionality than the level of functionality we provide through it.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This mostly consists of adding local memory support, and
support for the compute system values.
The req_local_mem need to be gotten from the guest side
and passed into the shader compile so we can size the
shared memory correctly.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This fixes somes bugs in the existing code and
refactors the sampler array support to more closely
follow the image array code.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This adds support for the TXQS opcode, and RESQ w channel
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This converts the image related opcodes, and tracks the used
images.
Images need some extensions for extra features:
ES_3_1_compatability is needed for r32f image support
shader_image_size for image size support
v2: image: fix missing emit for atomic,
use a shader req for images extension
extend cas_str - we overflowed this
v2.1: drop extra breaks, use decl last for range check (Tomeu)
v3: add indirect support,
drop pointless debug print (Gert)
use 512 in load path.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
This avois them overflowing when we have long swizzled gl_
which happens more with compute shaders and images
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
TGSI has a different model for precise than GLSL, so we have to mark
all outputs that has gotten an precise operation output to it as
precise.
This only implements part of the 'precise' keyword (still lacking
support on individual operations), but it's enough to pass some dEQP
tests, in particular:
- dEQP-GLES31.functional.tessellation.common_edge.triangles_equal_spacing_precise
- dEQP-GLES31.functional.tessellation.common_edge.triangles_fractional_odd_spacing_precise
- dEQP-GLES31.functional.tessellation.common_edge.triangles_fractional_even_spacing_precise
- dEQP-GLES31.functional.tessellation.common_edge.quads_equal_spacing_precise
- dEQP-GLES31.functional.tessellation.common_edge.quads_fractional_odd_spacing_precise
- dEQP-GLES31.functional.tessellation.common_edge.quads_fractional_even_spacing_precise
v2: flipped ordering of "invariant" and "precise", to avoid compiler
errors if both are emitted.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This passes the structs into translate_tex and cleans up after.
(Inspired while look at merging some stuff from gles tree)
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Fixes a bunch of non-compute related dEQP-GLES31.functional.shaders.opaque_type_indexing.*
tests.
Example test cases:
dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.uniform.vertex.sampler2dshadow
dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.dynamically_uniform.tessellation_control.samplercubearrayshadow
dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.dynamically_uniform.tessellation_evaluation.samplercubearrayshadow
dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.uniform.geometry.sampler2dshadow
Reviewed-by: Dave Airlie <airlied@redhat.com>
Sampler arrays don't work with shadow textures. Let's move sampler
array functionality into emit_sampler_decl to de-deuplicate logic.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Otherwise, we risk missing stuff like negation modifiers.
Fixes the following dEQP failures for me:
- dEQP-GLES31.functional.tessellation.common_edge.quads_equal_spacing
- dEQP-GLES31.functional.tessellation.common_edge.quads_fractional_odd_spacing
- dEQP-GLES31.functional.tessellation.common_edge.quads_fractional_even_spacing
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
TGSI defines TGSI_SEMANTIC_SAMPLEMASK to be a four-compoent integer
vector, with the x component set to the same value as gl_SampleMask,
and the y, z and w components set to 0.
Fixes the following failures:
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bit_count_per_pixel.multisample_texture_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bit_count_per_pixel.singlesample_rbo
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bit_count_per_pixel.multisample_rbo_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bit_count_per_sample.singlesample_texture
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bit_count_per_sample.multisample_texture_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bit_count_per_sample.multisample_rbo_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bit_count_per_two_samples.singlesample_texture
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bit_count_per_two_samples.multisample_texture_{1,2}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bit_count_per_two_samples.singlesample_rbo
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bit_count_per_two_samples.multisample_rbo_{1,2}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bits_unique_per_sample.singlesample_texture
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bits_unique_per_sample.multisample_texture_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bits_unique_per_two_samples.singlesample_texture
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_pixel.default_framebuffer
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_pixel.singlesample_texture
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_pixel.multisample_texture_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_pixel.singlesample_rbo
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_pixel.multisample_rbo_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_sample.default_framebuffer
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_sample.singlesample_texture
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_sample.multisample_texture_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_sample.singlesample_rbo
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_sample.multisample_rbo_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_two_samples.default_framebuffer
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_two_samples.singlesample_texture
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_two_samples.multisample_texture_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_two_samples.singlesample_rbo
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_two_samples.multisample_rbo_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_pixel.default_framebuffer
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_pixel.singlesample_texture
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_pixel.multisample_texture_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_pixel.singlesample_rbo
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_pixel.multisample_rbo_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_sample.default_framebuffer
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_sample.singlesample_texture
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_sample.multisample_texture_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_sample.singlesample_rbo
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_sample.multisample_rbo_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_two_samples.default_framebuffer
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_two_samples.singlesample_texture
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_two_samples.multisample_texture_{1,2,4,8,16}
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_two_samples.singlesample_rbo
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_two_samples.multisample_rbo_{1,2,4,8,16}
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
In 0ea74890db, I had a typo that
made GL_ARB_gpu_shader5 being injected into vertex-shaders that
doesn't need them.
This is obviously a big problem when running on for instance GLES
2.0, where this extension isn't supported. So let's fix this.
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
This just moves the code to a function, it doesn't change any
of the expected code. It should make it easier to spot fixes.
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
If a shader uses TGSI_INTERPOLATE_LOC_SAMPLE, we need to emit
the "sample"-keyword for the input-variable in the fragment
shader.
Since the "sampler"-keyword is a GLSL 4.00 feature, this
requires us to enable GL_ARB_gpu_shader5. Unfortunately, opting
in carefully on this is a bit trickier than for most other
extensions, because we patch up vertex, geometry or tesselation
evaluation shader outputs to match the fragment shader inputs.
Since the previous patch adds padding for the require-statement
directly after the #version string, we can just overwrite that
padding with the require statement.
This fixes the following tests:
dEQP-GLES31.functional.shaders.multisample_interpolation.sample_qualifier.multisample_texture_1
dEQP-GLES31.functional.shaders.multisample_interpolation.sample_qualifier.multisample_texture_2
dEQP-GLES31.functional.shaders.multisample_interpolation.sample_qualifier.multisample_texture_4
dEQP-GLES31.functional.shaders.multisample_interpolation.sample_qualifier.multisample_texture_8
dEQP-GLES31.functional.shaders.multisample_interpolation.sample_qualifier.multisample_texture_16
dEQP-GLES31.functional.shaders.multisample_interpolation.sample_qualifier.multisample_rbo_1
dEQP-GLES31.functional.shaders.multisample_interpolation.sample_qualifier.multisample_rbo_2
dEQP-GLES31.functional.shaders.multisample_interpolation.sample_qualifier.multisample_rbo_4
dEQP-GLES31.functional.shaders.multisample_interpolation.sample_qualifier.multisample_rbo_8
dEQP-GLES31.functional.shaders.multisample_interpolation.sample_qualifier.multisample_rbo_16
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.multisample_texture_1
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.multisample_texture_2
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.multisample_texture_4
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.multisample_texture_8
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.multisample_texture_16
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.multisample_rbo_1
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.multisample_rbo_2
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.multisample_rbo_4
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.multisample_rbo_8
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.at_sample_id.multisample_rbo_16
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.multisample_texture_1
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.multisample_texture_2
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.multisample_texture_4
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.multisample_texture_8
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.multisample_texture_16
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.multisample_rbo_1
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.multisample_rbo_2
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.multisample_rbo_4
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.multisample_rbo_8
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.at_sample_position.multisample_rbo_16
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>