-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
600 lines (510 loc) · 19 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
#include <stdio.h>
#include <string.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <glslang/glslang/Public/ShaderLang.h>
#include <glslang/SPIRV/GlslangToSpv.h>
#include <glslang/StandAlone/DirStackFileIncluder.h>
#define STB_IMAGE_IMPLEMENTATION
#include <stb/stb_image.h>
#include <cxxopts/include/cxxopts.hpp>
extern "C" {
#include <spvm/context.h>
#include <spvm/state.h>
#include <spvm/ext/GLSL450.h>
}
bool Compile(std::vector<unsigned int>& outSPV, glslang::EShSource inLang, EShLanguage shaderType, const std::string& source, const std::string& entry);
std::vector<std::string> SplitString(const std::string& str, const std::string& dlm)
{
std::vector<std::string> ret;
size_t pos = 0, prev = 0;
while ((pos = str.find(dlm, prev)) != std::string::npos)
{
ret.push_back(str.substr(prev, pos - prev));
prev = pos + 1;
}
ret.push_back(str.substr(prev));
return ret;
}
void OutputVariableValue(spvm_state_t state, spvm_result_t type, spvm_member_t mems, spvm_word mem_count, const std::string& prefix)
{
if (!mems) return;
bool outPrefix = false;
bool allRec = true;
for (spvm_word i = 0; i < mem_count; i++) {
spvm_result_t vtype = type;
if (mems[i].type != 0)
vtype = spvm_state_get_type_info(state->results, &state->results[mems[i].type]);
if (vtype->member_count > 1 && vtype->pointer != 0 && vtype->value_type != spvm_value_type_matrix)
vtype = spvm_state_get_type_info(state->results, &state->results[vtype->pointer]);
if (mems[i].member_count == 0) {
if (!outPrefix && !prefix.empty()) {
outPrefix = true;
printf("%s = ", prefix.c_str());
}
if (vtype->value_type == spvm_value_type_float && type->value_bitcount <= 32)
printf("%.2f ", mems[i].value.f);
else if (vtype->value_type == spvm_value_type_float)
printf("%.2lf ", mems[i].value.d);
else
printf("%d ", mems[i].value.s);
allRec = false;
}
else {
std::string newPrefix = prefix;
if (type->value_type == spvm_value_type_struct)
newPrefix += "." + std::string(type->member_name[i]);
if (type->value_type == spvm_value_type_matrix)
newPrefix += "[" + std::to_string(i) + "]";
OutputVariableValue(state, vtype, mems[i].members, mems[i].member_count, newPrefix);
}
}
if (!allRec) printf("\n");
}
void InputVariableValue(spvm_state_t state, spvm_result_t type, spvm_member_t mems, spvm_word mem_count, const std::string& prefix)
{
bool outPrefix = false;
for (spvm_word i = 0; i < mem_count; i++) {
spvm_result_t vtype = type;
if (mems[i].type != 0)
vtype = spvm_state_get_type_info(state->results, &state->results[mems[i].type]);
if (vtype->member_count > 1 && vtype->pointer != 0 && vtype->value_type != spvm_value_type_matrix)
vtype = spvm_state_get_type_info(state->results, &state->results[vtype->pointer]);
if (mems[i].member_count == 0) {
std::string actPrefix = prefix;
if (type->value_type == spvm_value_type_array)
actPrefix += "[" + std::to_string(i) + "]";
if (!outPrefix && !actPrefix.empty()) {
outPrefix = true;
printf("%s = ", actPrefix.c_str());
}
if (vtype->value_type == spvm_value_type_float && type->value_bitcount <= 32)
scanf("%f", &mems[i].value.f);
else if (vtype->value_type == spvm_value_type_float)
scanf("%lf", &mems[i].value.d);
else
scanf("%d", &mems[i].value.s);
}
else {
std::string newPrefix = prefix;
if (type->value_type == spvm_value_type_struct)
newPrefix += "." + std::string(type->member_name[i]);
if (type->value_type == spvm_value_type_matrix || type->value_type == spvm_value_type_array)
newPrefix += "[" + std::to_string(i) + "]";
InputVariableValue(state, vtype, mems[i].members, mems[i].member_count, newPrefix);
}
}
}
void PrintAllOutputValues(spvm_state_t state)
{
for (spvm_word i = 0; i < state->owner->bound; i++) {
spvm_result_t ptrInfo = nullptr;
if (state->results[i].pointer)
ptrInfo = &state->results[state->results[i].pointer];
if (ptrInfo && ptrInfo->storage_class == SpvStorageClassOutput && ptrInfo->value_type == spvm_value_type_pointer) {
std::string prefix = "";
if (state->results[i].name)
prefix = state->results[i].name;
spvm_result_t type_info = spvm_state_get_type_info(state->results, ptrInfo);
OutputVariableValue(state, type_info, state->results[i].members, state->results[i].member_count, prefix);
}
}
}
bool is_emit_vertex_called = false, is_end_primitive_called = false;
void emit_vertex(struct spvm_state*, spvm_word)
{
is_emit_vertex_called = true;
// here you might store all output variables in some kind of an array for an actual debugger
}
void end_primitive(struct spvm_state*, spvm_word)
{
is_end_primitive_called = true;
}
int main(int argc, char* argv[]) {
std::string filename = "SimpleVS.vk", entry = "main";
glslang::EShSource language = glslang::EShSourceGlsl;
EShLanguage stage = EShLangVertex;
try {
cxxopts::Options options("sdbg", "sdbg is a CLI tool for debugging shaders");
options.add_options()
("c,compiler", "compiler (hlsl/glsl)", cxxopts::value<std::string>()->default_value("glsl"))
("s,stage", "shader stage (pixel/vertex)", cxxopts::value<std::string>()->default_value("pixel"))
("f,file", "File name", cxxopts::value<std::string>())
("e,entry", "entry function name", cxxopts::value<std::string>()->default_value("main"));
auto optsResult = options.parse(argc, argv);
if (optsResult.count("compiler")) {
std::string cmp = optsResult["compiler"].as<std::string>();
if (cmp == "hlsl")
language = glslang::EShSourceHlsl;
}
if (optsResult.count("entry"))
entry = optsResult["entry"].as<std::string>();
if (optsResult.count("stage")) {
std::string stageValue = optsResult["stage"].as<std::string>();
bool isVertex = stageValue == "vertex" || stageValue == "vert" || stageValue == "vs";
bool isGeometry = stageValue == "geometry" || stageValue == "geom" || stageValue == "gs";
stage = (isVertex ? EShLangVertex : (isGeometry ? EShLangGeometry : EShLangFragment));
}
if (optsResult.count("file"))
filename = optsResult["file"].as<std::string>();
} catch (const cxxopts::OptionException & e) {
std::cout << "error parsing options: " << e.what() << std::endl;
exit(1);
}
if (filename.empty()) {
printf("Please specify a shader file that you would like to debug.\n");
return 0;
}
// start glslang process
bool glslangInit = glslang::InitializeProcess();
if (!glslangInit) {
printf("Failed to initialize glslang");
return 0;
}
// load shader
std::ifstream t(filename);
std::string src((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
t.close();
// compile shader
std::vector<unsigned int> spirv;
bool cres = Compile(spirv, language, stage, src, entry);
if (!cres) {
printf("Failed to compile the shader.\n");
return 0;
}
// spirv-vm initalization
spvm_context_t ctx = spvm_context_initialize();
size_t spv_length = spirv.size();
spvm_source spv = (spvm_source)spirv.data();
// create program & state
spvm_program_t prog = spvm_program_create(ctx, spv, spv_length);
spvm_state_t state = spvm_state_create(prog);
// create GLSL.std.450 extension
spvm_ext_opcode_func* glsl_ext_data = spvm_build_glsl450_ext();
spvm_result_t glsl_std_450 = spvm_state_get_result(state, "GLSL.std.450");
if (glsl_std_450)
glsl_std_450->extension = glsl_ext_data;
// EmitVertex and EndPrimitive
state->emit_vertex = emit_vertex;
state->end_primitive = end_primitive;
// list of all textures used
std::vector<spvm_image> images;
// inputs & uniforms
for (spvm_word i = 0; i < prog->bound; i++) {
spvm_result_t ptrInfo = nullptr;
if (state->results[i].pointer)
ptrInfo = &state->results[state->results[i].pointer];
bool isInput = false;
if (ptrInfo) {
isInput = (ptrInfo->storage_class == SpvStorageClassUniform ||
ptrInfo->storage_class == SpvStorageClassUniformConstant ||
ptrInfo->storage_class == SpvStorageClassInput) &&
ptrInfo->value_type == spvm_value_type_pointer;
}
if (isInput) {
spvm_result_t type_info = spvm_state_get_type_info(state->results, ptrInfo);
// textures
if (ptrInfo->storage_class == SpvStorageClassUniformConstant &&
(type_info->value_type == spvm_value_type_sampled_image ||
type_info->value_type == spvm_value_type_image)) {
printf("Please enter \"%s\" texture file path: ", state->results[i].name);
char filepath[1024];
scanf("%s", filepath);
int width, height, nrChannels;
unsigned char* data = stbi_load(filepath, &width, &height, &nrChannels, 4);
images.push_back(spvm_image());
spvm_image_t img = &images[images.size()-1];
if (data == nullptr) {
printf("Failed to load texture %s! :(\n", filepath);
float imgData[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
spvm_image_create(img, imgData, 1, 1, 1);
} else {
float* imgData = (float*)malloc(sizeof(float) * width * height * 4);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
int index = (x + width * y) * 4;
float* mem = imgData + index;
mem[0] = data[index + 0] / 255.0f;
mem[1] = data[index + 1] / 255.0f;
mem[2] = data[index + 2] / 255.0f;
mem[3] = data[index + 3] / 255.0f;
}
}
spvm_image_create(img, imgData, width, height, 1);
free(imgData);
}
state->results[i].members[0].image_data = img;
stbi_image_free(data);
}
// other variables
else {
std::string prefix = "";
if (state->results[i].name)
prefix = state->results[i].name;
InputVariableValue(state, type_info, state->results[i].members, state->results[i].member_count, prefix);
}
}
}
// get and call main()
spvm_result_t fnMain = spvm_state_get_result(state, "main");
spvm_state_prepare(state, fnMain);
if (state->derivative_used) {
spvm_result_t fragCoord = spvm_state_get_builtin(state, SpvBuiltInFragCoord);
if (fragCoord)
spvm_state_set_frag_coord(state, fragCoord->members[0].value.f, fragCoord->members[1].value.f, fragCoord->members[2].value.f, fragCoord->members[3].value.f);
}
spvm_state_step_into(state);
// split source into lines
std::vector<std::string> srcLines = SplitString(src, "\n");
bool hasStepped = true;
while (state->code_current) {
int curLine = state->current_line-1;
if (hasStepped) {
#ifdef _WIN32
system("cls"); // I know...
#else
system("clear"); // I know...
#endif
int lnBegin = std::max(0, curLine - 5);
int lnEnd = std::min((int)srcLines.size() - 1, curLine + 5);
for (int i = lnBegin; i <= lnEnd; i++) {
if (i == curLine)
printf(">>>> | %s\n", srcLines[i].c_str());
else
printf("%4d | %s\n", i + 1, srcLines[i].c_str());
}
hasStepped = false;
}
if (is_emit_vertex_called) {
printf(">>>>>>> EmitVertex <<<<<<<\n");
PrintAllOutputValues(state);
is_emit_vertex_called = false;
}
if (is_end_primitive_called) {
printf(">>>>>>> EndPrimitive <<<<<<<\n");
is_end_primitive_called = false;
}
printf("> ");
std::string cmd;
std::getline(std::cin, cmd);
std::vector<std::string> tokens = SplitString(cmd, " ");
if (tokens.size() == 0)
continue;
if (tokens[0] == "quit" || tokens[0] == "q")
break;
else if (tokens[0] == "step") {
spvm_state_step_into(state);
hasStepped = true;
}
else if (tokens[0] == "jump") {
if (tokens.size() > 1) {
int lnGoal = std::stoi(tokens[1]);
while (state->code_current && state->current_line != lnGoal)
spvm_state_step_into(state);
hasStepped = true;
}
}
else if (tokens[0] == "get") { // getlocal name
if (tokens.size() > 1) {
spvm_word mem_index = 0, mem_count = 0;
spvm_result_t val = spvm_state_get_local_result(state, state->current_function, (spvm_string)tokens[1].c_str());
if (val == nullptr)
val = spvm_state_get_result(state, (spvm_string)tokens[1].c_str());
if (val == nullptr) { // anon buffer object uniforms
val = spvm_state_get_result(state, "");
bool foundBufferVariable = false;
for (spvm_word i = 0; i < prog->bound; i++) {
if (state->results[i].name) {
if (strcmp(state->results[i].name, "") == 0 && state->results[i].type == spvm_result_type_variable) {
val = &state->results[i];
spvm_result_t buffer_info = spvm_state_get_type_info(state->results, &state->results[val->pointer]);
for (spvm_word i = 0; i < buffer_info->member_name_count; i++) {
if (strcmp(tokens[1].c_str(), buffer_info->member_name[i]) == 0) {
mem_index = i;
mem_count = 1;
foundBufferVariable = true;
break;
}
}
}
}
if (foundBufferVariable) break;
}
} else {
mem_index = 0;
mem_count = val->member_count;
}
if (val && mem_count != 0) {
spvm_result_t type_info = spvm_state_get_type_info(state->results, &state->results[val->pointer]);
OutputVariableValue(state, type_info, &val->members[mem_index], mem_count, "");
}
else printf("Variable \"%s\" doesn't exist.\n", tokens[1].c_str());
}
}
}
// outputs
PrintAllOutputValues(state);
// spirv-vm deinitialization
spvm_state_delete(state);
spvm_program_delete(prog);
free(glsl_ext_data);
spvm_context_deinitialize(ctx);
return 0;
}
const TBuiltInResource DefaultTBuiltInResource = {
/* .MaxLights = */ 32,
/* .MaxClipPlanes = */ 6,
/* .MaxTextureUnits = */ 32,
/* .MaxTextureCoords = */ 32,
/* .MaxVertexAttribs = */ 64,
/* .MaxVertexUniformComponents = */ 4096,
/* .MaxVaryingFloats = */ 64,
/* .MaxVertexTextureImageUnits = */ 32,
/* .MaxCombinedTextureImageUnits = */ 80,
/* .MaxTextureImageUnits = */ 32,
/* .MaxFragmentUniformComponents = */ 4096,
/* .MaxDrawBuffers = */ 32,
/* .MaxVertexUniformVectors = */ 128,
/* .MaxVaryingVectors = */ 8,
/* .MaxFragmentUniformVectors = */ 16,
/* .MaxVertexOutputVectors = */ 16,
/* .MaxFragmentInputVectors = */ 15,
/* .MinProgramTexelOffset = */ -8,
/* .MaxProgramTexelOffset = */ 7,
/* .MaxClipDistances = */ 8,
/* .MaxComputeWorkGroupCountX = */ 65535,
/* .MaxComputeWorkGroupCountY = */ 65535,
/* .MaxComputeWorkGroupCountZ = */ 65535,
/* .MaxComputeWorkGroupSizeX = */ 1024,
/* .MaxComputeWorkGroupSizeY = */ 1024,
/* .MaxComputeWorkGroupSizeZ = */ 64,
/* .MaxComputeUniformComponents = */ 1024,
/* .MaxComputeTextureImageUnits = */ 16,
/* .MaxComputeImageUniforms = */ 8,
/* .MaxComputeAtomicCounters = */ 8,
/* .MaxComputeAtomicCounterBuffers = */ 1,
/* .MaxVaryingComponents = */ 60,
/* .MaxVertexOutputComponents = */ 64,
/* .MaxGeometryInputComponents = */ 64,
/* .MaxGeometryOutputComponents = */ 128,
/* .MaxFragmentInputComponents = */ 128,
/* .MaxImageUnits = */ 8,
/* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
/* .MaxCombinedShaderOutputResources = */ 8,
/* .MaxImageSamples = */ 0,
/* .MaxVertexImageUniforms = */ 0,
/* .MaxTessControlImageUniforms = */ 0,
/* .MaxTessEvaluationImageUniforms = */ 0,
/* .MaxGeometryImageUniforms = */ 0,
/* .MaxFragmentImageUniforms = */ 8,
/* .MaxCombinedImageUniforms = */ 8,
/* .MaxGeometryTextureImageUnits = */ 16,
/* .MaxGeometryOutputVertices = */ 256,
/* .MaxGeometryTotalOutputComponents = */ 1024,
/* .MaxGeometryUniformComponents = */ 1024,
/* .MaxGeometryVaryingComponents = */ 64,
/* .MaxTessControlInputComponents = */ 128,
/* .MaxTessControlOutputComponents = */ 128,
/* .MaxTessControlTextureImageUnits = */ 16,
/* .MaxTessControlUniformComponents = */ 1024,
/* .MaxTessControlTotalOutputComponents = */ 4096,
/* .MaxTessEvaluationInputComponents = */ 128,
/* .MaxTessEvaluationOutputComponents = */ 128,
/* .MaxTessEvaluationTextureImageUnits = */ 16,
/* .MaxTessEvaluationUniformComponents = */ 1024,
/* .MaxTessPatchComponents = */ 120,
/* .MaxPatchVertices = */ 32,
/* .MaxTessGenLevel = */ 64,
/* .MaxViewports = */ 16,
/* .MaxVertexAtomicCounters = */ 0,
/* .MaxTessControlAtomicCounters = */ 0,
/* .MaxTessEvaluationAtomicCounters = */ 0,
/* .MaxGeometryAtomicCounters = */ 0,
/* .MaxFragmentAtomicCounters = */ 8,
/* .MaxCombinedAtomicCounters = */ 8,
/* .MaxAtomicCounterBindings = */ 1,
/* .MaxVertexAtomicCounterBuffers = */ 0,
/* .MaxTessControlAtomicCounterBuffers = */ 0,
/* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
/* .MaxGeometryAtomicCounterBuffers = */ 0,
/* .MaxFragmentAtomicCounterBuffers = */ 1,
/* .MaxCombinedAtomicCounterBuffers = */ 1,
/* .MaxAtomicCounterBufferSize = */ 16384,
/* .MaxTransformFeedbackBuffers = */ 4,
/* .MaxTransformFeedbackInterleavedComponents = */ 64,
/* .MaxCullDistances = */ 8,
/* .MaxCombinedClipAndCullDistances = */ 8,
/* .MaxSamples = */ 4,
/* .maxMeshOutputVerticesNV = */ 256,
/* .maxMeshOutputPrimitivesNV = */ 512,
/* .maxMeshWorkGroupSizeX_NV = */ 32,
/* .maxMeshWorkGroupSizeY_NV = */ 1,
/* .maxMeshWorkGroupSizeZ_NV = */ 1,
/* .maxTaskWorkGroupSizeX_NV = */ 32,
/* .maxTaskWorkGroupSizeY_NV = */ 1,
/* .maxTaskWorkGroupSizeZ_NV = */ 1,
/* .maxMeshViewCountNV = */ 4,
/* .limits = */ {
/* .nonInductiveForLoops = */ 1,
/* .whileLoops = */ 1,
/* .doWhileLoops = */ 1,
/* .generalUniformIndexing = */ 1,
/* .generalAttributeMatrixVectorIndexing = */ 1,
/* .generalVaryingIndexing = */ 1,
/* .generalSamplerIndexing = */ 1,
/* .generalVariableIndexing = */ 1,
/* .generalConstantMatrixVectorIndexing = */ 1,
}
};
bool Compile(std::vector<unsigned int>& outSPV, glslang::EShSource inLang, EShLanguage shaderType, const std::string& source, const std::string& entry)
{
const char* inputStr = source.c_str();
glslang::TShader shader(shaderType);
if (entry.size() > 0 && entry != "main") {
shader.setEntryPoint(entry.c_str());
shader.setSourceEntryPoint(entry.c_str());
}
shader.setStrings(&inputStr, 1);
// set up
int sVersion = (shaderType == EShLanguage::EShLangCompute) ? 430 : 330;
glslang::EShTargetClientVersion vulkanVersion = glslang::EShTargetClientVersion::EShTargetOpenGL_450;
glslang::EShTargetLanguageVersion targetVersion = glslang::EShTargetLanguageVersion::EShTargetSpv_1_0;
shader.setEnvInput(inLang, shaderType, glslang::EShClientOpenGL, sVersion);
shader.setEnvClient(glslang::EShClientOpenGL, vulkanVersion);
shader.setEnvTarget(glslang::EShTargetSpv, targetVersion);
shader.setAutoMapLocations(true);
TBuiltInResource res = DefaultTBuiltInResource;
EShMessages messages = (EShMessages)(EShMsgSpvRules);
const int defVersion = sVersion;
std::string processedShader;
DirStackFileIncluder includer;
if (!shader.preprocess(&res, defVersion, ENoProfile, false, false, messages, &processedShader, includer)) {
printf("%s\n", shader.getInfoLog());
return false;
}
// update strings
const char* processedStr = processedShader.c_str();
shader.setStrings(&processedStr, 1);
// parse
if (!shader.parse(&res, 100, false, messages)) {
printf("%s\n", shader.getInfoLog());
return false;
}
// link
glslang::TProgram prog;
prog.addShader(&shader);
if (!prog.link(messages)) {
printf("%s\n", shader.getInfoLog());
return false;
}
// convert to spirv
spv::SpvBuildLogger logger;
glslang::SpvOptions spvOptions;
spvOptions.optimizeSize = false;
spvOptions.disableOptimizer = true;
spvOptions.generateDebugInfo = true;
glslang::GlslangToSpv(*prog.getIntermediate(shaderType), outSPV, &logger, &spvOptions);
return true;
}