Take this real-world (trimmed) shader:
precision highp float;
in lowp vec4 var_varVertexColor;
layout(location = 0) out vec4 out_FragColor0;
void main() {
vec4 textureColor0 = vec4(1.000000e+00, 0.000000e+00, 0.000000e+00, 1.000000e+00);
vec3 color = vec3(1.000000e+00, 1.000000e+00, 1.000000e+00);
vec4 outColor = vec4(vec3((color).rgb), 1.000000e+00);
(outColor *= vec4(var_varVertexColor));
(out_FragColor0 = outColor);
}
After opts, it's just a store from input to output. If we decide to lower
the input to 16-bit, then as long as the driver can handle 16-bit outputs,
it would be a good idea to demote the output and save the conversions.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18003>
Instead of not reporting support for the pixel format at all, just
disable swapchain creation.
Some apps want to create off-screen contexts targeting these formats,
but since WGL doesn't really have "off-screen," the pixel format
enumeration should return support for these.
Reviewed-by: Giancarlo Devich <gdevich@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18326>
Instead of this fragile use_primitive_replication bit which we set
differently depending on whether or not we pulled the shader out of the
cache, compute and use the information up-front during the compile and
then always fetch it from the vue_map after that. This way, regardless
of whether the shader comes from the cache or not, we have the same flow
and there are no inconsistencies.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17602>
Passing all the data we need in directly avoids issues where we might
forget what is and isn't set on the pipeline object at the time the
shader call happens. This will be especially important once we start
splitting things up for pipeline libraries.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17602>
Now that we're using nir_intrinsic_load_layer_id for ViewIndex, we can
use primitive replication even when the FS uses ViewIndex. Also, only
check that active_stages doesn't contain anything other than VS and FS,
not that it's exactly VS | FS. This both decouples things more and
allows primitive rplication in the depth-only case where we have no
fragment shader at all.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17602>
Now that fragment shaders are a special case handled up-front, we can
reduce the complexity of some of the logic elsewhere in the pass.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17602>
We've already allocated the pipe resource, so we ought to free it
before returning.
Fixes: d8a38edc48 ("crocus: fail resource allocation properly.")
Fixes: f3630548f1 ("crocus: initial gallium driver for Intel gfx 4-7")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>
If we can't create a staging resource, then fall back to direct CPU
mapping (possibly with a stall). This is a rare case, but it could
happen for very large staging buffers.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>
Failing to create staging resources isn't necessarily a critical error,
and we probably don't want to be printing out XXX messages. I mostly
had this here when bringing up iris and resource creation was failing
because I'd done something wrong when writing the code. Then it got
copied over to crocus.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>
Failing to create staging resources isn't necessarily a critical error,
and we probably don't want to be printing out XXX messages. I mostly
had this here when bringing up the driver and resource creation was
failing because I'd done something wrong when writing the code.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Mark Janes markjanes@swizzler.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>
Now that ac_nir_translate reports failures instead of aborting,
we need to deal with it in the driver.
For now, call abort to keep the existing behavior but this could
be improved.
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18147>
ac_nir_translate can fail now so forward the translation result to
si_llvm_compile_shader. If it's a failure, it'll print something like:
radeonsi: can't compile a main shader part
And the shader won't be used.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18147>
Return a boolean instead of aborting when the NIR->LLVM translation fails.
This way, we can deal with the error at the calling site instead of crashing
the whole application.
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18147>
It's useful to see this information now that aco is going to use it.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18297>
I am not entirely convinced that contexts can't mess up the state of other
contexts, but with this we at least turn down the amount of races on the
CPU side.
If we hit bugs later we can always look into it then and figure out what
to fix how.
I think we might need a better solution for it in the future as state
tracking might need to become more involved, but for now this should be
good enough.
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>
This doesn't add a fence list per pipe context, it simply makes us track
the current fence per context so we can safely modify the fence object
per thread.
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>
No idea why it is there. nvc0 doesn't do anything like it and it doesn't
regress any tests. Also removing is easier than handling the fence locking
inside the kick notify handler.
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>
This makes it easier to implement proper locking of the fence struct as we
can redesign some of the functions to take the list object instead of
fence objects.
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>
nouveau_fence_work already checks the state, so we can just call it
directly.
Strictly speaking, this isn't functional equivalent, but practically it
doesn't matter when we get the callback called.
Main reason for doing this is, that this makes locking way easier as we
can simply lock within nouveau_fence_* functions and callers don't have to
take locks themselves.
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>
With this helgrind doesn't report any races in this code.
Cc: mesa-stable
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>
At the moment the context uses the screens object, but in order to fix
threading without having to lock too much we will have to allocate those
objects per context later.
Cc: mesa-stable
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>
It's only used in the scope of a single function, st_UnmapTextureImage. Use
a local variable instead.
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>
We don't need to map the compressed texture's fallback resource for operations
which will only read from the texture (e.g., glGetCompressedTexImage2D and
glCopyImageSubData).
For compressed textures using a fallback, delay the map until
st_UnmapTextureImage and only do the map if it's being written to.
To help identify what's being changed, the expected indentation changes are
split out into the next patch.
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>
Use this field to determine which parts of the compressed texture fallback
resource needs updating. Drops a dependency on the
st_texture_image_transfer::transfer pointer.
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>
Split out the transfer array reallocation and insertion functionality from
st_texture_image_map.
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>