VirtualBox

source: vbox/trunk/src/libs/dxvk-native-1.9.2a/tests/dxbc/test_dxbc_compiler.cpp@ 104739

最後變更 在這個檔案從104739是 96497,由 vboxsync 提交於 3 年 前

libs/dxvk-native-1.9.2a: export to OSE

  • 屬性 svn:eol-style 設為 native
檔案大小: 1.5 KB
 
1#include <iterator>
2#include <fstream>
3
4#include "../../src/dxbc/dxbc_module.h"
5#include "../../src/dxvk/dxvk_shader.h"
6
7#include <shellapi.h>
8#include <windows.h>
9#include <windowsx.h>
10
11namespace dxvk {
12 Logger Logger::s_instance("dxbc-compiler.log");
13}
14
15using namespace dxvk;
16
17int WINAPI WinMain(HINSTANCE hInstance,
18 HINSTANCE hPrevInstance,
19 LPSTR lpCmdLine,
20 int nCmdShow) {
21 int argc = 0;
22 LPWSTR* argv = CommandLineToArgvW(
23 GetCommandLineW(), &argc);
24
25 if (argc < 3) {
26 Logger::err("Usage: dxbc-compiler input.dxbc output.spv");
27 return 1;
28 }
29
30 try {
31 std::string ifileName = str::fromws(argv[1]);
32 std::ifstream ifile(ifileName, std::ios::binary);
33 ifile.ignore(std::numeric_limits<std::streamsize>::max());
34 std::streamsize length = ifile.gcount();
35 ifile.clear();
36
37 ifile.seekg(0, std::ios_base::beg);
38 std::vector<char> dxbcCode(length);
39 ifile.read(dxbcCode.data(), length);
40
41 DxbcReader reader(dxbcCode.data(), dxbcCode.size());
42 DxbcModule module(reader);
43
44 DxbcModuleInfo moduleInfo;
45 moduleInfo.options.useSubgroupOpsForAtomicCounters = true;
46 moduleInfo.options.useDemoteToHelperInvocation = true;
47 moduleInfo.options.minSsboAlignment = 4;
48 moduleInfo.xfb = nullptr;
49
50 Rc<DxvkShader> shader = module.compile(moduleInfo, ifileName);
51 std::ofstream ofile(str::fromws(argv[2]), std::ios::binary);
52 shader->dump(ofile);
53 return 0;
54 } catch (const DxvkError& e) {
55 Logger::err(e.message());
56 return 1;
57 }
58}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette