This pulls the per shader type code out into a separate function.
This is prep work for adding compute shaders.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This just pulls in a bunch of TGSI changes from upstream
that make adding GLES3.1 features easier.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
[airlied: I split this bit out - bisections are a lot easier]
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reason: the second parameter in glBufferSubData() is the offset,
but in vrend_read_from_iovec_cb() function in iov.c, the "count"
is passed to it causing to possibly write beyond the buffer boundary
(or at wrong offset).
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
[airlied: I split this bit out - bisections are a lot easier]
Reviewed-by: Dave Airlie <airlied@redhat.com>
[airlied: pushed the get up a bit higher to make it cleaner]
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
v2: With epoxy GL/gl.h is not directly included (Dave Airlie).
Instead move the include of epoxy/gl.h from vrend_renderer.c to
vrend_renderer.h
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Allow resources created externally (eg gbm created buffers as
dma bufs) to be used. As an example, crosvm
(https://chromium.googlesource.com/chromiumos/platform/crosvm/)
will intercept resource creation to use minigbm to allocate
buffers that its compositor is able to properly handle since it
only supports compositing with buffers allocated via minigbm.
This patch allows direct rendering to those buffers without
requiring an extra copy.
v2: Handle missing extension better.
v3: Update commit message with more details on usage.
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
virgl_renderer_resource_get_info() doesn't return the underlying image
stride. eglExportDMABUFImageMESA() does. This fixes imports failing
due to a stride mismatch under certain resolutions. (note that qemu
uses its own export methods, perhaps because Gerd noticed the problem
with virgl egl export functions)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
On GLES a multi-sample FBO region can only be blit to an non multi-sample
region if the source and the target rectangle are the same. The fallback
using GL and shaders doesn't work if a stencil buffer is involved, because
writing to a stencil buffer from a shader is usually not supported (i.e.
the extension ARB_shader_stencil_export is not available).
Implement a workaround for this case and also the case when the depth
buffer is involved by first blitting the complete multi-sample FBO to an
intermediate, non multi-sample FBO, and apply the region blit to the
actual target FBO afterwards.
Fixes:
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
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
v2: * Replace allocation via the formerly extracted resource allocation
funtion with allocating the texture via the newly extracted methods
to copy the texture parameters and allocate the texture.
* in the intermediate blit use the minified size that corresonds
to the layer to be copied
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Two functions are extracted from vrend_renderer_resource_create to
make it possible to allocate a texture resource without adding too much
code duplication:
vrend_renderer_resource_copy_args:
copies all required arguments from the args struct into the
already allocated resource
vrend_renderer_resource_allocate_texture:
Allocate a texture using the parameters in the given resource struct
v2: * instead of extracting the complete allocation also including buffers,
only extract the parts that copy the parameters and allocate the texture
* use latest upstream that also includes texture storage objects
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
This also exposes patches as a primitive type
v2: enable patch varyings
v3: update patch varyings value from GL API.
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This adds the so movs emission along with setting the correct
primitive in begin for tessellation shaders
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This adds all the shader program building and dirtying for
tess shaders.
The big change is building the key so that we get the correct
tess input/output blocks.
It might be possible SSO could reduce some of that overheads
v2: fixup warnings
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This adds support for tess factors and tess coord semantics
v2: remove no wm settings for some vars, fix int required for
vertices in, fix tessinner/outer building, handle primid/verticesin
as ints.
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Just add clip dist support for tess shaders.
v2: drop create_swizzled changes no need at this point
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This takes the tgsi shader properties and emits the correct GLSL
layouts.
It also exports the tes prim and point info to the renderer,
for transform feedback
v2: add prim/point for transform feedback
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This adds the shader key bits, along with a bunch of the
string handling for tess shaders
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
tess will needs this as well
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This name makes more sense if we have output blocks
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This passes the default tessellation factors from the guest to
the host.
v2: fix warnings
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This just adds a flag to say we have tessellation available
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This just cleans the code up so adding more shader types gets easier.
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This pulls in the latest TGSI properties.
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
With tessellation we can have 32 patch varyings on top of the old limit
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This was missing the emit line.
Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
This is a basic step towards GL4.0 and greater,
add support for the FP64 extension.
This requires ARB_gpu_shader5 on the host, to
implement ldexp using bitfieldInsert.
v2: drop fp64_srcs into local var
fix imul regression due to rebase
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Some shaders seem to set this flag when dual-src is enabled,
we don't want to trash the cbuf1 write in that case.
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
For dual src blending to work we have to link the shader in a certain
way, so we have to dirty the shaders on a new blend state, then
we have to make sure the dual src bit is the same before avoiding
a relink state, otherwise have to relink.
This fixes:
piglit arb_blend_func_extended-fbo-extended-blend
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
vrend_decode.c: In function »vrend_decode_create_shader«:
vrend_decode.c:92:24: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
for (i = 0; i < so_info.num_outputs; i++) {
^
vrend_decode.c: In function »vrend_decode_set_framebuffer_state«:
vrend_decode.c:139:15: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
if (length != (2 + nr_cbufs))
^~
vrend_decode.c:145:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
for (i = 0; i < nr_cbufs; i++)
^
vrend_decode.c: In function »vrend_decode_set_viewport_state«:
vrend_decode.c:195:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
for (v = 0; v < num_viewports; v++) {
^
vrend_decode.c: In function »vrend_decode_set_sampler_views«:
vrend_decode.c:296:19: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
start_slot > (PIPE_MAX_SHADER_SAMPLER_VIEWS - num_samps))
^
vrend_decode.c: In function »vrend_decode_set_scissor_state«:
vrend_decode.c:810:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
for (s = 0; s < num_scissor; s++) {
^
vrend_decode.c: In function »vrend_decode_set_streamout_targets«:
vrend_decode.c:1064:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
for (i = 0; i < num_handles; i++)
v2: correct language of warnung messages
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>