Currently we use a mix of "", {} and {0}. Use a single approach across
the board.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
With vtest this swizzling is necessary, but with qemu it is not, so make
it a tweak.
v2: Use original blit format to check the format type in blitter
v3: Correct typo (Gurchetan)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Function handles a single instance - drop the S from the name.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
The top level emit_ios() already zeros it, so we can remove the
duplicate (and misleading) one in emit_ios_vs().
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Use the helper instead of open-coding it.
v2: use callback (Gert)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Use the helper instead of open-coding it.
v2: use callback (Gert)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Factor out the 'generic' output handling out of emit_ios_geom() into a
helper. We'll use that across the board with later commits.
v2: use callback (Gert)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Move the GS stream output handling in a separate loop.
Will allow us to de-duplicate the generic output handling across the
board.
v2: Drop prog_type check (Gert)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Bundle all the front/back color handling to a single block. It makes
the code slightly easier to follow.
Plus it will allow us to factor out some code with a later commit.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
v2: keep prefix/auxprefix declarations on separate lines (Gert)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
v2: use "" to initialize the fixed size char array (Gert)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Introduce a SHADER_REQ_SAMPLER_BUF bit and use it with shader_req_bits.
v2: use bitwise or for the SHADER_REQ_* fields, use next bit in the list
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v1)
We do that across the board, plus it makes the code slightly more
comprehensible.
v2: update the is_shad hunk as well.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v1)
The function emit_sampler_decl() considers that GLES does not have 1D
textures, but it ignores the fact that we can have a range passed into
the function.
This workaround predates the correct fix in vrend_shader_samplertypeconv()
which returns a "2D" literal as needed.
Drop this partial workaround.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Analogous to previous commit there's a single user that cares about it.
Let that one use amplertype_is_shadow() and drop the function argument.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Only a single user cared about the is_shadow information.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
GL 4.2 supports depth layouts that make it possible to optimize by
enabling early depth tests and still being able to write a new
z value in the fragment shader under specific circumstances.
Fixes#106
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
We're overall pretty consistent, with a couple of exceptions addressed
in this patch.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Results in overall less code, making it easier to read.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Use the symbolic macros instead of the actual value.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Just like all the other non-static vrend_shader functions.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
For instance the GALLIUM_HUD requires this, also when the host doesn't
advertise support for input arrays.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This buffer is 128 bytes big, not 64. This eliminates a warning on my
system.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
"dsts" already means "array of strings", so it's reasonable that "dst"
would mean "string", not "struct tgsi_full_dst_register". Let's rename
this, so we can stop pointlessly passing an array into this function and
still keep somewhat sane names for things.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
I want to use this name for something a bit more important later on. So
let's rename this to reflect it's special meaning instead. While we're
at it, narrow the scope of the variable a bit.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
We're about to do string-formatting anyway, we might just inline this
into the next one to avoid some needless memory copying.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
This avoids a lot of fixed-size arrays, which currently leads to
warnings that are hard to prove correct or incorrect. So let's rather be
safe than sorry, and dynamically allocate these instead.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
There's no good reason to keep this code here; it's not like it saves us
a lot of logic, and it's unused apart from inside the glsl main.
This has the benefit of keeping struf a bit simpler; less mechanisms
needs to know about each other. Since I plan on adding more
functionality to strbuf, this will make things a lot easier.
Sadly, we don't have an easy way of doing unit-tests for the
vrend_shader internals. So for now I'm just dropping the tests here.
It's not ideal, I know, but yeah... Sorry? :P
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
This patch uses GL_EXT_framebuffer_fetch_non_coherent (preferred)
or GL_EXT_framebuffer_fetch to emulate the logiops in the fragement
shader. If neither of these extension are available then only
GL_COPY, GL_COPY_INVERTED, GL_CLEAR, and GL_SET are emulated.
Fixes piglit gl-1.0-logicop on GLES hosts.
v2: Use non_coherent access when possible
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Pass a mask of the non-array generic inputs that the next shader expects
is passed to the shader that is currently converted. If, after emitting
all generic outputs, some are missing, then these are also generated.
Limitations: This doesn't take care of input arrays that may not be emitted
as outputs, but since this problem seems to be only related to IO variables
that are implicitely declared this is not a problem.
Fixes piglit: glsl-routing
v2: rebase and update names to new naming
v3: Declare TCS outputs as arrays as required
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Tested-by: Elie Tournier <elie.tournier@collabora.com> (v1)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Fixes: 368d950e8f
shader: emulate indirect ssbo write access on GLES using a switch statement
Thanks Erik for catching this.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
This buffer was introduced, but never used. Fixes a warning.
While we're at it, fixup the lack of EOL at EOF.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Fixes: 75f2191 ("shader: Don't emit gl_FragCoord layout qualifier on
GLES and emulate pixel_center_integer")
Reviewed-By: <gert.wollny@collabora.com>
On D-GL a program may contain a TE shader but no TC shader. On GLES either
both or none of TES and TCS need to be available. So if the guest sends a
shader program without a TCS, inject a passthrough shader using the
patch parameters given in the GL code.
Closes#84
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
These functions will later also be used to create a TC passthrough shader
on GLES of a GL guest doesn't send one.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
With the exception of VS inputs and FS outputs the use of components
and location layout qualifiers also requires the extension
ARB_separate_shader_objects on GL (or GLSL 4.10).
Fixes: 08b3ddded8
vrend: Signal the guest that indirect arrays are available
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
v2: Make use of the helper function introduced before (Gurchetan)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Fixes piglit on GLES host:
arb_shader_storage_buffer_object@execution@indirect
v2: use helper function to emit code (Gurchetan)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Resolve the indirect access by using a switch statement instead of the
indirect addressing.
Fixes: arb_arrays_of_arrays/execution/image_store/
basic-imageStore-*-const-uniform-index
Signed-off-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
With the new optimizations applied to the i965 driver it becomes
a requirement to specify buffers as coherent if the access is declared
as such. This fixes a regression with
dEQP-GLES31.functional.synchronization.in_invocation.ssbo_alias_overwrite
Closes#93
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>