"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>
Closes: #74
v2: * Enable enhanced layouts in the guest only when the host supports
it, because with indirect arrays enabled we re-emit the layout
the guest send.
* enable indirect arrays independently from the host capabilities
(following Eriks comments)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
On GLES Mesa rejects arrays of arrays as TCS and TES shader inputs and outputs.
This is based on section 4.3 of the GLSL 3.20 ES standard where an error should be
produced for "Per-vertex-arrayed arrays of arrays" and "For non-per-vertex-arrayed
array of arrays", so apparently something like
in vec4 [][N];
is not allowed and on GLES interface blocks have to be used instead. In addition the
code needed some fixups when interface blocks are used.
v2: Emit correct type for elements in blocks
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
This is not legal. This fix help with "The Talos Principle" that triggers
emitting an invariant shader.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
This fixes most of the piglit:
arb_shader_image_load_store-qualifiers
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
With GLSL ES a format layout is requires, and with GL it doesn't hurt to
add it, so always emit rgba32f when no format is given.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
On GL WR translates to writable, but on GLES we translate this
to writeonly because for most formats one has to specify one or
the other, so if we have an image with the TGSI WR specification,
and read from it, we drop the Writable flag. For the images that
allow RW this is of no consequence, and for the others a write
access will fail instead of the read access, but this doesn't
constitue a regression because we couldn't do both - read and
write - anyway.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Softpipe doesn't support ARB_GLES3_1_compatibility but can support
NV_shader_atomic_float and this is needed for some dEQP-GLES31 tests to be
run on a softpipe GL host.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
(u|i)mulExtended are provided by ARB_gpu_shaders5 but also by
MESA_shader_integer_functions and only the latter is supported by softpipe
so fall back to this extension if needed.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This is not required and actually an error.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
Fixes 1D part of piglits of: bin/arb_shader_image_size-builtin
(The tests require glViewportIndexedfv enabled with !182)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Fixes: KHR-GL33.texture_size_promotion.functional
v2: Put bias at right position when offset is present
Fixes piglit: texelFetch offset 140 fs isampler2DRect
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Fixes piglits on GLES host:
tex-miplevel-selection * 1D*
The only piglits that are not fixed from the tex-miplevel-selection
are those including sampler1DArrayShadow. emulating these by using
sampler2DArrayShadow is not always possible, because GLSL doesn't
provide the required overloads.
Namely textureOffset, textureLod, textureLodOffset, and texture with
bias parameter are not available.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
samplers on GLES
Since the sampler is emulated by a 2D sampler the offset must also be a
2D vector and the coordinate argument must be ivec2.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Since the 1D texture arrays are emulated by using 2D texture
arrays the number of array layers is in the z component.
Fixes piglits on GLES:
textureSize * *sampler1DArray
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
These textures are emulated by 2D textures and textureSize needs the swizzle
for the result to be assignable to a float value.
Fixes piglits on GLES hosts:
textureSize * *sampler1D
textureSize * *sampler1DShadow
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This enables indexed access to viewports on GLES hosts.
v2: Also add the extension to shaders when needed
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Fixes a number of piglitson GLES hosts. e.g. :
texelFetch * sampler2DMS * *
v2: Manually shift pixel center only on GLES
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
A recent change in the mesa glsl code mesa/e551040c resulted in a
regression for
dEQP-GLES31.functional.shaders.builtin_functions.
integer.umulextended.uvec*
because the generated TGSI was staring to use only certain components of
the temporary return values. Therefore, it became visible that the
swizzle was not honored on these values.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: <Dave Airlie airlied@redhat.com>
With enhanced layouts and input arrays enabled it may happen that more then
one shader IO variable have the same sid, and since the other parts of the
glsl_name are not available at this point rewrite the patching routine to
be able to patch more than one instance of a delaration with the same
variable prefix.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
By enabling input arrays the TGSI may emit code that defines a number
of POS inputs individually, but accesses them indirectly. Rewriting them
as array makes it possible to emit proper GLSL in this case.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
Some varying outputs can be directly used for tranform feedback, so don't
emit an additional varying in these cases. This should save a move
instruction and also reduces the possibility of hitting the output varying
limit.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
Same as for outputs, since inputs might be passed interleaved we also
have to check the access mask and if the component comes with an offset
then we have to shift the swizzle.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
If a variable has component offsets we have to correct the swizzles.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
The guest might send component layouts that we don't want to deal with
when we are in the no-guest-arrays code path, so rewrite the component
layouts and then rename the variables.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>