| 1 |
/* |
| 2 |
* Copyright © 2022 Imagination Technologies Ltd. |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 |
* of this software and associated documentation files (the "Software"), to deal |
| 6 |
* in the Software without restriction, including without limitation the rights |
| 7 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 8 |
* copies of the Software, and to permit persons to whom the Software is |
| 9 |
* furnished to do so, subject to the following conditions: |
| 10 |
* |
| 11 |
* The above copyright notice and this permission notice (including the next |
| 12 |
* paragraph) shall be included in all copies or substantial portions of the |
| 13 |
* Software. |
| 14 |
* |
| 15 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 |
* SOFTWARE. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef PVR_DRAW_INDIRECTELEMENTS1_H |
| 25 |
#define PVR_DRAW_INDIRECTELEMENTS1_H |
| 26 |
|
| 27 |
/* Initially generated from ARB_draw_indirect_elements.pds */ |
| 28 |
|
| 29 |
static const uint32_t pvr_draw_indirect_elements1_code[21] = { |
| 30 |
0xd0000000, /* LD const[0].64: dst(?) <= mem(?) */ |
| 31 |
0xd1000000, /* WDF */ |
| 32 |
0x9000a120, /* ADD32 ptemp[0].32 = const[2].32 + temp[4].32 */ |
| 33 |
0x04181823, /* MAD temp[6].64 = (temp[3].32 * const[3].32) + |
| 34 |
const[4].64 */ |
| 35 |
0x53383008, /* SFTLP32 temp[8].32 = (temp[7].32 | const[6].32) << 0 |
| 36 |
*/ |
| 37 |
0x50343009, /* SFTLP32 temp[9].32 = temp[6].32 << 0 */ |
| 38 |
0x04103843, /* MAD temp[6].64 = (temp[2].32 * const[7].32) + |
| 39 |
const[8].64 */ |
| 40 |
0x50343002, /* SFTLP32 temp[2].32 = temp[6].32 << 0 */ |
| 41 |
0x500c080a, /* SFTLP32 temp[10].32 = temp[1].32 << 0 */ |
| 42 |
0x9120828b, /* ADD32 temp[11].32 = temp[2].32 - const[10].32 */ |
| 43 |
0x5024200c, /* SFTLP32 temp[12].32 = temp[4].32 << 0 */ |
| 44 |
0xc8000001, /* BRA if keep 1 ( setc = p0 ) */ |
| 45 |
0xd19c0000, /* LIMM temp[7].32 = 0000 */ |
| 46 |
0x50141006, /* SFTLP32 temp[6].32 = temp[2].32 << 0 */ |
| 47 |
0xb18c0000, /* CMP P0 = (temp[6].64 = 0000) */ |
| 48 |
0xd9a80000, /* LIMM ? temp[10].32 = 0000 */ |
| 49 |
0xd9ac0000, /* LIMM ? temp[11].32 = 0000 */ |
| 50 |
0xd0800006, /* ST const[12].64: mem(?) <= src(?) */ |
| 51 |
0xd0000007, /* LD const[14].64: dst(?) <= mem(?) */ |
| 52 |
0xd1000000, /* WDF */ |
| 53 |
0xf4024003, /* DOUT doutv = temp[0].64, const[2].32; HALT */ |
| 54 |
}; |
| 55 |
|
| 56 |
static const struct pvr_psc_program_output pvr_draw_indirect_elements1_program = { |
| 57 |
pvr_draw_indirect_elements1_code, /* code segment */ |
| 58 |
0, /* constant mappings, zeroed since we use the macros below */ |
| 59 |
7, /* number of constant mappings */ |
| 60 |
|
| 61 |
16, /* size of data segment, in dwords, aligned to 4 */ |
| 62 |
24, /* size of code segment, in dwords, aligned to 4 */ |
| 63 |
20, /* size of temp segment, in dwords, aligned to 4 */ |
| 64 |
16, /* size of data segment, in dwords */ |
| 65 |
21, /* size of code segment, in dwords */ |
| 66 |
20, /* size of temp segment, in dwords */ |
| 67 |
NULL /* function pointer to write data segment */ |
| 68 |
}; |
| 69 |
|
| 70 |
#define pvr_write_draw_indirect_elements1_di_data(buffer, addr, device) \ |
| 71 |
do { \ |
| 72 |
uint64_t data = ((addr) | (0x60000000000ULL) | \ |
| 73 |
ENABLE_SLC_MCU_CACHE_CONTROLS(device)); \ |
| 74 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0); \ |
| 75 |
memcpy(buffer + 0, &data, sizeof(data)); \ |
| 76 |
} while (0) |
| 77 |
#define pvr_write_draw_indirect_elements1_write_vdm(buffer, addr) \ |
| 78 |
do { \ |
| 79 |
uint64_t data = ((addr) | (0x2050000000000ULL)); \ |
| 80 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0); \ |
| 81 |
memcpy(buffer + 12, &data, sizeof(data)); \ |
| 82 |
} while (0) |
| 83 |
#define pvr_write_draw_indirect_elements1_flush_vdm(buffer, addr) \ |
| 84 |
do { \ |
| 85 |
uint64_t data = ((addr) | (0x3960000000000ULL)); \ |
| 86 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0); \ |
| 87 |
memcpy(buffer + 14, &data, sizeof(data)); \ |
| 88 |
} while (0) |
| 89 |
#define pvr_write_draw_indirect_elements1_idx_stride(buffer, value) \ |
| 90 |
do { \ |
| 91 |
uint32_t data = value; \ |
| 92 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0); \ |
| 93 |
memcpy(buffer + 3, &data, sizeof(data)); \ |
| 94 |
} while (0) |
| 95 |
#define pvr_write_draw_indirect_elements1_idx_base(buffer, value) \ |
| 96 |
do { \ |
| 97 |
uint64_t data = value; \ |
| 98 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0); \ |
| 99 |
memcpy(buffer + 4, &data, sizeof(data)); \ |
| 100 |
} while (0) |
| 101 |
#define pvr_write_draw_indirect_elements1_idx_header(buffer, value) \ |
| 102 |
do { \ |
| 103 |
uint32_t data = value; \ |
| 104 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0); \ |
| 105 |
memcpy(buffer + 6, &data, sizeof(data)); \ |
| 106 |
} while (0) |
| 107 |
#define pvr_write_draw_indirect_elements1_num_views(buffer, value) \ |
| 108 |
do { \ |
| 109 |
uint32_t data = value; \ |
| 110 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0); \ |
| 111 |
memcpy(buffer + 7, &data, sizeof(data)); \ |
| 112 |
} while (0) |
| 113 |
#define pvr_write_draw_indirect_elements1_immediates(buffer) \ |
| 114 |
do { \ |
| 115 |
{ \ |
| 116 |
uint32_t data = 0x0; \ |
| 117 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0); \ |
| 118 |
memcpy(buffer + 2, &data, sizeof(data)); \ |
| 119 |
} \ |
| 120 |
{ \ |
| 121 |
uint64_t data = 0x0; \ |
| 122 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0); \ |
| 123 |
memcpy(buffer + 8, &data, sizeof(data)); \ |
| 124 |
} \ |
| 125 |
{ \ |
| 126 |
uint32_t data = 0x1; \ |
| 127 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0); \ |
| 128 |
memcpy(buffer + 10, &data, sizeof(data)); \ |
| 129 |
} \ |
| 130 |
} while (0) |
| 131 |
#endif |