mirror of https://github.com/bjornbytes/lovr.git
Add shader debug info when t.graphics.debug is set;
This commit is contained in:
parent
edb65a7578
commit
6a030ef4f2
|
@ -620,6 +620,7 @@ typedef struct {
|
|||
bool depthResolve;
|
||||
bool indirectDrawFirstInstance;
|
||||
bool shaderTally;
|
||||
bool shaderDebug;
|
||||
bool float64;
|
||||
bool int64;
|
||||
bool int16;
|
||||
|
|
|
@ -175,6 +175,7 @@ typedef struct {
|
|||
bool portability;
|
||||
bool validation;
|
||||
bool debug;
|
||||
bool shaderDebug;
|
||||
bool colorspace;
|
||||
bool depthResolve;
|
||||
} gpu_extensions;
|
||||
|
@ -2143,7 +2144,8 @@ bool gpu_init(gpu_config* config) {
|
|||
{ "VK_KHR_create_renderpass2", true, NULL },
|
||||
{ "VK_KHR_swapchain", state.config.vk.surface, NULL },
|
||||
{ "VK_KHR_portability_subset", true, &state.extensions.portability },
|
||||
{ "VK_KHR_depth_stencil_resolve", true, &state.extensions.depthResolve }
|
||||
{ "VK_KHR_depth_stencil_resolve", true, &state.extensions.depthResolve },
|
||||
{ "VK_KHR_shader_non_semantic_info", state.config.debug, &state.extensions.shaderDebug }
|
||||
};
|
||||
|
||||
VkExtensionProperties extensionInfo[512];
|
||||
|
@ -2165,6 +2167,7 @@ bool gpu_init(gpu_config* config) {
|
|||
|
||||
if (config->features) {
|
||||
config->features->depthResolve = state.extensions.depthResolve;
|
||||
config->features->shaderDebug = state.extensions.shaderDebug;
|
||||
}
|
||||
|
||||
VkDeviceCreateInfo deviceInfo = {
|
||||
|
|
|
@ -1674,7 +1674,16 @@ ShaderSource lovrGraphicsCompileShader(ShaderStage stage, ShaderSource* source)
|
|||
|
||||
glslang_program_map_io(program);
|
||||
|
||||
glslang_program_SPIRV_generate(program, stages[stage]);
|
||||
glslang_spv_options_t spvOptions = { 0 };
|
||||
|
||||
if (state.config.debug && state.features.shaderDebug) {
|
||||
spvOptions.generate_debug_info = true;
|
||||
spvOptions.emit_nonsemantic_shader_debug_info = true;
|
||||
spvOptions.emit_nonsemantic_shader_debug_source = true;
|
||||
glslang_program_add_source_text(program, stages[stage], source->code, source->size);
|
||||
}
|
||||
|
||||
glslang_program_SPIRV_generate_with_options(program, stages[stage], &spvOptions);
|
||||
|
||||
void* words = glslang_program_SPIRV_get_ptr(program);
|
||||
size_t size = glslang_program_SPIRV_get_size(program) * 4;
|
||||
|
|
Loading…
Reference in New Issue