Take into account the gallium uniform buffer indices when associating
host UBOs with gallium uniform buffers.
Previously the code disregarded the gallium uniform buffer indices,
leading, under specific circumstances, to the provision of incorrect
data to the shaders. The problem manifested typically when a context
contained active UBOs which were not accessed by a particular shader,
but ended up being used instead of the correct UBOs for that shader.
This occurred, for example, when running the dEQP-GLES3.functional.ubo.*
in batch mode, in which case left over UBOs from previous tests would
cause subsequent tests to fail.
Fixes:
dEQP-GLES3.functional.ubo.* when run in batch mode
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Joe Kniss <djmk@chromiumos.org, djmk@google.com>
Tested-by: Elie Tournier <elie.tournier@collabora.com>
This is needed for fixing CTS:
dEQP-GLES3.functional.occlusion_query.conservative*
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
vrend_clear is passed in from gallium clear which, unlike glClear, must
not obey rasterizer discard and depth_clmap. However, the guest doesn't
foreard the latest update of the rendering states to the host before issuing
"clear". Therefore, the host clear command must clear these states before
calling glClear in turn. After calling glClear these states are again brought
into sync with what the host assumes.
Fixes CTS:
dEQP-GLES3.functional.rasterizer_discard.fbo.*
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
As I have only done testing on the gles-backend with this patch
the code is only enabled on it. Further testing might show that
it is possible to run this code on all backends.
v2: Try getteximage path on failure.
Fixes:
dEQP-GLES2.functional.texture.mipmap.2d.generate.a8_fastest
dEQP-GLES2.functional.texture.mipmap.2d.generate.a8_nicest
dEQP-GLES2.functional.texture.mipmap.2d.generate.l8_fastest
dEQP-GLES2.functional.texture.mipmap.2d.generate.l8_nicest
dEQP-GLES2.functional.texture.mipmap.2d.generate.la88_fastest
dEQP-GLES2.functional.texture.mipmap.2d.generate.la88_nicest
dEQP-GLES2.functional.texture.mipmap.cube.generate.a8_fastest
dEQP-GLES2.functional.texture.mipmap.cube.generate.a8_nicest
dEQP-GLES2.functional.texture.mipmap.cube.generate.l8_fastest
dEQP-GLES2.functional.texture.mipmap.cube.generate.l8_nicest
dEQP-GLES2.functional.texture.mipmap.cube.generate.la88_fastest
dEQP-GLES2.functional.texture.mipmap.cube.generate.la88_nicest
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Update the blit shader creation code to take the destination format
swizzle into account. This involves inverting the swizzle information
and using the inverted swizzle to reorder the texel components in the
shader. The new swizzle code also removes the need for having a special
case if the destination format uses emulated alpha.
This commit temporarily removes the VIRGL_FORMAT_R8G8B8X8_UNORM special
case. Improved support for it, and other similar "ignore alpha" cases,
is added back in an upcoming commit using appropriate swizzles.
At the moment we always recreate the shader in case we have a swizzle,
but a more efficient shader caching scheme could be devised to improve
this.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Use the source format swizzle information to set the
GL_TEXTURE_SWIZZLE_* parameters for the GL blit operation. This also
removes the need for the emulated alpha special case, since when using
emulated alpha the source format already has proper swizzle information.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
This is the SSBO analogue to 88444a. SSBOs are core in GL4.3 and
GLES31, so let's query for it.
This fixes 44 GLES31 tests on airlied@'s GLES31 sketch branches with
Nvidia hardware, but this patch standalone can be applied to master.
Example tests:
dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.0
dEQP-GLES31.functional.ssbo.layout.multi_basic_types.single_buffer.std430
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Ignores alpha channel while blitting R8G8B8X8_UNIFORM colorspace.
framebuffer It would be nice to perform some code refactoring in
vrend_blitter to minimize dup code. Fixes following test:
dEQP-GLES3.functional.fbo.blit.conversion.rgb8_to_rgba8']
dEQP-GLES3.functional.fbo.blit.conversion.rgb8_to_rgb10_a2
dEQP-GLES3.functional.fbo.blit.conversion.rgb8_to_rgba4']
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
The 'invariant' output data attrib was not properly implemented in
mesa's TGSI serialization, and was ignored in virglrender's conversion
from TGSI text to GLSL text. This patch adds 'invariant' support
and sets a new virgl cap to enable it since older versions of
virglrenderer will fail if invariant appears in the TGSI stream.
Tested: chromeos on qemu + virglrenderer
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Joe M. Kniss <djmk@google.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
We don't need to use gl blend if both source and target buffers are in sRGB
and colorspace transformation isn't requiqred. Fixes this test:
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_srgb8_alpha8
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
I hit app stall frequently when running virgl on Windows/macOS, it
turned out virgl kept calling glClientWaitSync and just got timeout.
According to https://www.khronos.org/opengl/wiki/Sync_Object, the sync
object may never be signaled without proper flushing. This glFlush fixes
the stall issue on Windows/macOS.
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Lepton Wu <lepton@chromium.org>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
This adds texture array and primitive restart caps which are
available on gles3.
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Forces using vrend_render_blit_gl if sourceframebuffers is in sRGB
colorspace. Fixes following tests:
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rgba8
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rgb10_a2
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rgba4
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rgb5_a1
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rgb8
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rgb565
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rg8
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_r8
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This fixes the remaining cull distance tests by making sure
we pipe the cull distance sizing through all the shaders properly.
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
We need it when uploading a 3D texture without a temporary buffer.
Fixes:
dEQP-GLES3.functional.texture.specification.texsubimage3d_unpack_params.r8_complex1
dEQP-GLES3.functional.texture.specification.texsubimage3d_unpack_params.r8_complex2
dEQP-GLES3.functional.texture.specification.texsubimage3d_unpack_params.r8_complex3
dEQP-GLES3.functional.texture.specification.texsubimage3d_unpack_params.r8_complex4
When we blit between depth or stencil buffers, but MSAA is enabled,
we can hit that path and set the GL_SCALED_RESOLVE_NICEST_EXT. This
causes the blit to fail. Fix this by not going in that path for
depth/stencil buffers.
Fixes:
dEQP-GLES3.functional.fbo.invalidate.whole.unbind_blit_msaa_color
dEQP-GLES3.functional.fbo.invalidate.whole.unbind_blit_msaa_depth
dEQP-GLES3.functional.fbo.invalidate.whole.unbind_blit_msaa_stencil
dEQP-GLES3.functional.fbo.invalidate.sub.unbind_blit_msaa_color
dEQP-GLES3.functional.fbo.invalidate.sub.unbind_blit_msaa_depth
dEQP-GLES3.functional.fbo.invalidate.sub.unbind_blit_msaa_stencil
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
This was pretty trivial to implement, so let's just get it out of the way.
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
The code would previously look at the emulated alpha texture's
swizzle, or the application swizzle, but wouldn't combine them
together. This means that swizzling was incorrect when using an
emulated alpha texture in conjunction with application swizzle.
Also, remove swizzle_* from struct vrend_sampler_view since these
aren't used outside of this single function.
Fixes:
dEQP-GLES3.functional.texture.swizzle.multi_channel.alpha_*
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
We don't want to end up with a height of zero.
Fixes "vrend: further modify read_transfer_data / write_transfer_data"
and the following dEQP tests:
dEQP-GLES3.functional.texture.specification.texstorage3d.format.*2d_array*
Example tests:
dEQP-GLES3.functional.texture.specification.texstorage3d.format.rgba16i_2d_array
dEQP-GLES3.functional.texture.specification.texstorage3d.format.rgba16ui_2d_array
glGetTexImage returns the entire texture, and we always copy from
the beginning of the texture. Instead, we should start copying
from the offset specified by the bounding box.
Fixes:
dEQP-GLES3.functional.texture.shadow.2d_array.*.*depth*
Example test cases:
dEQP-GLES3.functional.texture.shadow.2d_array.linear.not_equal_depth_component32f
dEQP-GLES3.functional.texture.shadow.2d_array.nearest_mipmap_nearest.less_or_equal_depth_component16
dEQP-GLES3.functional.texture.shadow.2d_array.nearest_mipmap_nearest.greater_or_equal_depth_component16
v2: Cubemap textures seem to suffer from the same issue:
Fixes:
dEQP-GLES3.functional.texture.shadow.cube.nearest.*
Example test cases:
dEQP-GLES3.functional.texture.shadow.cube.nearest.less_or_equal_depth_component16
dEQP-GLES3.functional.texture.shadow.cube.nearest.less_or_equal_depth24_stencil8
v3: Make sure we still make only 1 glTexSubImage3D call in the non-cubemap case
v4: Fix slice size and texture size calculations.
Fixes:
dEQP-GLES3.functional.texture.filtering.3d.formats.rgb9_e5_nearest
dEQP-GLES3.functional.texture.filtering.3d.formats.rgb9_e5_linear
Signed-off-by: Dave Airlie <airlied@redhat.com>
This was previously ignored.
Along with the mesa patch, this fixes ~100 dEQP tests:
dEQP-GLES3.functional.texture.filtering.cube.*
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
We don't always start at a z-offset of zero. For example, when
Gallium copies a temporary depth texture to the final depth texture
[i.e, the one finalized in st_finalize_texture(..)], it sends the
copy commands one slice at a time.
Fixes:
dEQP-GLES3.functional.texture.specification.teximage3d_depth.depth_component32f_2d_array
dEQP-GLES3.functional.texture.specification.teximage3d_depth.depth_component24_2d_array
Resets stencil buffer write mask to ~0u before glClear().
Fixes many tests which use stencil buffer with increment, decrement or
invert operations. For example:
dEQP-GLES3.functional.fragment_ops.random.18
dEQP-GLES3.functional.fragment_ops.random.25
dEQP-GLES3.functional.fragment_ops.interaction.basic_shader.2
We need a case for 24-bit formats, like GL_RGB8I.
Fixes:
dEQP-GLES3.functional.texture.specification.*.{rgb8i, rgb8ui}
dEQP-GLES3.functional.texture.format.sized.2d.*.{rgb8i, rgb8ui}
Example test cases:
dEQP-GLES3.functional.texture.specification.basic_teximage2d.rgb8i_2d
dEQP-GLES3.functional.texture.specification.basic_teximage2d.rgb8ui_2d
dEQP-GLES3.functional.texture.format.sized.2d.rgb8i_npot
Signed-off-by: Dave Airlie <airlied@redhat.com>
outputs from vertex shaders are now vso
and outputs from geometry shaders are now gso.
This allows adding tessellation a bit easier.
Signed-off-by: Dave Airlie <airlied@redhat.com>
1) The offset at each depth should be the layer stride
i.e.,(depth * stride * height)
2) We shouldn't do a single write / read when the depth != 1.
Fixes:
dEQP-GLES3.functional.texture.specification.basic_texsubimage3d.*
Example test:
dEQP-GLES3.functional.texture.specification.basic_texsubimage3d.rgba32f_3d
Signed-off-by: Dave Airlie <airlied@redhat.com>
The previous calculation (block_stride * block_height * depth) led
to data corruption since we don't take stride into account when
allocating the temporary buffer.
With this fix,
dEQP-GLES3.functional.texture.specification.basic_texsubimage3d.rgba32f_3d
doesn't crash the virtual machine (though the test fails).
Signed-off-by: Dave Airlie <airlied@redhat.com>
"vrend: Fix iovec read/write for depth" started making of use of
the bounding box's depth in the fallback path. It turns out in
some instances, the temporary buffer used by iovec read/write
is not large enough, leading to memory corruption.
Let's separate send_size from alloc_size in some cases, since
glReadnPixels requires it.
With this fix,
dEQP-GLES3.functional.texture.specification.basic_texsubimage3d.rgba32f_3d
doesn't crash the virtual machine (though the test fails).
Signed-off-by: Dave Airlie <airlied@redhat.com>
The depth was ignored in the fallback path, which caused us to copy
only the first layer.
This fixes:
dEQP-GLES3.functional.shaders.texture_functions.texture.isampler2darray.*
and probably other 3D texture/sample array tests.
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
glBindBufferRange(..) in vrend_draw_bind_ubo is failing with
more than one uniform block. This is due to improper alignment
of the start of the second block. Let's query the proper
alignment from the driver and pass it back to Mesa.
Let's also query for GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT just in
case, even though don't use glTexBufferRange yet.
Fixes:
dEQP-GLES3.functional.ubo.* on Nvidia
Example test:
dEQP-GLES3.functional.ubo.multi_basic_types.single_buffer.shared_vertex
Signed-off-by: Dave Airlie <airlied@redhat.com>
OpenGL ES don't support 1D texture.
So we replace these textures by some 2D texture with one of
the component set to 0.5
v2: Use new use_gles state on vrend_shader_cfg.
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Some features:
* Always use the "#version 300 es" header
* Set high precision by default
* Do not use noperspective attribute
v2: Do not create a global state but instead add field
vrend_shader_cfg and send that into more functions.
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Previously, vrend_shader insterted a scale & bias to emulate
glDepthRange in all vertex shaders. This approach will fail
to match the gl spec in some situations. glDepthRange() is also
called, causing the transformation to be applied twice. The
winsys_adjust uniform is now a scalar to implement the y-flip only.
This bug was discovered and tested using the
dEQP-GLES2.functional.depth_range test suite. This test now passes
all but one case, which appears to be a separate issue.
Signed-off-by: Joe M. Kniss <djmk@google.com>
[airlied: fixes some piglit tests as well - no regressions]
Signed-off-by: Dave Airlie <airlied@redhat.com>
If we bind a GL program with a given id, then destroy the program and
its id, then immediately create another program which ends up with
the same id, we won't be able to tell that a new program needs to be
bound, and we will access freed data. This results in funny crashes.
We fix this by setting the program to 0 when a different shader is
being bound. This will force the draw code to bind the proper program
later on.
This fixes a lot of semi-random crashes. To debug it I used this
particular deqp test which becomes stable with this change:
dEQP-GLES3.functional.draw.draw_elements.triangle_fan.default_attribute
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Robert Foss <robert.foss@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Currently, we always try to create an OpenGL 3.1 context. Some
dEQP tests require an OpenGL 3.2 context (specifically, ones
that use glGetInteger64v). Let's try to create the highest
version context we can, and iterate to lower versions, i.e:
https://developer.android.com/guide/topics/graphics/opengl.html#version-check
The return code for (*create_gl_context) is a little unclear.
This patch assumes NULL is returned on failure. This should work
for GLX and EGL.
GLX:
"On failure glXCreateContextAttribsARB returns NULL and generates
an X error with extended error information"
https://www.khronos.org/registry/OpenGL/extensions/ARB/GLX_ARB_create_context.txt
EGL:
"#define EGL_NO_CONTEXT ((EGLContext)0)"
https://www.khronos.org/registry/EGL/api/1.1/EGL/egl.h
The semantics of rcbs->create_gl_context may be different, though.
Fixes:
dEQP-GLES3.functional.state_query.integers.max_vertex_output_components_getinteger64
dEQP-GLES3.functional.state_query.integers.max_vertex_output_components_getfloat
Signed-off-by: Dave Airlie <airlied@redhat.com>
... previously we were only looking at the last attachment.
Fixes dEQP-GLES3.functional.fragment_out.random.86 and probably others
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>