Commit Graph

177072 Commits

Author SHA1 Message Date
Alyssa Rosenzweig
bb663b8595 asahi: Dirty the shader stage when the shader changes
We need to re-emit all descriptors in this case for correctness. Avoids
regressions from the following commit.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
581514d925 asahi: Dirty track VBOs + blend const separately
We're staging everything anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
24238cc507 asahi: Use proper dirty tracking for VBOs
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
0a5ca3f34f asahi: Use finer dirty tracking for blend constant
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
d6ca887f90 asahi: Decouple sysval lowering from uniform assignment
For merging shader states, we'll need to lower sysvals separately for each
shader but assign uniforms together for the final merged shader. The easiest way
to do that is to decouple the lowering of sysvals to driver uniform reads, from
the assignment of driver uniform reads to actual uniform registers.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
17563210d4 asahi: Put unuploaded uniforms on the batch
Less copying needed this way.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
871d97f7d0 asahi: Extract sampler upload
Dirty track it.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
9fa5dec767 asahi: Add real per-stage dirty flags
Instead of just using ~0 as a stub todo.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
9a60478966 asahi: Upload a single draw_uniforms per draw
Not per stage per draw. This is less frequent.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
4717b08f78 asahi: Extract agx_upload_textures
By uploading textures ahead-of-time, we can upload uniforms ahead-of-time too.
This will also allow some overhead shaving optimizations, I guess.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
0e6cb6d893 asahi: Collapse grid_info
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
b049b1c98f asahi: Split out per-stage sysvals
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
31afce2fa5 asahi: Add sysval tables for each shader stage
So we can model the descriptors of each shader stage independently, as required
for merged shaders.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
5189bae50c asahi: Move UBO lowering into GL driver
In Vulkan, UBOs are lowered by nir_lower_explicit_io, and the ubo_base_agx
sysval is unused (since it doesn't handle descriptor sets). That makes the UBO
lowering GL-only and hence belongs with the GL driver rather than the compiler.
This lets us delete the ubo_base_agx sysval.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
1d77fb967d nir,asahi: Remove texture_base_agx
Doing a descriptor crawl with binding tables requires a real binding table in
the shader, which won't work for VK or merged shader stages in GL. Instead,
let's lower anything that needs a crawl to bindless in the driver, so the
compiler code doesn't need to know anything about descriptor binding models.
That gets rid of the texture_base_agx sysval, which is problematic when there
are multiple descriptor sets worth of textures.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
cd25f753d5 agx: Add helper returning if a descriptor crawl is needed
For agx_nir_lower_texture to lower to a descriptor crawl, the driver needs to
make sure the address of the descriptor is available. This means a slightly
different code path should be used in the driver. Rather than the drivers
needing to know what exactly will be lowered, add a helper in the same file as
agx_nir_lower_texture that returns whether descriptor-based lowering will be
needed so the driver can act appropriately.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
1e11862753 agx: Do some texture lowering early
We want to make the implicit txs in operations explicit before lower_bindings so
lower_bindings knows to force bindless.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
6e1bdc1291 asahi: Add missing LOD source for agx_meta's txfs
These would be inserted by nir_lower_tex anyway, but we shouldn't be relying on
that behaviour for the meta shaders when we can just create the correct thing
from the start.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
176484d7f0 agx: Do not fence write-only images
Reduces fencing significantly.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
d49ed63d07 agx/fence_images: Use intrinsics_pass
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
d42bb650b3 asahi: Add get_query_address helper
This is the counterpart of get_oq_index for non-occlusion hardware queries.
These are not tracked with occlusion queries, since occlusion query allocations
are limited, and they are not based on indexing but rather general
batch-allocated space.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
a620e86f35 asahi: Add non-occlusion query tracking
For other GPU queries, handled similarly.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
9845814c98 asahi: Sync when beginning a query
Otherwise batch->writer might be non-null. Fixes Piglit occlusion_query_conform
(which I think regressed when we added proper syncing).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
a13f233219 asahi: Only touch batch->occlusion_queries for occlusion
We will soon have other types of queries with non-null writers.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
dfde9345d7 asahi: Refactor agx_get_query_result
In preparation for other types of GPU queries.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
e5dd053640 asahi: Simplify occlusion query batch tracking
Yes, this means we now lie to the app. There's nothing more in the spirit of
dumb OpenGL features than lying!

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
e72facab9a asahi: Generalize query logic
We will need to do the same flushing dance for non-occlusion GPU queries.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
542a317a12 agx: Use 16-bit reg for pixel_coord
Mistake during IR translation, this is 16-bit in NIR.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
58efa64c5c asahi: Preserve atomic ops when rewriting image to bindless
Bug fix on its own, and prevents regressions from using bindless more.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
8ae3eebba4 agx: Clear image_array after lowering
We lower to access to a non-array 2D image, so we need to update the image_array
flag when we lower or otherwise we get an incorrect 2D Array store to a 2D image
which the hardware doesn't want.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
c8ea02a883 agx: Clear sample count after lowering MSAA
Pedantic.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
a51c3f638b asahi: Pass layer stride in pixels, not elements
We do all the math in pixels and only multiply by the sample count at the end,
meaning the layer stride needs to be in terms of pixels (not samples) for
correct addressing of multisample array images in our texture lowering. This is
particularly used for lowering the multisample array stores we get from eMRT
with multisampled layered framebuffers.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
486fb75981 asahi: Use local_size from compiler directly
This avoids an unnecessary trip through agx_uncompiled_shader.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
6247e617c1 asahi: Report local_size from compiler
So we can add more shared in the compiler.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
5b3f4cf6f8 asahi/decode: Turn assert into error
To allow us to debug broken fetches.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
6aa1cf6e7a asahi: Advertise OpenGL ES 3.1!
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
c8b44eb4c3 agx: Implement imul_high
Like umul_high. Fixes
dEQP-VK.spirv_assembly.instruction.compute.mul_extended.signed_16bit

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
cf12429c97 agx: Convert 8-bit comparisons
Fixes dEQP-VK.spirv_assembly.type.vec3.i8.slessthan_frag

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
72231b042c agx: Handle b2i8
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
7590b2b39d agx: Allow loop headers without later preds
These happen for loops that break after exactly 1 iteration, unconditionally.
Fixes validation splat in dEQP-VK.glsl.switch.conditional_fall_through_2_uniform_vertex

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:54 +00:00
Alyssa Rosenzweig
4dcfb681bc agx/lower_vbo: Handle nonzero component
Fixes dEQP-VK.glsl.440.linkage.varying.component.vert_in.vec2.as_float_float

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:54 +00:00
Mary
0ec2183dfc agx: Ensure to lower 1D image load/store to 2D
This was missing from lower_images.
This fix a good chunk of Vulkan deQP failures with 1D images.

Signed-off-by: Mary <mary@mary.zone>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:54 +00:00
Alyssa Rosenzweig
8701ad4396 agx: Don't blow up when lowering textures twice
Hard to avoid with GS.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:54 +00:00
Alyssa Rosenzweig
7f636a08c8 asahi: Keep drawoverhead from OOMing itself
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:54 +00:00
Alyssa Rosenzweig
c363fcbe1e agx: Assert vertex_id, instance_id are VS-only
We can get them in other shaders transiently due to merging shader stages, but
they need to be lowered since the hardware versions only exist in the hardware
VS. So the compiler should never see them outside VS.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:54 +00:00
Alyssa Rosenzweig
4c36f9052b asahi: Copy CSO stride
Fixes: 7672545223 ("gallium: move vertex stride to CSO")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:54 +00:00
Alyssa Rosenzweig
240ee9564b agx: Use more barriers
Fixes flakiness in
KHR-GLES31.core.texture_buffer.texture_buffer_atomic_functions.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:54 +00:00
Alyssa Rosenzweig
f068ed0534 agx: Fix extraneous bits with b2b32
From expanding mov_imm to take a 64-bit immediate. this worked by accident
before. Fixes brief regression in
dEQP-GLES31.functional.compute.shared_var.basic_type.bvec3.

Fixes: dbd98aa24d1 ("agx: Fix 64-bit immediate moves")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:54 +00:00
Alyssa Rosenzweig
ec2ab7d771 nir: Add load_sysval_agx intrinsic
For merging shader stages, it will be useful to express a load from an explicit
GL "descriptor set", so we can represent things like UBO loads with merged
shaders where UBOs can come from either stage. To do so, we add an intrinsic
representing a load from the driver's uniform tables, indexed like "descriptor
sets" with "bindings".

In principle, a layered GL-on-Vulkan implementation would use literal descriptor
sets for each stage, so I feel comfortable with the analogy here.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
2023-08-23 15:06:54 +00:00
Chris Spencer
bda4eb18dd anv: Advertise Vulkan 1.3 on Android 13
Older versions of Android rejected newer versions of Vulkan,[1] but Android
13 devices are 'strongly recommended' to support Vulkan 1.3.[2]

[1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4781
[2] https://source.android.com/docs/compatibility/13/android-13-cdd#7142_vulkan

Signed-off-by: Chris Spencer <spencercw@gmail.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24816>
2023-08-23 14:31:26 +00:00