On one hand it is simpler on GLES, because it allows direct readback, and
on the other hand it fixes failures when EXT_texture_buffer is not available.
Also unbind the buffers after use because otherwise glReadPixel would interpret the
pixel pointer argument as offset into the buffer and would fail.
Closes: #45
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
This helps expose GL_EXT_draw_buffers_indexed in the guest when the
host is not GLES 3.2 but provides the extension.
Enables tests
dEQP-GLES31.functional.draw_buffers_indexed.random.
max_required_draw_buffers.*
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
This is a follow up change for a5bfadaab5
to fix some request with 0 length shader. This moves the check from the
decode phase into create_shader as userspace may send 0
length shader in a long shader request.
TEST=webglaquarium
TEST=piglit opengl -t glsl --glsl
Reviewed-by: Dave Airlie <airlied@redhat.com>
Add support for TGSI's HW atomic counters, implemented here with
atomic_uint.
v2: - Fix calculation of atomic count in cmd
v3: - Add feature-checks (Dave Airlie)
v4: - Pass max-values for all stages and combined (Erik)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
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>
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>
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>
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>
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>
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>
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>
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>
Add a check for nonterminated string passed into the create_shader
code.
No point checking len <= 0, since it's a uint32_t.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Gallium copy_image redirects calls to resource_copy_region for equal src
and dst formats or if at least one of the two is compressed. Handle the
condition for selecting blit vs. glCopyImageSubRegion accordingly.
Fixes piglit: bptc-float-modes
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This adds the texture barrier support for the texture barriers,
a separate patch would be needed to implement the framebuffer fetch
barriers.
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Based on the website, glTexStorage2DMultisample requires at least
opengles >= 31 and opengl >= 43 or the extension.
Adding the check here.
v2: rebased using the features.
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>
The extension is also provied by GL 4.0 and GLES 3.1.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
glTexStorage*D is more restrictive in supporting texture formats, especially
on GLES. Specifically, it doesn't support BGRA textures that are needed to get
any useful display, but it is needed to get immutable textures that are required
for glTextureView.
Check which formats are supported and use glTexStorage*D for these, otherwise
fall back to use glTexImage*D.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This was bogus from the beginning.
Fixes: c0e0274e8c
virgl: Add method to query supported MSAA samples and positions
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
In certain cases, specifying level and layer for TBOs causes
tests to fail. Don't do this.
Fixes:
dEQP-GLES31.functional.image_load_store.buffer.image_size.writeonly_12
dEQP-GLES31.functional.image_load_store.buffer.image_size.writeonly_1
dEQP-GLES31.functional.image_load_store.buffer.image_size.readonly_writeonly_12
dEQP-GLES31.functional.image_load_store.buffer.image_size.readonly_writeonly_1
dEQP-GLES31.functional.image_load_store.buffer.image_size.readonly_12
dEQP-GLES31.functional.image_load_store.buffer.image_size.readonly_1
Signed-off-by: Dave Airlie <airlied@redhat.com>
Move all v2 caps into the caps_v2 function that also gets renamed.
Protect the GL only value queries by using the according gl_ver test.
(Part two of cleanup suggested by Gurchetan)
v4: rebase after image support and compute shader patches landed
v5: use basic check for GL for GL_SMOOTH_*_SIZE_RANGE (Erik)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v3)
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>
Also rename the function caps_common to indicated that only v1 caps are
set here.
(This is part one of the cleanup suggested by Gurchetan)
v4: rebase after image and compute shader patches landed
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v3)
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>
Also move the function code up in the file to let the code reflect the
call logic.
v4: rebase after image and computer shader patches landed
v5: take changes in previous patch into account
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v3)
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>
Since the gles code path is now reduced to just setting the gles
version, move all the glsl stuff into one place.
v3: remove now unused parameter gl_ver
v4: rebase after image and compute shader patches landed
v5: rework logic a bit taking Eriks suggestion into account
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v3)
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>
Use the new cap code path for setting it on GLES
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
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>
v2: Move some common version 2 caps into new function (Dave pointed
out there were some in common without checking the caps version)
v5: also fill common caps v2 from gles (Erik)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
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>