diff options
| author | ruki <[email protected]> | 2025-12-07 23:00:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-12-07 23:00:26 +0800 |
| commit | 0187b34737611b7b194761ef1a241dd4ac6eee05 (patch) | |
| tree | a5b7017281430fc19b51b58d683bc795218b1a60 /tests/projects/other/hlsl2spv_bin2obj/src | |
| parent | 4e4b28eb4cad79cc4df5fca887b4f4b709f2b211 (diff) | |
add bin2obj support for glsl/hlsl2spv
Diffstat (limited to 'tests/projects/other/hlsl2spv_bin2obj/src')
| -rw-r--r-- | tests/projects/other/hlsl2spv_bin2obj/src/main.c | 36 | ||||
| -rw-r--r-- | tests/projects/other/hlsl2spv_bin2obj/src/test.ps.hlsl | 9 | ||||
| -rw-r--r-- | tests/projects/other/hlsl2spv_bin2obj/src/test.vs.hlsl | 17 |
3 files changed, 62 insertions, 0 deletions
diff --git a/tests/projects/other/hlsl2spv_bin2obj/src/main.c b/tests/projects/other/hlsl2spv_bin2obj/src/main.c new file mode 100644 index 000000000..343e5ac2f --- /dev/null +++ b/tests/projects/other/hlsl2spv_bin2obj/src/main.c @@ -0,0 +1,36 @@ +#include <stdio.h> +#include <stdint.h> + +extern const uint8_t _binary_test_vs_spv_start[]; +extern const uint8_t _binary_test_vs_spv_end[]; + +extern const uint8_t _binary_test_ps_spv_start[]; +extern const uint8_t _binary_test_ps_spv_end[]; + +int main(int argc, char** argv) { + const uint32_t vs_size = (uint32_t)(_binary_test_vs_spv_end - _binary_test_vs_spv_start); + const uint32_t ps_size = (uint32_t)(_binary_test_ps_spv_end - _binary_test_ps_spv_start); + + printf("test.vs.spv: size: %u bytes\n", vs_size); + printf("test.ps.spv: size: %u bytes\n", ps_size); + + // Print first few bytes + if (vs_size > 0) { + printf("test.vs.spv first 4 bytes: "); + for (uint32_t i = 0; i < 4 && i < vs_size; i++) { + printf("%02x ", _binary_test_vs_spv_start[i]); + } + printf("\n"); + } + + if (ps_size > 0) { + printf("test.ps.spv first 4 bytes: "); + for (uint32_t i = 0; i < 4 && i < ps_size; i++) { + printf("%02x ", _binary_test_ps_spv_start[i]); + } + printf("\n"); + } + + return 0; +} + diff --git a/tests/projects/other/hlsl2spv_bin2obj/src/test.ps.hlsl b/tests/projects/other/hlsl2spv_bin2obj/src/test.ps.hlsl new file mode 100644 index 000000000..5c534d30b --- /dev/null +++ b/tests/projects/other/hlsl2spv_bin2obj/src/test.ps.hlsl @@ -0,0 +1,9 @@ +struct PSInput { + float4 position : SV_POSITION; + float2 texcoord : TEXCOORD0; +}; + +float4 main(PSInput input) : SV_TARGET { + return float4(input.texcoord, 0.0, 1.0); +} + diff --git a/tests/projects/other/hlsl2spv_bin2obj/src/test.vs.hlsl b/tests/projects/other/hlsl2spv_bin2obj/src/test.vs.hlsl new file mode 100644 index 000000000..e86b3b263 --- /dev/null +++ b/tests/projects/other/hlsl2spv_bin2obj/src/test.vs.hlsl @@ -0,0 +1,17 @@ +struct VSInput { + float3 position : POSITION; + float2 texcoord : TEXCOORD0; +}; + +struct VSOutput { + float4 position : SV_POSITION; + float2 texcoord : TEXCOORD0; +}; + +VSOutput main(VSInput input) { + VSOutput output; + output.position = float4(input.position, 1.0); + output.texcoord = input.texcoord; + return output; +} + |
