The resources we create for gallium resources should be immutable
wrt the layout we want, so if we have the texture storage APIs
available we should use those instead of the tex image ones to
create the initial storage.
This is also a necessary precursor for texture view support.
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
This just makes sure we use the correct destruction path.
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Virglrender holds the values in a structure vrend_sub_context that is zeroed
out when it is initialized.
So, when the first state change set the near_val and far_val to zero,
the check assumes it is the old state and doesn't call glDepthRange.
Fixes: dEQP-GLES2.functional.depth_range.write.zero_to_zero
v2: initialize far_val in vrend_renderer_create_sub_ctx (Gurchetan)
Suggested-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
On GLES >= 3.1 all the functionality that is currently relevant for
attribute binding in virglrenderer is available. However, GLES 3.1 does
not fully implement GL_ARB_vertex_attrib_binding. Therefore, rename the
flag "have_vertex_attrib_binding" to "have_gles31_vertex_attrib_binding",
and set it when the host implements GL_ARB_vertex_attrib_binding, is
GL >= 4.3 or GLES >= 3.1. As a result with these configuration the new
code path vrend_draw_bind_vertex_binding is used.
Fixes on GLES 3.1 hosts:
dEQP-GLES3.functional.clipping.point.wide_point_z_clip
dEQP-GLES3.functional.clipping.point.wide_point_z_clip_viewport_center
dEQP-GLES3.functional.clipping.point.wide_point_z_clip_viewport_corner
On an Intel Kabylake GLES 3.1 host this also fixes:
dEQP-GLES3.functional.clipping.point.wide_point_clip
dEQP-GLES3.functional.clipping.point.wide_point_clip_viewport_center
dEQP-GLES3.functional.clipping.point.wide_point_clip_viewport_corner
but it should be noted that these three tests expect that also points with a
centre outside the clip volume will be partially drawn when they overlap with
the clip volume because of being "wide" (i.e. when moving towards the clip
volume boundary a wide point would "naturally" move out). The OpenGL standard
defines that points should be clipped the moment the centre is outside the
clip volume (i.e. points will "pop" in and out of the view when moving across
the border). Hence, for a host implementation following the standard to the
letter these tests should actually fail.
v2: - rename have_vertex_attrib_binding to have_gles31_vertex_attrib_binding
- clarify the commit message describing the wide point clipping problem
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
We don't need the entire 32 bits to report the presence of TGSI
invariant support.
Suggested-by: Gert Wollny <gert.wollny@collabora.com>
Suggested-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
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>