2022-11-24 05:25:35 +00:00
|
|
|
cbuffer cbuffer_data : register(b0, space0) {
|
|
|
|
uint4 data[2];
|
|
|
|
};
|
2022-08-03 08:45:25 +00:00
|
|
|
|
2023-02-24 17:16:55 +00:00
|
|
|
matrix<float16_t, 3, 2> data_load(uint offset) {
|
2022-11-24 05:25:35 +00:00
|
|
|
const uint scalar_offset = ((offset + 0u)) / 4;
|
2023-02-24 17:16:55 +00:00
|
|
|
uint ubo_load = data[scalar_offset / 4][scalar_offset % 4];
|
2022-11-24 05:25:35 +00:00
|
|
|
const uint scalar_offset_1 = ((offset + 4u)) / 4;
|
2023-02-24 17:16:55 +00:00
|
|
|
uint ubo_load_1 = data[scalar_offset_1 / 4][scalar_offset_1 % 4];
|
2022-11-24 05:25:35 +00:00
|
|
|
const uint scalar_offset_2 = ((offset + 8u)) / 4;
|
2023-02-24 17:16:55 +00:00
|
|
|
uint ubo_load_2 = data[scalar_offset_2 / 4][scalar_offset_2 % 4];
|
2022-11-24 05:25:35 +00:00
|
|
|
return matrix<float16_t, 3, 2>(vector<float16_t, 2>(float16_t(f16tof32(ubo_load & 0xFFFF)), float16_t(f16tof32(ubo_load >> 16))), vector<float16_t, 2>(float16_t(f16tof32(ubo_load_1 & 0xFFFF)), float16_t(f16tof32(ubo_load_1 >> 16))), vector<float16_t, 2>(float16_t(f16tof32(ubo_load_2 & 0xFFFF)), float16_t(f16tof32(ubo_load_2 >> 16))));
|
|
|
|
}
|
2022-08-03 08:45:25 +00:00
|
|
|
|
2022-11-24 05:25:35 +00:00
|
|
|
void main() {
|
|
|
|
uint2 ubo_load_3 = data[1].xy;
|
|
|
|
vector<float16_t, 2> ubo_load_3_xz = vector<float16_t, 2>(f16tof32(ubo_load_3 & 0xFFFF));
|
|
|
|
float16_t ubo_load_3_y = f16tof32(ubo_load_3[0] >> 16);
|
2023-02-24 17:16:55 +00:00
|
|
|
const vector<float16_t, 2> x = mul(vector<float16_t, 3>(ubo_load_3_xz[0], ubo_load_3_y, ubo_load_3_xz[1]), data_load(0u));
|
2022-11-24 05:25:35 +00:00
|
|
|
return;
|
|
|
|
}
|