This is usedful to accurately communicate the amount of SSBOs supported
to the guest-driver, so we can expose the right amount there.
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>
As we use that temp to address memory files, make sure it's declared.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
On pre-4.0 GL hosts that support tesselation this is needed, because
otherwise, when the guest issues a patch primitive mesa/gallium will
assert.
Closes: #31
Fixes:
Various piglits from texturesize/tes-texturesize*
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
In 4732489 (shader: do not redeclare built-ins as precise), I confused a
mesa shader-compiler bug with a spec problem. Turns out, redeclaring
built-ins as precise is allowed by the spec, just the same as invariant
variables. And even mesa allows this.
What mesa doesn't currently allow, is to redeclare a variable as *both*
invariant *and* precise. This problem does not extend to new
declarations, where this is already handled correctly.
So, let's avoid emitting both; it's not really needed to emit both, as
they essentially have the same effect (disable reordering), just with
some different usage-semantics. And for the cases we support, these are
effectively the same.
This fixes dEQP-GLES31.functional.tessellation.common_edge.*_precise
without breaking dEQP-GLES2.functional.shaders.algorithm.hsl_to_rgb_vertex
this time.
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>
When enabling/disabling GL_BLEND via vrend_blend_enable the context
cached the last state and doesn't call glEnable/glDisable if the state
didn't change. However, when gl(Enable|Disable)IndexedEXT is used with
index 0, then this vrenderer internal state is not updated even though
the corresponding GL state may be changed, and calling vrend_blend_enable
later may not update the actual OpenGL state correctly.
In order to avoid this and to simplify the setting the blend enabled state
remove the caching and always call glEnable/glDisable directly.
v2: remove caching for blend enabled/disabled (Dave)
Closes: #23
Fixes state leak with:
dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.
common_separate_blend_eq_buffer_separate_blend_eq
common_separate_blend_eq_buffer_advanced_blend_eq
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Before calling tgsi_text_translate, check the last 4 bytes of
shader contains the terminating character.
TEST=WebGLAquarium
[airlied: unfortunately some mesa userspace sends a packet
with 0 shader in it, this should be illegal but we can't
go trapping it now. just include the check for termination]
Reviewed-by: Dave Airlie <airlied@redhat.com>
When we set the srgb-decode state, we might overwrite another
incompatible usage of the same sampler object.
To avoid this, create two sampler-objects, one for the decode-state
and one for the skip-decode state.
This fixes the following dEQP-tests on GLES:
- dEQP-GLES31.functional.srgb_texture_decode.skip_decode.srgba8.conversion_gpu
- dEQP-GLES31.functional.srgb_texture_decode.skip_decode.srgba8.toggled
- dEQP-GLES31.functional.srgb_texture_decode.skip_decode.srgba8.multiple_textures
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Make sure the next renderer is a cleaned up one.
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
The enhanced layout extension allows for gaps in the streamout bindings
so we have to be able to handle no-handles in the middle of the target array.
TGSI also has to deal with components outputs where multiple outputs
can be mentioned in the TGSI. It's safe for use to just skip the
extra outputs at least for the tests I've been able to run.
Once we have those changes in place, the renderer can expose the
new CAP bit to the host without any further host extension checks.
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Alpha-textures are supported on GLES, unlike on OpenGL core profiles. So
we need to check for the difference here, otherwise we get textures
uploaded as alpha-textures, and then attempted swizzled as if they were
emulated as red-textures.
This fixes the following dEQP test-cases:
dEQP-GLES31.functional.texture.border_clamp.formats.alpha.nearest_size_pot
dEQP-GLES31.functional.texture.border_clamp.formats.alpha.nearest_size_npot
dEQP-GLES31.functional.texture.border_clamp.formats.alpha.linear_size_pot
dEQP-GLES31.functional.texture.border_clamp.formats.alpha.linear_size_npot
dEQP-GLES31.functional.texture.border_clamp.unused_channels.alpha
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
With this change the extansion is recognized and KHR_robustness exposed
in the guest.
v2: remove debug_printfs (Erik)
Closes: #9
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
The extension is already included in this GLSL version and adding it results
in compilation failures.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Also add OES_sample_shading to the test.
Fixes:
dEQP-GLES31.functional.image_load_store.2d.format_reinterpret.rgba16i_rgba16f
dEQP-GLES31.functional.image_load_store.2d.format_reinterpret.rgba32i_rgba32f
dEQP-GLES31.functional.image_load_store.3d.format_reinterpret.r32ui_r32f
dEQP-GLES31.functional.image_load_store.3d.format_reinterpret.rgba16ui_rgba16f
dEQP-GLES31.functional.image_load_store.cube.format_reinterpret.r32ui_r32f
Enabled (with some failures):
dEQP-GLES31.functional.debug.negative_coverage.*
dEQP-GLES31.functional.sample_shading.* (with some failures)
dEQP-GLES31.functional.shaders.sample_variables.*
dEQP-GLES31.functional.shaders.multisample_interpolation.*
Closes: #3
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
OES_geometry_shader and ARB_gpu_shader5 are enabled by gallium (also)
based on the GLSL level, but nothing else seems to be dependend on this
specific value, so set it. This also make the check for feat_tessellation
for enabling PIPE_PRIM_PATCH redundant.
Enables amonst others:
dEQP-GLES31.functional.texture.gather.offsets.*
dEQP-GLES31.functional.tessellation*
dEQP-GLES31.functional.geometry_shading.*
dEQP-GLES31.functional.shaders.opaque_type_indexing.*
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
In 47387e4 (emit precise keyword), I added code to try to declare
outputs as 'precise' if an instruction flagged as precise wrote to it.
Turns out, redeclaring built-ins as 'precise' isn't allowed, so that bit
was a mistake. And because mesa transforms "invariant" into instructions
with the precise-flag set, we can end up writing to built-ins with the
precise-flag, leading to shaders that doesn't compile correctly.
So let's remove the code that emits the precise-keyword when re-declaring
built-ins.
This fixes a regression in dEQP-GLES2.functional.shaders.algorithm.hsl_to_rgb_vertex
when ran right after dEQP-GLES2.functional.shaders.invariance.highp.subexpression_precision_lowp.
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>
Just like we do for normal GL, we also need to generate the extension
require string for OpenGL ES.
This fixes dEQP-GLES31.functional.blend_equation_advanced.*
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Tested-by: Gert Wollny gert.wollny@collabora.com
Signed-off-by: Dave Airlie <airlied@redhat.com>
ro/wo
Closes: #16
Fixes:
dEQP-GLES31.functional.image_load_store.*.format_reinterpret.*
dEQP-GLES31.functional.image_load_store.*.image_size.writeonly_*
dEQP-GLES31.functional.image_load_store.*.load_store.*
dEQP-GLES31.functional.image_load_store.*.qualifiers.restrict
dEQP-GLES31.functional.image_load_store.*.store.*
v2: remove superfluous check (Erik)
v3: Only emit the writeonly tag for these image formats when on
gles (Erik)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> (v2)
Some extensions that are by default available on GLSL 3.20 ES need to
be enabled when on GLSL 3.10 ES on a as-needed bases.
Closes: #25
Signed-off-by: Gert Wollny <gw.fossdev@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
In order to ensure that all the errors in the initialization are handled
before entering this routine assert on pre-existsing errors.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Consequently calling glGetIntegerv with GL_MAX_IMAGE_SAMPLES would results
in an error state on GLES that is not cleaned up and this has
consequences for the following processing.
Closes: #28
Fixes: 950de33c32
renderer: add image support. (v4)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This way we can report the actual max texture, rather than a
conservative guess like we do now.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
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>
findLSB, findMSB, and countBits always return a signed integer
Fixes:
dEQP-GLES31.functional.shaders.builtin_functions.uniform.findLSBMinusOne.*
dEQP-GLES31.functional.shaders.builtin_functions.integer.findmsb.*
dEQP-GLES31.functional.shaders.builtin_functions.integer.bitcount.*
Changes resulting from the discussion on mesa-dev with
Roland Schneidegger:
v2: Set values in infer_(src|dst)_type only
v3: Set values in the common infer_type code path, and only add
the source type for UMSB
Signed-off-by: Gert Wollny gert.wollny@collabora.com
Reviewed-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>
We didn't correctly reject textures that would fail glTexImage2D with an
GL_INVALID_OPERATION error. Trying to use the so accepted texture formats would later
lead to errors.
Correct this error and also the definition of VIRGL_FORMAT_X24S8_UINT that is needed
for GLES 3.1.
Closes: #15
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.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>
glTexBuffer doesn't accept GL_RGBA8_SNORM, so use GL_RGBA8UI
instead. Unfortunately, we can't use our texture table since
Gallium requests PIPE_FORMAT_R8_UNORM for texture buffers. For
normal sampler views, the correct semantics are passed down later,
but for images (where texture and image formats can differ) this
is not case.
Fixes:
dEQP-GLES31.functional.image_load_store.buffer.format_reinterpret.rgba8ui_rgba8_snorm
dEQP-GLES31.functional.image_load_store.buffer.format_reinterpret.r32ui_rgba8_snorm
dEQP-GLES31.functional.image_load_store.buffer.format_reinterpret.rgba8i_rgba8_snorm
dEQP-GLES31.functional.image_load_store.buffer.format_reinterpret.rgba8_rgba8_snorm
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>