summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2025-01-05 22:15:22 +1100
committerquou <quou@disroot.org>2025-01-05 22:15:22 +1100
commitbce070eba418c8a79f6affcd885564babbf8c9d3 (patch)
tree70fd5b4a57091cb5d6c4b47c1b29c98ba7b54062
parent925a2707c1f2d0f5e256f6e70050b7b2242d99e8 (diff)
source level shader debugging
-rw-r--r--glad_vk.h14
m---------sc/glslang0
-rw-r--r--sc/sc.cpp16
-rw-r--r--video.cpp5
4 files changed, 29 insertions, 6 deletions
diff --git a/glad_vk.h b/glad_vk.h
index 0f25c4d..d4eed80 100644
--- a/glad_vk.h
+++ b/glad_vk.h
@@ -1,11 +1,11 @@
/**
- * Loader generated by glad 2.0.8 on Mon Dec 23 05:21:50 2024
+ * Loader generated by glad 2.0.8 on Sun Jan 5 09:10:11 2025
*
* SPDX-License-Identifier: (WTFPL OR CC0-1.0) AND Apache-2.0
*
* Generator: C/C++
* Specification: vk
- * Extensions: 7
+ * Extensions: 8
*
* APIs:
* - vulkan=1.0
@@ -19,10 +19,10 @@
* - ON_DEMAND = False
*
* Commandline:
- * --api='vulkan=1.0' --extensions='VK_EXT_custom_border_color,VK_EXT_debug_utils,VK_KHR_get_physical_device_properties2,VK_KHR_surface,VK_KHR_swapchain,VK_KHR_win32_surface,VK_KHR_xlib_surface' c --header-only --loader
+ * --api='vulkan=1.0' --extensions='VK_EXT_custom_border_color,VK_EXT_debug_utils,VK_KHR_get_physical_device_properties2,VK_KHR_shader_non_semantic_info,VK_KHR_surface,VK_KHR_swapchain,VK_KHR_win32_surface,VK_KHR_xlib_surface' c --header-only --loader
*
* Online:
- * http://glad.sh/#api=vulkan%3D1.0&extensions=VK_EXT_custom_border_color%2CVK_EXT_debug_utils%2CVK_KHR_get_physical_device_properties2%2CVK_KHR_surface%2CVK_KHR_swapchain%2CVK_KHR_win32_surface%2CVK_KHR_xlib_surface&generator=c&options=HEADER_ONLY%2CLOADER
+ * http://glad.sh/#api=vulkan%3D1.0&extensions=VK_EXT_custom_border_color%2CVK_EXT_debug_utils%2CVK_KHR_get_physical_device_properties2%2CVK_KHR_shader_non_semantic_info%2CVK_KHR_surface%2CVK_KHR_swapchain%2CVK_KHR_win32_surface%2CVK_KHR_xlib_surface&generator=c&options=HEADER_ONLY%2CLOADER
*
*/
@@ -172,6 +172,8 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro
#define VK_FALSE 0
#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2"
#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 2
+#define VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME "VK_KHR_shader_non_semantic_info"
+#define VK_KHR_SHADER_NON_SEMANTIC_INFO_SPEC_VERSION 1
#define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface"
#define VK_KHR_SURFACE_SPEC_VERSION 25
#define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain"
@@ -2789,6 +2791,8 @@ GLAD_API_CALL int GLAD_VK_EXT_custom_border_color;
GLAD_API_CALL int GLAD_VK_EXT_debug_utils;
#define VK_KHR_get_physical_device_properties2 1
GLAD_API_CALL int GLAD_VK_KHR_get_physical_device_properties2;
+#define VK_KHR_shader_non_semantic_info 1
+GLAD_API_CALL int GLAD_VK_KHR_shader_non_semantic_info;
#define VK_KHR_surface 1
GLAD_API_CALL int GLAD_VK_KHR_surface;
#define VK_KHR_swapchain 1
@@ -3402,6 +3406,7 @@ int GLAD_VK_VERSION_1_0 = 0;
int GLAD_VK_EXT_custom_border_color = 0;
int GLAD_VK_EXT_debug_utils = 0;
int GLAD_VK_KHR_get_physical_device_properties2 = 0;
+int GLAD_VK_KHR_shader_non_semantic_info = 0;
int GLAD_VK_KHR_surface = 0;
int GLAD_VK_KHR_swapchain = 0;
#if defined(VK_USE_PLATFORM_WIN32_KHR)
@@ -3935,6 +3940,7 @@ static int glad_vk_find_extensions_vulkan( VkPhysicalDevice physical_device) {
GLAD_VK_EXT_custom_border_color = glad_vk_has_extension("VK_EXT_custom_border_color", extension_count, extensions);
GLAD_VK_EXT_debug_utils = glad_vk_has_extension("VK_EXT_debug_utils", extension_count, extensions);
GLAD_VK_KHR_get_physical_device_properties2 = glad_vk_has_extension("VK_KHR_get_physical_device_properties2", extension_count, extensions);
+ GLAD_VK_KHR_shader_non_semantic_info = glad_vk_has_extension("VK_KHR_shader_non_semantic_info", extension_count, extensions);
GLAD_VK_KHR_surface = glad_vk_has_extension("VK_KHR_surface", extension_count, extensions);
GLAD_VK_KHR_swapchain = glad_vk_has_extension("VK_KHR_swapchain", extension_count, extensions);
#if defined(VK_USE_PLATFORM_WIN32_KHR)
diff --git a/sc/glslang b/sc/glslang
-Subproject 1062752a891c95b2bfeed9e356562d88f9df84a
+Subproject f754c852a87988eb097a39480c65f704ceb4627
diff --git a/sc/sc.cpp b/sc/sc.cpp
index 2bd1406..de39187 100644
--- a/sc/sc.cpp
+++ b/sc/sc.cpp
@@ -508,6 +508,7 @@ struct Desc {
std::vector<uint32_t> compile_shader(
Desc& d,
+ const char* fname,
const char* presrc,
const char* src,
const char* define,
@@ -532,6 +533,9 @@ std::vector<uint32_t> compile_shader(
#ifdef DEBUG
options.disableOptimizer = true;
options.generateDebugInfo = true;
+ options.emitNonSemanticShaderDebugInfo = true;
+ options.emitNonSemanticShaderDebugSource = true;
+ options.stripDebugInfo = false;
#else
options.disableOptimizer = false;
options.stripDebugInfo = true;
@@ -541,6 +545,14 @@ std::vector<uint32_t> compile_shader(
shader.setEnvClient(glslang::EShClientVulkan, client_version);
shader.setEnvTarget(glslang::EShTargetSpv, target_version);
shader.setEntryPoint(d.entrypoints[stage].c_str());
+#ifdef DEBUG
+ shader.setDebugInfo(true);
+ shader.setSourceEntryPoint(d.entrypoints[stage].c_str());
+ shader.setSourceFile(fname);
+ shader.addSourceText(src, strlen(src));
+#else
+ (void)fname;
+#endif
if (!shader.preprocess(
GetDefaultResources(),
glsl_version,
@@ -599,6 +611,7 @@ void configure(
}
void compile_shaders(
+ const char* fname,
std::vector<uint32_t>* spv,
const char* src,
Desc& d
@@ -612,6 +625,7 @@ void compile_shaders(
configure(d, i, define, lang, ps);
spv[i] = compile_shader(
d,
+ fname,
ps.c_str(),
src,
define,
@@ -718,7 +732,7 @@ int main(int argc, const char** argv) {
desc_src = get_desc(src);
cdesc = parse_desc(dp_mem, desc_src.c_str());
desc.build(cdesc);
- compile_shaders(spv, src, desc);
+ compile_shaders(argv[2], spv, src, desc);
write_csh(argv[2], desc, spv);
return 0;
}
diff --git a/video.cpp b/video.cpp
index ef724bf..f619643 100644
--- a/video.cpp
+++ b/video.cpp
@@ -43,7 +43,10 @@ extern "C" {
const char* device_exts[] = {
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
- VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME
+ VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME,
+#ifdef DEBUG
+ VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME
+#endif
};
extern "C" {