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>
In the case of PIPE_TEXTURE_CUBE, util_gen_mipmap (in Mesa)
encodes the target face in blit.{src,dst}.box.z. We need to
bind to the correct texture target before we draw.
Also removed extraneous whitespace.
Fixes:
dEQP-GLES2.functional.texture.mipmap.cube.generate.a8_fastest
dEQP-GLES2.functional.texture.mipmap.cube.generate.a8_nicest
dEQP-GLES2.functional.texture.specification.basic_copyteximage2d.cube_alpha
dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.cube_alpha
[airlied: also fixes piglit:
spec@arb_texture_cube_map@copyteximage cube]
v2: Set layer to dst_z for cases other than GL_CUBE_MAP
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>
When emulating GL_ALPHA8 with GL_R8, we should make the alpha
component equal to the red color channel.
Fixes:
['dEQP-GLES2.functional.texture.mipmap.2d.generate.a8_fastest']
['dEQP-GLES2.functional.texture.mipmap.2d.generate.a8_nicest']
on OpenGL 4.5 (core).
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
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>
Refactors vertex/fragment shader exit routine. Handles all end points properly.
Fixes dEQP-GLES2.functional.shaders.return.output_write_dynamic_vertex test.
[airlied: cleanup damaged whitespace + remove old geom lines of no use]
Signed-off-by: Dave Airlie <airlied@redhat.com>
Make EGL optional since it's use in virglrenderer isn't always
compatible with drivers on linux, for example nVidia does not
provide a GBM implementation (used by virgl_egl*) with their
linux drivers.
Signed-off-by: Joe M. Kniss <djmk@google.com>
v2: Fix typo (Dave)
(still would much rather this was done at runtime as well)
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>
This just adds backend conversion support for the extended
texture gather instructions used for arb_gpu_shader5.
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>
GLES does not support using Z32 as depth stencil, overwrite this
with Z24 which is supported.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
These two formats are required by DRI in the guest and as such
Wayland, X11, GBM or any API built on top if DRI. The format
GL_BGRA_EXT is not supported on Desktop OpenGL.
v2: Better documentation.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Another requirement for GL4.0 is support for ARB_sample_shading.
This enables it and turns on the cap when needed.
Signed-off-by: Dave Airlie <airlied@redhat.com>
These are needed for ARB_draw_indirect and GL4.0
This enables support and turns in the cap when
support is present.
This also enhances the draw packets to cover
future features, it doesn't enable or show these
yet, since other work is required in the shaders.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Now that we have the proper line width limitations, we can emit the
actual line width. This fixes:
dEQP-GLES2.functional.clipping.line.wide_line* tests.
Reviewed-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
This new struct allows us to report:
- accurate max point size and line width
- accurate texel and texture gather offsets
- vertex and geometry shader limits
- one future tessellation limit
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Consider this series of events:
glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor(0.125f, 0.25f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
With virgl, this may render an incorrect result. This is because
there our two paths for clears in Gallium -- one for full clears
(st->pipe->clear) and another for color-masked/scissored clears
(clear_with_quad). We only encode the color mask in the
virgl_encode_blend_state in the clear_with_quad case.
We should set the colormask the case of full clears as well, since
we need to update the GL state on the host driver.
With this patch, the number of dEQP GLES2 failures on Virgl with a
nvidia host driver goes from 260 to 136 with no regressions.
Some representative test cases are:
dEQP-GLES2.functional.color_clear.masked_scissored_rgb
dEQP-GLES2.functional.color_clear.masked_scissored_rgba
dEQP-GLES2.functional.depth_stencil_clear.depth_stencil_scissored
dEQP-GLES2.functional.fragment_ops.random.0
dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.0
v2: Revise comments, fix curly braces (Elie)
Signed-off-by: Dave Airlie <airlied@redhat.com>
Not supported at all in GLES, 1x1 texture rectangles can be emulated by
GL_TEXTURE_2D, which was the only usage I have come accross in my limited
testing.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Not supported in GLES, this silences lots of errors.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This is not supported in GLES, only warn any setting other then the default.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
The size of 1.0 is supported since it is the default, while the
size of 0.0f is invalid so we don't have to warn about it.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
OpenGL ES glDepthRange clamps the values, warn if the range is out of bounds.
We can't do much more then then this, during normal guest side Desktop OpenGL
operation this does not seem to happen.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
GLES is missing various bits that is also missing in core profile. The there is
warnings for those so copy those warnings and make them GLES specific.
Current batch is:
* GLES only supports GL_FILL polygon mode.
* GLES does not support line stipple.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
GL_KHR_robustness exposes some of the GL_ARB_robustness functions, use those
functions if available. Where possible we want to use safe variants.
v2: Fix detection logic in if case
v3: Use GL_KHR_robustness instead of GL version
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Detect OpenGL ES context being given to us. This is just the detection code,
it does not do any other fallback or work around. This is required for the
rest of the OpenGL ES code that follows. It is assumed that virgl will not
decide to use OpenGL ES and that is the hardware platform that forces this.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Make sure we add debug printing to the sub-context
and disable printing when getting the format list.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
The glGetQueryObjectuiv is available both in GLES and in Desktop OpenGL.
While glGetQueryObjectiv is not available in GLES.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>