mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 15:33:34 +00:00
adding D3D11 unit tests, removing raw HLSL support
This commit is contained in:
@@ -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<int> 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);
|
||||
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
// RWBuffer<int> 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,
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user