diff --git a/.github/workflows/d3d11-test-windows.yml b/.github/workflows/d3d11-test-windows.yml index 0392786..97c5cc2 100644 --- a/.github/workflows/d3d11-test-windows.yml +++ b/.github/workflows/d3d11-test-windows.yml @@ -62,7 +62,7 @@ jobs: # Setup compilation mode and install project dependencies - name: Configure xmake and install dependencies - run: xmake config --d3d11=y --vulkan=n --opengl=n --software=n --webgpu=n --examples=y --arch=${{ matrix.arch }} --mode=${{ matrix.confs.mode }} ${{ matrix.confs.config }} --ccache=n --yes + run: xmake config --d3d11=y --d3d11-tests-y --vulkan=n --opengl=n --software=n --webgpu=n --examples=y --arch=${{ matrix.arch }} --mode=${{ matrix.confs.mode }} ${{ matrix.confs.config }} --ccache=n --yes # Save dependencies - name: Save cached xmake dependencies @@ -82,5 +82,4 @@ jobs: - name: Test D3D11 run: | - xmake build --yes D3D11Example - xmake run --yes D3D11Example + xmake run --yes D3D11UnitTests diff --git a/Examples/D3D11/main.c b/Examples/D3D11/main.c index df7b4d2..c65ac93 100644 --- a/Examples/D3D11/main.c +++ b/Examples/D3D11/main.c @@ -22,25 +22,11 @@ void DebugCallBack(PulseDebugMessageSeverity severity, const char* message) #define BUFFER_SIZE (256 * sizeof(uint32_t)) const char* hlsl_source = HLSL_SOURCE( - RWBuffer ssbo : register(u0); - - [numthreads(16, 16, 1)] - void CSMain(uint3 grid : SV_DispatchThreadID) - { - ssbo[grid.x * grid.y] = (int)(grid.x * grid.y); - } ); int main(void) { - PulseFlags shader_format; - #ifdef PULSE_D3D11_COMPILER_UNAVAILABLE - shader_format = PULSE_SHADER_FORMAT_DXBC_BIT; - #else - shader_format = PULSE_SHADER_FORMAT_HLSL_BIT; - #endif - - PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_D3D11, shader_format, PULSE_HIGH_DEBUG); + PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_D3D11, PULSE_SHADER_FORMAT_DXBC_BIT, PULSE_HIGH_DEBUG); PulseSetDebugCallback(backend, DebugCallBack); PulseDevice device = PulseCreateDevice(backend, NULL, 0); @@ -51,19 +37,15 @@ int main(void) // GPU computations { + const uint8_t shader_bytecode[] = { + #include "shader.cso.h" + }; + PulseComputePipelineCreateInfo info = { 0 }; - #ifdef PULSE_D3D11_COMPILER_UNAVAILABLE - const uint8_t shader_bytecode[] = { - #include "shader.cso.h" - }; - info.code_size = sizeof(shader_bytecode); - info.code = shader_bytecode; - #else - info.code_size = strlen(hlsl_source); - info.code = (const uint8_t*)hlsl_source; - #endif + info.code_size = sizeof(shader_bytecode); + info.code = shader_bytecode; info.entrypoint = "CSMain"; - info.format = shader_format; + info.format = PULSE_SHADER_FORMAT_DXBC_BIT; info.num_readwrite_storage_buffers = 1; PulseComputePipeline pipeline = PulseCreateComputePipeline(device, &info); diff --git a/Examples/D3D11/shader.cso.h b/Examples/D3D11/shader.cso.h index b4e67cb..f7833de 100644 --- a/Examples/D3D11/shader.cso.h +++ b/Examples/D3D11/shader.cso.h @@ -1,3 +1,11 @@ +// RWBuffer ssbo : register(u0); +// +// [numthreads(16, 16, 1)] +// void CSMain(uint3 grid : SV_DispatchThreadID) +// { +// ssbo[grid.x * grid.y] = (int)(grid.x * grid.y); +// } + 0x44, 0x58, 0x42, 0x43, 0x73, 0x34, 0xc8, 0x1f, 0xdb, 0x93, 0x0e, 0xcb, 0x41, 0xcd, 0x2e, 0x23, 0xde, 0x7c, 0x23, 0x9b, 0x01, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, diff --git a/Examples/D3D11/xmake.lua b/Examples/D3D11/xmake.lua index 6dc2dbb..8643b60 100644 --- a/Examples/D3D11/xmake.lua +++ b/Examples/D3D11/xmake.lua @@ -2,7 +2,6 @@ target("D3D11Example") add_deps("pulse_gpu") if is_plat("linux") then set_extension(".x86_64") - add_defines("PULSE_D3D11_COMPILER_UNAVAILABLE") end add_files("*.c") target_end() diff --git a/Includes/Pulse.h b/Includes/Pulse.h index b24afe2..8afc683 100644 --- a/Includes/Pulse.h +++ b/Includes/Pulse.h @@ -77,7 +77,6 @@ typedef enum PulseShaderFormatsBits PULSE_SHADER_FORMAT_WGSL_BIT = PULSE_BIT(4), // Can be used by WebGPU backend PULSE_SHADER_FORMAT_GLSL_BIT = PULSE_BIT(5), // Can be used by OpenGL / OpenGL_ES backend PULSE_SHADER_FORMAT_DXBC_BIT = PULSE_BIT(6), // Can be used by D3D11 backend - PULSE_SHADER_FORMAT_HLSL_BIT = PULSE_BIT(7), // Can be used by D3D11 backend // More to come } PulseShaderFormatsBits; typedef PulseFlags PulseShaderFormatsFlags; diff --git a/Sources/Backends/D3D11/D3D11.c b/Sources/Backends/D3D11/D3D11.c index 20d8278..ae78193 100644 --- a/Sources/Backends/D3D11/D3D11.c +++ b/Sources/Backends/D3D11/D3D11.c @@ -10,15 +10,12 @@ #pragma comment(lib,"d3d11.lib") #pragma comment(lib, "dxgi.lib") -#ifndef PULSE_D3D11_COMPILER_UNAVAILABLE - #pragma comment(lib,"d3dcompiler.lib") -#endif PulseBackendFlags Direct3D11CheckSupport(PulseBackendFlags candidates, PulseShaderFormatsFlags shader_formats_used) { if(candidates != PULSE_BACKEND_ANY && (candidates & PULSE_BACKEND_D3D11) == 0) return PULSE_BACKEND_INVALID; - if((shader_formats_used & PULSE_SHADER_FORMAT_DXBC_BIT) == 0 && (shader_formats_used & PULSE_SHADER_FORMAT_HLSL_BIT) == 0) + if((shader_formats_used & PULSE_SHADER_FORMAT_DXBC_BIT) == 0) return PULSE_BACKEND_INVALID; return PULSE_BACKEND_D3D11; } @@ -62,6 +59,6 @@ PulseBackendHandler D3D11Driver = { .PFN_UnloadBackend = Direct3D11UnloadBackend, .PFN_CreateDevice = Direct3D11CreateDevice, .backend = PULSE_BACKEND_D3D11, - .supported_shader_formats = PULSE_SHADER_FORMAT_DXBC_BIT | PULSE_SHADER_FORMAT_HLSL_BIT, + .supported_shader_formats = PULSE_SHADER_FORMAT_DXBC_BIT, .driver_data = PULSE_NULLPTR }; diff --git a/Sources/Backends/D3D11/D3D11ComputePipeline.c b/Sources/Backends/D3D11/D3D11ComputePipeline.c index 7a1c71d..20bd309 100644 --- a/Sources/Backends/D3D11/D3D11ComputePipeline.c +++ b/Sources/Backends/D3D11/D3D11ComputePipeline.c @@ -7,55 +7,6 @@ #include "D3D11.h" #include "D3D11Device.h" #include "D3D11ComputePipeline.h" -#include - -#ifndef PULSE_D3D11_COMPILER_UNAVAILABLE - #include - - static HRESULT CompileComputeShader(PulseDevice device, const unsigned char* src, uint32_t src_size, const char* entry_point, ID3DBlob** blob) - { - if(!src || !entry_point || !device || !blob) - return E_INVALIDARG; - - Direct3D11Device* d3d11_device = D3D11_RETRIEVE_DRIVER_DATA_AS(device, Direct3D11Device*); - *blob = PULSE_NULLPTR; - - UINT flags = D3DCOMPILE_ENABLE_STRICTNESS; - if(PULSE_IS_BACKEND_HIGH_LEVEL_DEBUG(device->backend)) - flags |= D3DCOMPILE_DEBUG; - - // We generally prefer to use the higher CS shader profile when possible as CS 5.0 is better performance on 11-class hardware - LPCSTR profile = (ID3D11Device_GetFeatureLevel(d3d11_device->device) >= D3D_FEATURE_LEVEL_11_0) ? "cs_5_0" : "cs_4_0"; - - ID3DBlob* shader_blob = PULSE_NULLPTR; - ID3DBlob* error_blob = PULSE_NULLPTR; - HRESULT hr = D3DCompile(src, src_size, PULSE_NULLPTR, PULSE_NULLPTR, PULSE_NULLPTR, entry_point, profile, flags, 0, &shader_blob, &error_blob); - - if(FAILED(hr)) - { - if(error_blob) - { - if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(device->backend)) - PulseLogInfoFmt(device->backend, "(D3D11) failed to compile HLSL shader. %s", ID3D10Blob_GetBufferPointer(error_blob)); - ID3D10Blob_Release(error_blob); - } - if(shader_blob) - ID3D10Blob_Release(shader_blob); - return hr; - } - - *blob = shader_blob; - return hr; - } -#else - static HRESULT CompileComputeShader(PulseDevice device, const unsigned char* src, uint32_t src_size, const char* entry_point, ID3DBlob** blob) - { - if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(device->backend)) - PulseLogInfo(device->backend, "(D3D11) on-the-fly shader compilation is not available"); - PulseSetInternalError(PULSE_ERROR_INITIALIZATION_FAILED); - return D3DERR_INVALIDCALL; - } -#endif PulseComputePipeline Direct3D11CreateComputePipeline(PulseDevice device, const PulseComputePipelineCreateInfo* info) { @@ -69,25 +20,7 @@ PulseComputePipeline Direct3D11CreateComputePipeline(PulseDevice device, const P pipeline->driver_data = d3d11_pipeline; - void* bytecode_data = PULSE_NULLPTR; - size_t bytecode_size; - - if(info->format & PULSE_SHADER_FORMAT_HLSL_BIT) - { - ID3D10Blob* blob = PULSE_NULLPTR; - CHECK_D3D11_RETVAL(device->backend, CompileComputeShader(device, info->code, info->code_size, info->entrypoint, &blob), PULSE_ERROR_INITIALIZATION_FAILED, PULSE_NULL_HANDLE); - bytecode_size = ID3D10Blob_GetBufferSize(blob); - memcpy(bytecode_data, ID3D10Blob_GetBufferPointer(blob), bytecode_size); - ID3D10Blob_Release(blob); - } - - if(bytecode_data == PULSE_NULLPTR) - { - bytecode_data = (void*)info->code; - bytecode_size = info->code_size; - } - - CHECK_D3D11_RETVAL(device->backend, ID3D11Device_CreateComputeShader(d3d11_device->device, bytecode_data, bytecode_size, PULSE_NULLPTR, &d3d11_pipeline->shader), PULSE_ERROR_INITIALIZATION_FAILED, PULSE_NULL_HANDLE);; + CHECK_D3D11_RETVAL(device->backend, ID3D11Device_CreateComputeShader(d3d11_device->device, (void*)info->code, info->code_size, PULSE_NULLPTR, &d3d11_pipeline->shader), PULSE_ERROR_INITIALIZATION_FAILED, PULSE_NULL_HANDLE);; if(PULSE_IS_BACKEND_HIGH_LEVEL_DEBUG(device->backend)) PulseLogInfoFmt(device->backend, "(D3D11) created new compute pipeline %p", pipeline); diff --git a/Sources/Backends/D3D11/D3D11Image.c b/Sources/Backends/D3D11/D3D11Image.c index 6e3cf64..9ba91ed 100644 --- a/Sources/Backends/D3D11/D3D11Image.c +++ b/Sources/Backends/D3D11/D3D11Image.c @@ -35,4 +35,7 @@ bool Direct3D11BlitImage(PulseCommandList cmd, const PulseImageRegion* src, cons void Direct3D11DestroyImage(PulseDevice device, PulseImage image) { + Direct3D11Image* d3d11_image = D3D11_RETRIEVE_DRIVER_DATA_AS(image, Direct3D11Image*); + free(d3d11_image); + free(image); } diff --git a/Tests/Backend.c b/Tests/Backend.c index ddc96d2..dec197b 100644 --- a/Tests/Backend.c +++ b/Tests/Backend.c @@ -19,6 +19,8 @@ void TestBackendSupport() if(!PulseSupportsBackend(PULSE_BACKEND_OPENGL, PULSE_SHADER_FORMAT_GLSL_BIT)) #elif defined(OPENGLES_ENABLED) if(!PulseSupportsBackend(PULSE_BACKEND_OPENGL_ES, PULSE_SHADER_FORMAT_GLSL_BIT)) + #elif defined(D3D11_ENABLED) + if(!PulseSupportsBackend(PULSE_BACKEND_D3D11, PULSE_SHADER_FORMAT_DXBC_BIT)) #endif { TEST_MESSAGE("Backend is not supported"); @@ -36,6 +38,8 @@ void TestBackendSetup() PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_OPENGL, PULSE_SHADER_FORMAT_GLSL_BIT, PULSE_HIGH_DEBUG); #elif defined(OPENGLES_ENABLED) PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_OPENGL_ES, PULSE_SHADER_FORMAT_GLSL_BIT, PULSE_HIGH_DEBUG); + #elif defined(D3D11_ENABLED) + PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_D3D11, PULSE_SHADER_FORMAT_DXBC_BIT, PULSE_HIGH_DEBUG); #endif TEST_ASSERT_NOT_EQUAL_MESSAGE(backend, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType())); PulseSetDebugCallback(backend, DumbDebugCallBack); @@ -50,6 +54,8 @@ void TestBackendAnySetup() PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_ANY, PULSE_SHADER_FORMAT_WGSL_BIT, PULSE_HIGH_DEBUG); #elif defined(OPENGL_ENABLED) || defined(OPENGLES_ENABLED) PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_ANY, PULSE_SHADER_FORMAT_GLSL_BIT, PULSE_HIGH_DEBUG); + #elif defined(D3D11_ENABLED) + PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_ANY, PULSE_SHADER_FORMAT_DXBC_BIT, PULSE_HIGH_DEBUG); #endif TEST_ASSERT_NOT_EQUAL_MESSAGE(backend, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType())); #if defined(VULKAN_ENABLED) @@ -60,6 +66,8 @@ void TestBackendAnySetup() PulseBackendFlags backend_type = PulseGetBackendType(backend); if(backend_type != PULSE_BACKEND_OPENGL && backend_type != PULSE_BACKEND_OPENGL_ES) TEST_FAIL(); + #elif defined(D3D11_ENABLED) + TEST_ASSERT_EQUAL(PulseGetBackendType(backend), PULSE_BACKEND_D3D11); #endif PulseSetDebugCallback(backend, DumbDebugCallBack); PulseUnloadBackend(backend); @@ -75,6 +83,8 @@ void TestWrongBackendSetup() PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_OPENGL, PULSE_SHADER_FORMAT_MSL_BIT, PULSE_HIGH_DEBUG); #elif defined(OPENGLES_ENABLED) PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_OPENGL_ES, PULSE_SHADER_FORMAT_MSL_BIT, PULSE_HIGH_DEBUG); + #elif defined(D3D11_ENABLED) + PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_D3D11, PULSE_SHADER_FORMAT_MSL_BIT, PULSE_HIGH_DEBUG); #endif TEST_ASSERT_EQUAL(backend, PULSE_NULL_HANDLE); PulseSetDebugCallback(backend, DumbDebugCallBack); diff --git a/Tests/Buffer.c b/Tests/Buffer.c index 6906e0f..b881467 100644 --- a/Tests/Buffer.c +++ b/Tests/Buffer.c @@ -280,6 +280,10 @@ void TestBufferComputeWrite() const uint8_t shader_bytecode[] = { #include "Shaders/Vulkan-OpenGL/SimpleBufferWrite.comp.glsl.h" }; + #elif defined(D3D11_ENABLED) + const uint8_t shader_bytecode[] = { + #include "Shaders/D3D11/SimpleBufferWrite.cso.h" + }; #endif PulseBufferCreateInfo buffer_create_info = { 0 }; @@ -351,6 +355,10 @@ void TestBufferComputeCopy() const uint8_t shader_bytecode[] = { #include "Shaders/Vulkan-OpenGL/BufferCopy.comp.glsl.h" }; + #elif defined(D3D11_ENABLED) + const uint8_t shader_bytecode[] = { + #include "Shaders/D3D11/BufferCopy.cso.h" + }; #endif uint32_t data[256]; diff --git a/Tests/Common.c b/Tests/Common.c index 34c4cec..85a10be 100644 --- a/Tests/Common.c +++ b/Tests/Common.c @@ -28,6 +28,8 @@ void SetupPulse(PulseBackend* backend) *backend = PulseLoadBackend(PULSE_BACKEND_OPENGL, PULSE_SHADER_FORMAT_GLSL_BIT, PULSE_PARANOID_DEBUG); #elif defined(OPENGLES_ENABLED) *backend = PulseLoadBackend(PULSE_BACKEND_OPENGL_ES, PULSE_SHADER_FORMAT_GLSL_BIT, PULSE_PARANOID_DEBUG); + #elif defined(D3D11_ENABLED) + *backend = PulseLoadBackend(PULSE_BACKEND_D3D11, PULSE_SHADER_FORMAT_DXBC_BIT, PULSE_PARANOID_DEBUG); #endif if(*backend == PULSE_NULL_HANDLE) { @@ -78,6 +80,8 @@ void LoadComputePipeline(PulseDevice device, PulseComputePipeline* pipeline, con info.format = PULSE_SHADER_FORMAT_GLSL_BIT; #elif defined(OPENGLES_ENABLED) info.format = PULSE_SHADER_FORMAT_GLSL_BIT; + #elif defined(D3D11_ENABLED) + info.format = PULSE_SHADER_FORMAT_DXBC_BIT; #endif info.num_readonly_storage_images = num_readonly_storage_images; info.num_readonly_storage_buffers = num_readonly_storage_buffers; diff --git a/Tests/Device.c b/Tests/Device.c index 63456e6..1f368b8 100644 --- a/Tests/Device.c +++ b/Tests/Device.c @@ -71,6 +71,12 @@ void TestBackendInUse() TEST_ASSERT_EQUAL(PulseGetBackendInUseByDevice(device), PULSE_BACKEND_VULKAN); #elif defined(WEBGPU_ENABLED) TEST_ASSERT_EQUAL(PulseGetBackendInUseByDevice(device), PULSE_BACKEND_WEBGPU); + #elif defined(OPENGL_ENABLED) + TEST_ASSERT_EQUAL(PulseGetBackendInUseByDevice(device), PULSE_BACKEND_OPENGL); + #elif defined(OPENGLES_ENABLED) + TEST_ASSERT_EQUAL(PulseGetBackendInUseByDevice(device), PULSE_BACKEND_OPENGL_ES); + #elif defined(D3D11_ENABLED) + TEST_ASSERT_EQUAL(PulseGetBackendInUseByDevice(device), PULSE_BACKEND_D3D11); #endif PulseDestroyDevice(device); @@ -88,6 +94,12 @@ void TestShaderFormatSupport() TEST_ASSERT_TRUE(PulseDeviceSupportsShaderFormats(device, PULSE_SHADER_FORMAT_SPIRV_BIT)); #elif defined(WEBGPU_ENABLED) TEST_ASSERT_TRUE(PulseDeviceSupportsShaderFormats(device, PULSE_SHADER_FORMAT_WGSL_BIT)); + #elif defined(OPENGL_ENABLED) + TEST_ASSERT_TRUE(PulseDeviceSupportsShaderFormats(device, PULSE_SHADER_FORMAT_GLSL_BIT)); + #elif defined(OPENGLES_ENABLED) + TEST_ASSERT_TRUE(PulseDeviceSupportsShaderFormats(device, PULSE_SHADER_FORMAT_GLSL_BIT)); + #elif defined(D3D11_ENABLED) + TEST_ASSERT_TRUE(PulseDeviceSupportsShaderFormats(device, PULSE_SHADER_FORMAT_DXBC_BIT)); #endif PulseDestroyDevice(device); diff --git a/Tests/Pipeline.c b/Tests/Pipeline.c index 3145654..c164a77 100644 --- a/Tests/Pipeline.c +++ b/Tests/Pipeline.c @@ -21,6 +21,10 @@ void TestPipelineSetup() const uint8_t shader_bytecode[] = { #include "Shaders/Vulkan-OpenGL/Simple.comp.glsl.h" }; + #elif defined(D3D11_ENABLED) + const uint8_t shader_bytecode[] = { + #include "Shaders/D3D11/Simple.cso.h" + }; #endif PulseComputePipeline pipeline; @@ -66,6 +70,10 @@ void TestPipelineReadOnlyBindings() const uint8_t shader_bytecode[] = { #include "Shaders/Vulkan-OpenGL/ReadOnlyBindings.comp.glsl.h" }; + #elif defined(D3D11_ENABLED) + const uint8_t shader_bytecode[] = { + #include "Shaders/D3D11/ReadOnlyBindings.cso.h" + }; #endif PulseBufferCreateInfo buffer_create_info = { 0 }; @@ -131,6 +139,10 @@ void TestPipelineWriteOnlyBindings() const uint8_t shader_bytecode[] = { #include "Shaders/Vulkan-OpenGL/WriteOnlyBindings.comp.glsl.h" }; + #elif defined(D3D11_ENABLED) + const uint8_t shader_bytecode[] = { + #include "Shaders/D3D11/WriteOnlyBindings.cso.h" + }; #endif PulseBufferCreateInfo buffer_create_info = { 0 }; @@ -196,6 +208,10 @@ void TestPipelineReadWriteBindings() const uint8_t shader_bytecode[] = { #include "Shaders/Vulkan-OpenGL/ReadWriteBindings.comp.glsl.h" }; + #elif defined(D3D11_ENABLED) + const uint8_t shader_bytecode[] = { + #include "Shaders/D3D11/ReadWriteBindings.cso.h" + }; #endif PulseBufferCreateInfo buffer_create_info = { 0 }; diff --git a/Tests/Shaders/D3D11/BufferCopy.cso.h b/Tests/Shaders/D3D11/BufferCopy.cso.h new file mode 100644 index 0000000..e6695bb --- /dev/null +++ b/Tests/Shaders/D3D11/BufferCopy.cso.h @@ -0,0 +1,69 @@ +0x44, 0x58, 0x42, 0x43, 0xae, 0xcc, 0x55, 0xb5, 0x26, 0xcc, 0xdd, 0xd8, +0x22, 0xbc, 0x39, 0x14, 0x62, 0x56, 0xe1, 0x83, 0x01, 0x00, 0x00, 0x00, +0x34, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, +0xb8, 0x01, 0x00, 0x00, 0xc8, 0x01, 0x00, 0x00, 0xd8, 0x01, 0x00, 0x00, +0x98, 0x02, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x7c, 0x01, 0x00, 0x00, +0x02, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, +0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x53, 0x43, 0x00, 0x01, 0x00, 0x00, +0x48, 0x01, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00, +0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, +0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x7c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, +0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x73, 0x73, 0x62, +0x6f, 0x00, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x73, 0x73, 0x62, 0x6f, +0x00, 0xab, 0xab, 0xab, 0x7c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0xc4, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x03, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x20, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x03, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, +0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x24, 0x45, 0x6c, 0x65, +0x6d, 0x65, 0x6e, 0x74, 0x00, 0x64, 0x77, 0x6f, 0x72, 0x64, 0x00, 0xab, +0x00, 0x00, 0x13, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, +0xec, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, +0x02, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, +0x00, 0x00, 0x00, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, +0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, +0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, +0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, +0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, +0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, +0x4f, 0x53, 0x47, 0x4e, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x00, 0x00, 0x00, 0x53, 0x48, 0x45, 0x58, 0xb8, 0x00, 0x00, 0x00, +0x50, 0x00, 0x05, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, +0xa2, 0x00, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, +0x04, 0x00, 0x00, 0x00, 0x9e, 0x00, 0x00, 0x04, 0x00, 0xe0, 0x11, 0x00, +0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x02, +0x32, 0x00, 0x02, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, +0x9b, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x06, 0x00, 0xd0, 0x00, 0x00, +0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x02, 0x00, +0x1a, 0x00, 0x02, 0x00, 0xa7, 0x00, 0x00, 0x8b, 0x02, 0x23, 0x00, 0x80, +0x83, 0x99, 0x19, 0x00, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x06, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, +0xa8, 0x00, 0x00, 0x09, 0x12, 0xe0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, +0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, +0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00 diff --git a/Tests/Shaders/D3D11/BufferCopy.hlsl b/Tests/Shaders/D3D11/BufferCopy.hlsl new file mode 100644 index 0000000..7bdc98a --- /dev/null +++ b/Tests/Shaders/D3D11/BufferCopy.hlsl @@ -0,0 +1,8 @@ +StructuredBuffer read_ssbo : register(t0); +RWStructuredBuffer write_ssbo : register(u0); + +[numthreads(16, 16, 1)] +void main(uint3 grid : SV_DispatchThreadID) +{ + write_ssbo[grid.x * grid.y] = read_ssbo[grid.x * grid.y]; +} diff --git a/Tests/Shaders/D3D11/ReadOnlyBindings.cso.h b/Tests/Shaders/D3D11/ReadOnlyBindings.cso.h new file mode 100644 index 0000000..7fb6dc6 --- /dev/null +++ b/Tests/Shaders/D3D11/ReadOnlyBindings.cso.h @@ -0,0 +1,34 @@ +0x44, 0x58, 0x42, 0x43, 0x8d, 0xc4, 0x29, 0x65, 0xf4, 0x8c, 0xb2, 0x8d, +0x38, 0x68, 0x6e, 0x29, 0x8c, 0xa7, 0xca, 0x9c, 0x01, 0x00, 0x00, 0x00, +0x90, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, +0xac, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, +0xf4, 0x00, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x70, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x53, 0x43, 0x00, 0x01, 0x00, 0x00, +0x3c, 0x00, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00, +0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, +0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, +0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, +0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, +0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, +0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x08, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4f, 0x53, 0x47, 0x4e, +0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, +0x53, 0x48, 0x45, 0x58, 0x20, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, +0x08, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x9b, 0x00, 0x00, 0x04, +0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00 diff --git a/Tests/Shaders/D3D11/ReadOnlyBindings.hlsl b/Tests/Shaders/D3D11/ReadOnlyBindings.hlsl new file mode 100644 index 0000000..3d3b853 --- /dev/null +++ b/Tests/Shaders/D3D11/ReadOnlyBindings.hlsl @@ -0,0 +1,7 @@ +StructuredBuffer read_ssbo : register(t0); +Texture2D read_texture : register(t1); + +[numthreads(16, 16, 1)] +void main(uint3 grid : SV_DispatchThreadID) +{ +} diff --git a/Tests/Shaders/D3D11/ReadWriteBindings.cso.h b/Tests/Shaders/D3D11/ReadWriteBindings.cso.h new file mode 100644 index 0000000..7fb6dc6 --- /dev/null +++ b/Tests/Shaders/D3D11/ReadWriteBindings.cso.h @@ -0,0 +1,34 @@ +0x44, 0x58, 0x42, 0x43, 0x8d, 0xc4, 0x29, 0x65, 0xf4, 0x8c, 0xb2, 0x8d, +0x38, 0x68, 0x6e, 0x29, 0x8c, 0xa7, 0xca, 0x9c, 0x01, 0x00, 0x00, 0x00, +0x90, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, +0xac, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, +0xf4, 0x00, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x70, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x53, 0x43, 0x00, 0x01, 0x00, 0x00, +0x3c, 0x00, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00, +0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, +0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, +0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, +0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, +0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, +0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x08, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4f, 0x53, 0x47, 0x4e, +0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, +0x53, 0x48, 0x45, 0x58, 0x20, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, +0x08, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x9b, 0x00, 0x00, 0x04, +0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00 diff --git a/Tests/Shaders/D3D11/ReadWriteBindings.hlsl b/Tests/Shaders/D3D11/ReadWriteBindings.hlsl new file mode 100644 index 0000000..9a0fed0 --- /dev/null +++ b/Tests/Shaders/D3D11/ReadWriteBindings.hlsl @@ -0,0 +1,9 @@ +Texture2D read_texture : register(t0); +StructuredBuffer read_ssbo : register(t1); +RWTexture2D write_texture : register(u0); +RWStructuredBuffer write_ssbo : register(u1); + +[numthreads(16, 16, 1)] +void main(uint3 grid : SV_DispatchThreadID) +{ +} diff --git a/Tests/Shaders/D3D11/Simple.cso.h b/Tests/Shaders/D3D11/Simple.cso.h new file mode 100644 index 0000000..7fb6dc6 --- /dev/null +++ b/Tests/Shaders/D3D11/Simple.cso.h @@ -0,0 +1,34 @@ +0x44, 0x58, 0x42, 0x43, 0x8d, 0xc4, 0x29, 0x65, 0xf4, 0x8c, 0xb2, 0x8d, +0x38, 0x68, 0x6e, 0x29, 0x8c, 0xa7, 0xca, 0x9c, 0x01, 0x00, 0x00, 0x00, +0x90, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, +0xac, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, +0xf4, 0x00, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x70, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x53, 0x43, 0x00, 0x01, 0x00, 0x00, +0x3c, 0x00, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00, +0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, +0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, +0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, +0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, +0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, +0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x08, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4f, 0x53, 0x47, 0x4e, +0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, +0x53, 0x48, 0x45, 0x58, 0x20, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, +0x08, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x9b, 0x00, 0x00, 0x04, +0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00 diff --git a/Tests/Shaders/D3D11/Simple.hlsl b/Tests/Shaders/D3D11/Simple.hlsl new file mode 100644 index 0000000..17107e6 --- /dev/null +++ b/Tests/Shaders/D3D11/Simple.hlsl @@ -0,0 +1,4 @@ +[numthreads(16, 16, 1)] +void main(uint3 grid : SV_DispatchThreadID) +{ +} diff --git a/Tests/Shaders/D3D11/SimpleBufferWrite.cso.h b/Tests/Shaders/D3D11/SimpleBufferWrite.cso.h new file mode 100644 index 0000000..4d9fe2a --- /dev/null +++ b/Tests/Shaders/D3D11/SimpleBufferWrite.cso.h @@ -0,0 +1,55 @@ +0x44, 0x58, 0x42, 0x43, 0x39, 0xde, 0x6f, 0xa0, 0x63, 0x41, 0x25, 0xe1, +0xa9, 0xce, 0xd2, 0xcd, 0xbc, 0xbd, 0xf6, 0x23, 0x01, 0x00, 0x00, 0x00, +0x8c, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, +0x4c, 0x01, 0x00, 0x00, 0x5c, 0x01, 0x00, 0x00, 0x6c, 0x01, 0x00, 0x00, +0xf0, 0x01, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x10, 0x01, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x53, 0x43, 0x00, 0x01, 0x00, 0x00, +0xdc, 0x00, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00, +0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, +0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x5c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x77, 0x72, 0x69, 0x74, +0x65, 0x5f, 0x73, 0x73, 0x62, 0x6f, 0x00, 0xab, 0x5c, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, +0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, +0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, +0x24, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x64, 0x77, 0x6f, +0x72, 0x64, 0x00, 0xab, 0x00, 0x00, 0x13, 0x00, 0x01, 0x00, 0x01, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xb1, 0x00, 0x00, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, +0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, +0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, +0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, +0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, +0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, +0x4f, 0x53, 0x47, 0x4e, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x00, 0x00, 0x00, 0x53, 0x48, 0x45, 0x58, 0x7c, 0x00, 0x00, 0x00, +0x50, 0x00, 0x05, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, +0x9e, 0x00, 0x00, 0x04, 0x00, 0xe0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, +0x04, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x02, 0x32, 0x00, 0x02, 0x00, +0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x04, +0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x26, 0x00, 0x00, 0x06, 0x00, 0xd0, 0x00, 0x00, 0x12, 0x00, 0x10, 0x00, +0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x1a, 0x00, 0x02, 0x00, +0xa8, 0x00, 0x00, 0x09, 0x12, 0xe0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, +0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, +0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00 diff --git a/Tests/Shaders/D3D11/SimpleBufferWrite.hlsl b/Tests/Shaders/D3D11/SimpleBufferWrite.hlsl new file mode 100644 index 0000000..e33e9b5 --- /dev/null +++ b/Tests/Shaders/D3D11/SimpleBufferWrite.hlsl @@ -0,0 +1,7 @@ +RWStructuredBuffer write_ssbo : register(u0); + +[numthreads(16, 16, 1)] +void main(uint3 grid : SV_DispatchThreadID) +{ + write_ssbo[grid.x * grid.y] = 0xFFFFFFFFu; +} diff --git a/Tests/Shaders/D3D11/WriteOnlyBindings.cso.h b/Tests/Shaders/D3D11/WriteOnlyBindings.cso.h new file mode 100644 index 0000000..7fb6dc6 --- /dev/null +++ b/Tests/Shaders/D3D11/WriteOnlyBindings.cso.h @@ -0,0 +1,34 @@ +0x44, 0x58, 0x42, 0x43, 0x8d, 0xc4, 0x29, 0x65, 0xf4, 0x8c, 0xb2, 0x8d, +0x38, 0x68, 0x6e, 0x29, 0x8c, 0xa7, 0xca, 0x9c, 0x01, 0x00, 0x00, 0x00, +0x90, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, +0xac, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, +0xf4, 0x00, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x70, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x53, 0x43, 0x00, 0x01, 0x00, 0x00, +0x3c, 0x00, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00, +0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, +0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, +0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, +0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, +0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, +0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x08, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4f, 0x53, 0x47, 0x4e, +0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, +0x53, 0x48, 0x45, 0x58, 0x20, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, +0x08, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x9b, 0x00, 0x00, 0x04, +0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00 diff --git a/Tests/Shaders/D3D11/WriteOnlyBindings.hlsl b/Tests/Shaders/D3D11/WriteOnlyBindings.hlsl new file mode 100644 index 0000000..0777aeb --- /dev/null +++ b/Tests/Shaders/D3D11/WriteOnlyBindings.hlsl @@ -0,0 +1,7 @@ +RWStructuredBuffer write_ssbo : register(u0); +RWTexture2D write_texture : register(u1); + +[numthreads(16, 16, 1)] +void main(uint3 grid : SV_DispatchThreadID) +{ +} diff --git a/Tests/xmake.lua b/Tests/xmake.lua index e9822b6..8d579c7 100644 --- a/Tests/xmake.lua +++ b/Tests/xmake.lua @@ -2,6 +2,7 @@ local Backend = { VULKAN = 1, OPENGL = 2, OPENGL_ES = 3, + D3D11 = 4, } local nzsl_included = false @@ -143,6 +144,9 @@ local tests = { add_files("**.nzsl") end }, + D3D11 = { + option = "d3d11", + }, WebGPU = { option = "webgpu", global_custom = function() diff --git a/xmake.lua b/xmake.lua index 6151208..b1f64ce 100644 --- a/xmake.lua +++ b/xmake.lua @@ -39,9 +39,8 @@ local backends = { if is_plat("linux") then add_sysincludedirs("/usr/include/dxvk") add_syslinks("dxvk_d3d11", "dxvk_dxgi") - add_defines("PULSE_D3D11_COMPILER_UNAVAILABLE") else - add_syslinks("d3d11", "d3dcompiler_47", "dxgi", "windowscodecs") + add_syslinks("d3d11", "dxgi", "windowscodecs") end end },