diff --git a/tests/d3d11/test_d3d11_compute.cpp b/tests/d3d11/test_d3d11_compute.cpp index 734e7ca7..08994c45 100644 --- a/tests/d3d11/test_d3d11_compute.cpp +++ b/tests/d3d11/test_d3d11_compute.cpp @@ -19,5 +19,7 @@ int WINAPI WinMain(HINSTANCE hInstance, return 1; } + + return 0; } diff --git a/tests/dxbc/meson.build b/tests/dxbc/meson.build new file mode 100644 index 00000000..fb37fd6b --- /dev/null +++ b/tests/dxbc/meson.build @@ -0,0 +1,3 @@ +test_dxbc_deps = [ dxbc_dep, dxvk_dep ] + +executable('dxbc-compiler', files('test_dxbc_compiler.cpp'), dependencies : test_dxbc_deps, install : true) \ No newline at end of file diff --git a/tests/dxbc/test_dxbc_compiler.cpp b/tests/dxbc/test_dxbc_compiler.cpp new file mode 100644 index 00000000..ddbc4bac --- /dev/null +++ b/tests/dxbc/test_dxbc_compiler.cpp @@ -0,0 +1,47 @@ +#include +#include + +#include +#include + +#include +#include +#include + +using namespace dxvk; + +int WINAPI WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) { + int argc = 0; + LPWSTR* argv = CommandLineToArgvW( + GetCommandLineW(), &argc); + + if (argc < 3) { + Logger::err("Usage: dxbc-compiler input.dxbc output.spv"); + return 1; + } + + try { + std::ifstream ifile(str::fromws(argv[1]), std::ios::binary); + ifile.ignore(std::numeric_limits::max()); + std::streamsize length = ifile.gcount(); + ifile.clear(); + + ifile.seekg(0, std::ios_base::beg); + std::vector dxbcCode(length); + ifile.read(dxbcCode.data(), length); + + DxbcReader reader(dxbcCode.data(), dxbcCode.size()); + DxbcModule module(reader); + + auto shader = module.compile(); + shader->code(0).store(std::ofstream( + str::fromws(argv[2]), std::ios::binary)); + return 0; + } catch (const DxvkError& e) { + Logger::err(e.message()); + return 1; + } +} diff --git a/tests/meson.build b/tests/meson.build index 485409d6..096cbfdd 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,3 +1,4 @@ subdir('d3d11') +subdir('dxbc') subdir('dxgi') subdir('dxvk') \ No newline at end of file