asahi: move sample mask to r1l

r0h is used for subgroup shuffles already.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31532>
This commit is contained in:
Alyssa Rosenzweig 2024-09-25 14:10:46 -04:00 committed by Marge Bot
parent 702c038b91
commit 7faca2220c
3 changed files with 16 additions and 10 deletions

View file

@ -56,7 +56,7 @@ When sample shading is enabled in a non-monolithic fragment shader, the fragment
shader has the following register inputs:
* `r0l = 0`. This is the hardware nesting counter.
* `r0h` is the mask of samples currently being shaded. This usually equals to
* `r1l` is the mask of samples currently being shaded. This usually equals to
`1 << sample ID`, for "true" per-sample shading.
When sample shading is disabled, no register inputs are defined. The fragment
@ -66,7 +66,7 @@ Registers have the following layout at the end of the fragment shader (read by
the fragment epilog):
* `r0l = 0` if sample shading is enabled. This is implicitly true.
* `r0h` preserved if sample shading is enabled.
* `r1l` preserved if sample shading is enabled.
* `r2` and `r3l` contain the emitted depth/stencil respectively, if
depth and/or stencil are written by the fragment shader. Depth/stencil writes
must be deferred to the epilog for correctness when the epilog can discard

View file

@ -12,9 +12,9 @@
#define AGX_ABI_VIN_VERTEX_ID (2 * 5)
#define AGX_ABI_VIN_INSTANCE_ID (2 * 6)
#define AGX_ABI_FIN_SAMPLE_MASK (1)
#define AGX_ABI_FIN_SAMPLE_MASK (2)
#define AGX_ABI_FOUT_SAMPLE_MASK (1)
#define AGX_ABI_FOUT_SAMPLE_MASK (2)
#define AGX_ABI_FOUT_Z (4)
#define AGX_ABI_FOUT_S (6)
#define AGX_ABI_FOUT_WRITE_SAMPLES (7)

View file

@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
#include "util/ralloc.h"
#include "agx_abi.h"
#include "agx_compile.h"
#include "agx_device.h"
#include "agx_pack.h"
@ -28,10 +29,15 @@
* following binary sequences form the relevant loop.
*/
static_assert(AGX_ABI_FIN_SAMPLE_MASK == 2, "r1l known");
/* clang-format off */
static const uint8_t sample_loop_header[] = {
/* mov_imm r0, 0x10000, 0b0 */
0x62, 0x01, 0x00, 0x00, 0x01, 0x00,
/* mov_imm r0l, 0x0, 0b0 */
0x62, 0x00, 0x00, 0x00,
/* mov_imm r1l, 0x0, 0b0 */
0x62, 0x04, 0x01, 0x00,
};
#define STOP \
@ -45,11 +51,11 @@ static const uint8_t sample_loop_header[] = {
static const uint8_t stop[] = {STOP};
static const uint8_t sample_loop_footer[] = {
/* iadd r0h, 0, r0h, lsl 1 */
0x0e, 0x02, 0x00, 0x10, 0x84, 0x00, 0x00, 0x00,
/* iadd r1l, 0, r1l, lsl 1 */
0x0e, 0x04, 0x00, 0x20, 0x84, 0x00, 0x00, 0x00,
/* while_icmp r0l, ult, r0h, 0, 1 */
0x52, 0x2c, 0x41, 0x00, 0x00, 0x00,
/* while_icmp r0l, ult, r1h, 0, 1 */
0x52, 0x2c, 0x42, 0x00, 0x00, 0x00,
/* jmp_exec_any */
0x00, 0xc0, 0x00, 0x00, 0x00, 0x00,