We essentially repeat the same code twice here, with a small
variation. Let's factor out the common code into a helper, so we
don't have to keep updating two copies. This is similar to what's
already done for samplers.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
There's no point in copying the two only members out of the struct and
onto the stack. So let's just pass the struct directly.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
In GLES, these need a precision specifier, otherwise we get
compile errors.
This fixes a shader-compile error on OpenGL ES 3.1.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
glTexBuffer doesn't accept GL_RGBA8_SNORM, so use GL_RGBA8UI
instead. Unfortunately, we can't use our texture table since
Gallium requests PIPE_FORMAT_R8_UNORM for texture buffers. For
normal sampler views, the correct semantics are passed down later,
but for images (where texture and image formats can differ) this
is not case.
Fixes:
dEQP-GLES31.functional.image_load_store.buffer.format_reinterpret.rgba8ui_rgba8_snorm
dEQP-GLES31.functional.image_load_store.buffer.format_reinterpret.r32ui_rgba8_snorm
dEQP-GLES31.functional.image_load_store.buffer.format_reinterpret.rgba8i_rgba8_snorm
dEQP-GLES31.functional.image_load_store.buffer.format_reinterpret.rgba8_rgba8_snorm
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
We can emit them during the second pass. Since a load
or store can come before an atomic max or min, we have to
type the memory before we emit instructions.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Add a check for nonterminated string passed into the create_shader
code.
No point checking len <= 0, since it's a uint32_t.
Signed-off-by: Dave Airlie <airlied@redhat.com>
vrend_shader.c:4400: Warning: Comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < ctx->cfg->max_draw_buffers; i++) {
^
vrend_shader.c:4728:28: Warning: Unused variable »i« [-Wunused-variable]
int start, count, i;
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Only decorate function as noreturn when DEBUG is not defined, because
when compiled in DEBUG mode the function actually executes an int3 and
may return, fixes:
u_debug.c: In function '_debug_assert_fail':
u_debug.c:309:1: warning: 'noreturn' function does return
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
tgsi_scan.c:37:0:
tgsi_scan.c: In function 'tgsi_scan_shader':
tgsi_scan.c:212:46: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
assert(src->Register.Index < Elements(info->is_msaa_sampler));
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Change the type of util_cpu_caps::nr_cpus to int because sysconfig
returns a signed value, fixes:
u_cpu_detect.c: In function 'util_cpu_detect':
u_cpu_detect.c:317:30: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (util_cpu_caps.nr_cpus == -1)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
u_debug_describe.c: In function 'debug_describe_reference':
u_debug_describe.c:33:65: warning: unused parameter 'ptr' [-Wunused-
parameter]
debug_describe_reference(char* buf, const struct pipe_reference*ptr)
u_format.c: In function 'util_format_is_float':
u_format.c:57:10: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (i == -1) {
v2: Replace VREND_UNUSED by UNUSED (Erik)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
tgsi_ureg.c: In function 'ureg_DECL_sampler':
tgsi_ureg.c:601:34: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ureg->sampler[i].Index == nr)
^~
tgsi_ureg.c: In function 'validate':
tgsi_ureg.c:908:32: warning: unused parameter 'opcode' [-Wunused-
parameter]
static void validate( unsigned opcode,
^~~~~~
tgsi_ureg.c:909:32: warning: unused parameter 'nr_dst' [-Wunused-
parameter]
unsigned nr_dst,
^~~~~~
tgsi_ureg.c:910:32: warning: unused parameter 'nr_src' [-Wunused-
parameter]
unsigned nr_src )
^~~~~~
tgsi_ureg.c: In function 'emit_decls':
tgsi_ureg.c:1335:31: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ureg->properties[i] != ~0)
^~
tgsi_ureg.c: In function 'ureg_create':
tgsi_ureg.c:1594:18: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
for (i = 0; i < ARRAY_SIZE(ureg->properties); i++)
^
v2: Replace VREND_UNUSED by UNUSED (Erik)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
tgsi_ureg.c: In function 'ureg_DECL_sampler':
tgsi_ureg.c:601:34: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ureg->sampler[i].Index == nr)
^~
tgsi_ureg.c: In function 'validate':
tgsi/tgsi_ureg.c:908:32: warning: unused parameter 'opcode' [-Wunused-
parameter]
static void validate( unsigned opcode,
^~~~~~
tgsi_ureg.c:909:32: warning: unused parameter 'nr_dst' [-Wunused-
parameter]
unsigned nr_dst,
^~~~~~
tgsi_ureg.c:910:32: warning: unused parameter 'nr_src' [-Wunused-
parameter]
unsigned nr_src )
^~~~~~
tgsi_ureg.c: In function 'emit_decls':
tgsi_ureg.c:1335:31: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ureg->properties[i] != ~0)
^~
tgsi_ureg.c: In function 'ureg_create':
tgsi_ureg.c:1594:18: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
for (i = 0; i < ARRAY_SIZE(ureg->properties); i++)
^
CC tgsi/tgsi_util.lo
tgsi_util.c: In function 'tgsi_util_get_full_src_register_sign_mode':
tgsi_util.c:109:13: warning: unused parameter 'component' [-Wunused-
parameter]
unsigned component )
^~~~~~~~~
v2: Eliminate use of VREND_UNUSED (Erik)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
_surface.c: In function 'util_copy_rect':
u_surface.c:101:37: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (width == dst_stride && width == src_stride)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
In function 'parse_identifier':
tgsi_text.c:190:16: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (i == len - 1)
^~
tgsi_text.c: In function 'parse_optional_swizzle':
tgsi_text.c:816:21: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
for (i = 0; i < components; i++) {
^
tgsi_text.c: In function 'parse_instruction':
tgsi_text.c:1025:18: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
for (i = 0; i < info->num_dst + info->num_src + info->is_tex; i++) {
^
tgsi_text.c:1040:18: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
else if (i < info->num_dst + info->num_src) {
^
tgsi_text.c: In function 'parse_immediate':
tgsi/tgsi_text.c:1525:24: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
for (type = 0; type < Elements(tgsi_immediate_type_names); ++type) {
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
tgsi_sanity.c: In function 'iter_instruction':
tgsi_sanity.c:316:29: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ctx->index_of_END != ~0) {
^~
tgsi_sanity.c: In function 'epilog':
tgsi_sanity.c:488:26: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ctx->index_of_END == ~0) {
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
tgsi_parse.c: In function 'tgsi_parse_free':
tgsi_parse.c:54:31: warning: unused parameter 'ctx' [-Wunused-parameter]
struct tgsi_parse_context *ctx )
^~~
tgsi_parse.c: In function 'tgsi_parse_end_of_tokens':
tgsi_parse.c:62:25: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
return ctx->Position >=
v2: Replace VREND_UNUSED by UNUSED (Erik)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
tgsi_dump.c: In function 'iter_property':
tgsi_dump.c:443:18: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
for (i = 0; i < prop->Property.NrTokens - 1; ++i) {
^
tgsi_dump.c:459:13: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (i < prop->Property.NrTokens - 2)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
/tgsi_build.c: In function 'tgsi_build_full_immediate':
tgsi_build.c:599:18: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
for( i = 0; i < full_imm->Immediate.NrTokens - 1; i++ ) {
^
tgsi_build.c: In function 'tgsi_build_instruction_label':
tgsi_build.c:689:24: warning: unused parameter 'prev_token' [-Wunused-
parameter]
struct tgsi_token *prev_token,
^~~~~~~~~~
tgsi_build.c: In function 'tgsi_build_instruction_texture':
tgsi_build.c:720:23: warning: unused parameter 'prev_token' [-Wunused-
parameter]
struct tgsi_token *prev_token,
^~~~~~~~~~
tgsi_build.c: In function 'tgsi_build_texture_offset':
tgsi_build.c:755:23: warning: unused parameter 'prev_token' [-Wunused-
parameter]
struct tgsi_token *prev_token,
^~~~~~~~~~
tgsi_build.c: In function 'tgsi_build_full_property':
tgsi_build.c:1307:18: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
for( i = 0; i < full_prop->Property.NrTokens - 1; i++ ) {
v2: remove the unused prev_token (in sync with mesa)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Gallium copy_image redirects calls to resource_copy_region for equal src
and dst formats or if at least one of the two is compressed. Handle the
condition for selecting blit vs. glCopyImageSubRegion accordingly.
Fixes piglit: bptc-float-modes
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
When emitting an image array, the code errorously used the loop
counter instead of the image entry for looking up the resource.
The rest of the code uses idx, which seems like the right thing
to do. So let's match that instead.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This adds the texture barrier support for the texture barriers,
a separate patch would be needed to implement the framebuffer fetch
barriers.
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Add the combinations that include compressed format to the check to use
glCopyImageSubData. This fixes a number tests of "arb_copy_image-formats"
were compressed textures are the source and uncompressed textures the
destination (no regressions).
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Based on the website, glTexStorage2DMultisample requires at least
opengles >= 31 and opengl >= 43 or the extension.
Adding the check here.
v2: rebased using the features.
Signed-off-by: Dave Airlie <airlied@redhat.com>
This is needed to make tests/test_virgl_cmd pass
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
The extension is also provied by GL 4.0 and GLES 3.1.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
glTexStorage*D is more restrictive in supporting texture formats, especially
on GLES. Specifically, it doesn't support BGRA textures that are needed to get
any useful display, but it is needed to get immutable textures that are required
for glTextureView.
Check which formats are supported and use glTexStorage*D for these, otherwise
fall back to use glTexImage*D.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This fix all dEQP-GLES31.functional.shaders.builtin_functions.* tests on GLES
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
On GLES low MSAA textures with low sample counts like 1 and 2 are not
supported as render targets, therefore, copy the sample positions from the
lowest number of samples.
Remove the debug output too.
Fixes on GLES host:
dEQP-GLES31.functional.texture.multisample.samples_1.sample_position
dEQP-GLES31.functional.texture.multisample.samples_2.sample_position
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This was bogus from the beginning.
Fixes: c0e0274e8c
virgl: Add method to query supported MSAA samples and positions
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This warning was encountered:
vrend_shader.c:4257:57: warning: ‘i’ may be used uninitialized in this function [-Wmaybe-uninitialized]
(ctx->key->coord_replace & (1 << ctx->inputs[i].sid))) {
Fix this.
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
In certain cases, specifying level and layer for TBOs causes
tests to fail. Don't do this.
Fixes:
dEQP-GLES31.functional.image_load_store.buffer.image_size.writeonly_12
dEQP-GLES31.functional.image_load_store.buffer.image_size.writeonly_1
dEQP-GLES31.functional.image_load_store.buffer.image_size.readonly_writeonly_12
dEQP-GLES31.functional.image_load_store.buffer.image_size.readonly_writeonly_1
dEQP-GLES31.functional.image_load_store.buffer.image_size.readonly_12
dEQP-GLES31.functional.image_load_store.buffer.image_size.readonly_1
Signed-off-by: Dave Airlie <airlied@redhat.com>
Move all v2 caps into the caps_v2 function that also gets renamed.
Protect the GL only value queries by using the according gl_ver test.
(Part two of cleanup suggested by Gurchetan)
v4: rebase after image support and compute shader patches landed
v5: use basic check for GL for GL_SMOOTH_*_SIZE_RANGE (Erik)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v3)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Also rename the function caps_common to indicated that only v1 caps are
set here.
(This is part one of the cleanup suggested by Gurchetan)
v4: rebase after image and compute shader patches landed
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v3)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Also move the function code up in the file to let the code reflect the
call logic.
v4: rebase after image and computer shader patches landed
v5: take changes in previous patch into account
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v3)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Since the gles code path is now reduced to just setting the gles
version, move all the glsl stuff into one place.
v3: remove now unused parameter gl_ver
v4: rebase after image and compute shader patches landed
v5: rework logic a bit taking Eriks suggestion into account
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v3)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>