This just cleans this out to a separate fn
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Commit 84fc54f6bf introduced the use of RG
formats with a swizzle as backing store for guest requested LA formats.
This works for many cases (e.g. blitting), but unfortunately it can't be
used when rendering with blending to an LA target. Since GL doesn't
support texture write swizzles the swizzle needs to happen in the
fragment shader and that's too early for proper blending.
We can safely revert the offending commit since the tests fixed by it
have since been fixed by other commits (e.g., "vrend: Nop sends to
backing iovs for readonly textures v2") in a different way. The one
side effect of reverting is that, depending on the GL version, a less
efficient path may be taken in the guest Mesa when mipmapping LA formats
since they may not be considered color-renderable anymore.
Fixes:
various piglit LA regressions
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Update the GL blit code to support blitting for multisample textures,
for both normalized and integer color formats.
The minimum GLSL ES version in the shaders is also raised to 3.1, since
GLSL ES 3.0 doesn't support multisample textures.
Fixes:
dEQP-GLES3.functional.fbo.msaa.2_samples.rgb8
dEQP-GLES3.functional.fbo.msaa.4_samples.rgb8
dEQP-GLES3.functional.fbo.msaa.8_samples.rgb8
Various piglit MSAA luminance related regressions
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Update the GL blit code to emit correct shaders when integer color
formats are involved.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Remove VIRGL_FORMAT_B8G8R8A8_SRGB and VIRGL_FORMAT_B8G8R8X8_SRGB when
running on GLES because we cannot upload textures in GL_BGRA.
Mesa has been extended to use instead their RGBA counterparts.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
glTexImage2D on GLES doesn't support GL_BGRA, so remove this one more
format so one with a GL_RGBA layout is chosen instead on GLES.
Fixes dEQP-GLES3.functional.texture.format.sized.2d.rgb5_a1_pot
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
and make sure that on GLES it it chosen for GL_RGBA4 over
VIRGL_FORMAT_B4G4R4A4_UNORM, by removing support for the latter.
This is needed because on GLES3 GL_BGRA isn't a supported format to pass
to glTexImage3D.
Fixes the test dEQP-GLES3.functional.texture.format.sized.3d.rgba4_pot
on GLES hosts.
v2: * Make more explicit the GL/GLES split (Gert Wollny)
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Suggested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
As Mesa doesn't support glReadPixel with GL_BGRA_INTEGER on GLES, add this
format so Virgl calls glReadPixel with GL_RGBA_INTEGER.
Fixes dEQP-GLES3.functional.fbo.color.clear.rgb10_a2ui
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
iter_instruction is a big function. Let's make it smaller
by moving some functionality.
v2: Fix comment
v3: Four sources again
Signed-off-by: Dave Airlie <airlied@redhat.com>
iter_instruction is a big function. Let's make it smaller
by moving some functionality.
v2: In certain cases, FLOAT_BITS_TO_UINT --> FLOAT_BITS_TO_INT (Elie)
Fix commit message
v3: Allow for multiple destinations again.
[airlied: fix missing dtypeprefix->*dtypeprefix regression]
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit uses the get_string() helper to convert various
enums to prefixes / conversion strings.
v2: In certain cases, FLOAT_BITS_TO_UINT --> FLOAT_BITS_TO_INT (Elie)
[airlied: fixup one more incorrect uint->int for interp sample]
Signed-off-by: Dave Airlie <airlied@redhat.com>
This associates the conversions / casts with enums. The idea is
to make conversion into a string the last step in the process.
Signed-off-by: Dave Airlie <airlied@redhat.com>
This makes sure we never accidentally set a lower glsl version
after a higher one (we don't ever, but best to make sure).
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Followup to the previous patch that introduced bit to string table.
Patchset tested using GLES3 dEQP suite.
Reviewed-by: Dave Airlie <airlied@redhat.com>
This allows the tbo code to properly detect if we are using a buffer
as a texture or not, instead of relying on GL_TEXTURE_BUFFER being used.
We also don't need to special case generate the tbo texture id until
sampler bind time.
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Until we support ARB_texture_buffer_range we shouldn't report
this value as mesa will enable the extension.
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
[addr%d] could in theory be [addr65536] so needs a few more bytes.
Fixes warning:
vrend_shader.c: In function ‘iter_instruction’:
vrend_shader.c:1861:38: warning: ‘%d’ directive writing between 1 and 6 bytes into a region of size 4 [-Wformat-overflow=]
sprintf(arrayname, "[addr%d]", src->DimIndirect.Index);
^~
vrend_shader.c:1861:32: note: directive argument in the range [-32768, 32767]
sprintf(arrayname, "[addr%d]", src->DimIndirect.Index);
^~~~~~~~~~
vrend_shader.c:1861:13: note: ‘sprintf’ output between 8 and 13 bytes into a destination of size 9
sprintf(arrayname, "[addr%d]", src->DimIndirect.Index);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
It seems under some GPU/profile, GL_INVALID_ENUM is generated
instead of GL_INVALID_VALUE for unsupported internal format.
This is even conflicted in reference documents. Just handle
them at same time.
From:
https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml
GL_INVALID_ENUM is generated if internalFormat is not one of the accepted
resolution and format symbolic constants.
From:
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml
GL_INVALID_VALUE is generated if internalFormat is not one of the accepted
resolution and format symbolic constants.
Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
v2: drop interp_temp, less special case temps
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This adds the bitfield and multiplies and barrier.
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This adds support for the transform feedback vertex streams
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
These are needed for ARB_gpu_shader5
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This adds the ability for the scanner to locate files
that need dimensions.
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
We will use the scanner to find a few things needed for ARB_gpu_shader5.
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Warn if the expected native format/type differs from the allowed
type and format that are accepted by the OpenGL ES spec.
This is hopefully only a problem for Mesa which we have now fixed.
Other option is to add two extra copies and format conversions.
v2: More verbose and better comment.
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>