With that the srgb <-> linear handling can be simplified.
v2: Don't use texture views when TextureStorage can't be used to create
the texture, because then it is not immutable.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
later we need this function in the blitter
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
v2: Don't use texture views if the texture of the format can't be
allocated by using TextureStorage, since then it is not immutable
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
On GL 4.4 (and GLES with EXT_sRGB_write_control) blits will decode and
encode sRGB when GL_FRAMEBUFFER_SRGB is supported, and they don't decode
when it isn't supported. Enabling or disabling this is signalled from
the guest by using the according surfaces.
In summary, there is no need to use the GL fallback for a blit decoding
sRGB, because this can also be handled in a normal blit.
Fixes piglits on a GL host:
blit texture srgb_to_linear downsample enabled render
blit renderbuffer srgb_to_linear msaa enabled render
blit renderbuffer srgb_to_linear msaa enabled clear
blit renderbuffer srgb_to_linear downsample enabled clear
v2: Fix typo in commit message (Erik)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
The GL_EXT_color_buffer_float exptension spec defines that glReadPixels
can be done with the combination of GL_RGBA and GL_FLOAT, which matches
what OpenGL ES 3.2 allows. So let's enable the readback-format in this
case.
Thanks to Gert Wollny for pointing this out.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Fixes: 368d950e8f
shader: emulate indirect ssbo write access on GLES using a switch statement
Thanks Erik for catching this.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
This buffer was introduced, but never used. Fixes a warning.
While we're at it, fixup the lack of EOL at EOF.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Fixes: 75f2191 ("shader: Don't emit gl_FragCoord layout qualifier on
GLES and emulate pixel_center_integer")
Reviewed-By: <gert.wollny@collabora.com>
On D-GL a program may contain a TE shader but no TC shader. On GLES either
both or none of TES and TCS need to be available. So if the guest sends a
shader program without a TCS, inject a passthrough shader using the
patch parameters given in the GL code.
Closes#84
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
These functions will later also be used to create a TC passthrough shader
on GLES of a GL guest doesn't send one.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
With the exception of VS inputs and FS outputs the use of components
and location layout qualifiers also requires the extension
ARB_separate_shader_objects on GL (or GLSL 4.10).
Fixes: 08b3ddded8
vrend: Signal the guest that indirect arrays are available
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Allow external users to intercept resource creation based on
scanout bind flag.
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
v2: Make use of the helper function introduced before (Gurchetan)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Fixes piglit on GLES host:
arb_shader_storage_buffer_object@execution@indirect
v2: use helper function to emit code (Gurchetan)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Resolve the indirect access by using a switch statement instead of the
indirect addressing.
Fixes: arb_arrays_of_arrays/execution/image_store/
basic-imageStore-*-const-uniform-index
Signed-off-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
With the new optimizations applied to the i965 driver it becomes
a requirement to specify buffers as coherent if the access is declared
as such. This fixes a regression with
dEQP-GLES31.functional.synchronization.in_invocation.ssbo_alias_overwrite
Closes#93
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Given a source and destination image, consider the following sequence
of events:
1) glTexImage with src
2) virgl_resource_copy_region copies src to dst using GL
3) mesa attempts to readback dst, which returns the correct
result with vrend_transfer_send_getteximage only
Commands that reproduce this scenario on i965/qemu:
./bin/arb_copy_image-formats -auto
./bin/fbo-generatemipmap-formats GL_ARB_texture_float -auto
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Closes: #74
v2: * Enable enhanced layouts in the guest only when the host supports
it, because with indirect arrays enabled we re-emit the layout
the guest send.
* enable indirect arrays independently from the host capabilities
(following Eriks comments)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
Also check for GL_EXT_polygon_offset_clamp when deciding whether the
corresponding virgl feature is supported. This enables D3D11 in guest
Wine (and thus Steam/Proton), when running on GLES hosts that support
this extension.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This is useful for knowing if we can expose
KHR_texture_compression_astc_sliced_3d in the guest.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
We should also check for S3_s3tc to detect S3TC texture compression
support.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
The piglits and KHR tests that use TF3 (i.e. multiple output
streams) tend to hang, and since the GLES host doesn't support
this but we lie about the GLSL version it is better to signal
the guest correctly that this is not supported.
v2: Set flag only on caps v2 code path, otherwise we might read
from uninitialized memory
v3: Increment feature check version to indicate that the TF3
feature flag is valid.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
In order to properly propagate the output masks to the inputs of the next
shader the shader slection has do be done in the order the shaders will be
called later.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
This is useful to avoid unsupported format-conversions on GLES.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This code-path is never going to work on GLES, so let's avoid trying.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This just removes some duplicate complexity, and adds a few asserts to
notice format-list mismatches earlier.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This adds the support for ARB_indirect_parameters extension
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
The mesa state tracker can emulate this, but we should pass
it through properly to the host in case it has a more efficent path.
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
When I added indirect draw support, I forgot to add support
for the binding flag for command args, we need this later,
but in order to introduce support without breaking things,
we should fix the bug first and add a separate cap for it.
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
When we add new feature checks on the host side that is used to enable
a cap conditionally in the guest that was enabled unconditionally before
we might end up with a feature regression when a new mesa version is
used with an old virglrenderer version that doesn't check for that cap.
To work around this problem add a version id to the caps that corresponds
to the features that are actually checked on the host so that it can be
checked in the guest whether this cap was actually checked for or whether
it should be enabled unconditionally.
The id should be incremented whenever a new feature check is added that
might result in a feature regression in the guest when run on an old host.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Pohsien Wang <pwang@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
We support only three mode of mip filter:
PIPE_TEX_MIPFILTER_NONE
PIPE_TEX_MIPFILTER_LINEAR
PIPE_TEX_MIPFILTER_NEAREST
Add check to prevent it fall down to other senarios.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
On GLES Mesa rejects arrays of arrays as TCS and TES shader inputs and outputs.
This is based on section 4.3 of the GLSL 3.20 ES standard where an error should be
produced for "Per-vertex-arrayed arrays of arrays" and "For non-per-vertex-arrayed
array of arrays", so apparently something like
in vec4 [][N];
is not allowed and on GLES interface blocks have to be used instead. In addition the
code needed some fixups when interface blocks are used.
v2: Emit correct type for elements in blocks
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
The shaders are issued backwards starting from the fragment
shader and, therefore, in the first pass when we fill out
the shader keys for the TES no TCS will be present.
So don't bail out in this case and assume there is a VS.
Later, when the VS shader is compiled it will check whether
a TES is present without a TCS and report the error.
Fixes: 956a6ceb8d
shader: Pass information about the layout of generics and patches to the next stage
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
This is not legal. This fix help with "The Talos Principle" that triggers
emitting an invariant shader.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
This fixes most of the piglit:
arb_shader_image_load_store-qualifiers
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
With GLSL ES a format layout is requires, and with GL it doesn't hurt to
add it, so always emit rgba32f when no format is given.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
On GL WR translates to writable, but on GLES we translate this
to writeonly because for most formats one has to specify one or
the other, so if we have an image with the TGSI WR specification,
and read from it, we drop the Writable flag. For the images that
allow RW this is of no consequence, and for the others a write
access will fail instead of the read access, but this doesn't
constitue a regression because we couldn't do both - read and
write - anyway.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Softpipe doesn't support ARB_GLES3_1_compatibility but can support
NV_shader_atomic_float and this is needed for some dEQP-GLES31 tests to be
run on a softpipe GL host.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
(u|i)mulExtended are provided by ARB_gpu_shaders5 but also by
MESA_shader_integer_functions and only the latter is supported by softpipe
so fall back to this extension if needed.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This is needed for using the right extension in the shaders.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This is not required and actually an error.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
Fixes 1D part of piglits of: bin/arb_shader_image_size-builtin
(The tests require glViewportIndexedfv enabled with !182)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Fixes: KHR-GL33.texture_size_promotion.functional
v2: Put bias at right position when offset is present
Fixes piglit: texelFetch offset 140 fs isampler2DRect
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Fixes piglits on GLES host:
tex-miplevel-selection * 1D*
The only piglits that are not fixed from the tex-miplevel-selection
are those including sampler1DArrayShadow. emulating these by using
sampler2DArrayShadow is not always possible, because GLSL doesn't
provide the required overloads.
Namely textureOffset, textureLod, textureLodOffset, and texture with
bias parameter are not available.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
samplers on GLES
Since the sampler is emulated by a 2D sampler the offset must also be a
2D vector and the coordinate argument must be ivec2.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Since the 1D texture arrays are emulated by using 2D texture
arrays the number of array layers is in the z component.
Fixes piglits on GLES:
textureSize * *sampler1DArray
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>