vk: add `surfhash` argument to `rt_debug_display_only`

Allows highlighting all the surfaces with random colors to easily see
the surfaces structure and boundaries.

Fixes #635
This commit is contained in:
Ivan Avdeev 2023-11-03 12:05:36 -04:00
parent 28eec97cbf
commit 3a7d047f09
4 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,7 @@
# 2023-11-03 E324 # 2023-11-03 E324
- [x] add cvar for displaying only specified channel - [x] add cvar for displaying only specified channel
- [ ] r_lightmap - [x] r_lightmap
- [x] hightlight all surfaces with random colors
- [ ] massage shaders: consolidate all bindings explicitly - [ ] massage shaders: consolidate all bindings explicitly
- [ ] skip sorting-by-texture when loading brush models ~~(=> geometry count explosion; i.e. kusochki count will explode too)~~ - [ ] skip sorting-by-texture when loading brush models ~~(=> geometry count explosion; i.e. kusochki count will explode too)~~
- [ ] kusochki-vs-materials structures - [ ] kusochki-vs-materials structures

View File

@ -175,6 +175,7 @@ struct PushConstants {
#define DEBUG_DISPLAY_NSHADE 4 #define DEBUG_DISPLAY_NSHADE 4
#define DEBUG_DISPLAY_NGEOM 5 #define DEBUG_DISPLAY_NGEOM 5
#define DEBUG_DISPLAY_LIGHTING 6 #define DEBUG_DISPLAY_LIGHTING 6
#define DEBUG_DISPLAY_SURFHASH 7
// add more when needed // add more when needed
struct UniformBuffer { struct UniformBuffer {

View File

@ -8,6 +8,8 @@
#include "rt_geometry.glsl" #include "rt_geometry.glsl"
#include "color_spaces.glsl" #include "color_spaces.glsl"
#include "noise.glsl" // for DEBUG_DISPLAY_SURFHASH
layout(set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES]; layout(set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
layout(set = 0, binding = 2) uniform UBO { UniformBuffer ubo; } ubo; layout(set = 0, binding = 2) uniform UBO { UniformBuffer ubo; } ubo;
layout(set = 0, binding = 7) uniform samplerCube skybox; layout(set = 0, binding = 7) uniform samplerCube skybox;
@ -103,6 +105,11 @@ void primaryRayHit(rayQueryEXT rq, inout RayPayloadPrimary payload) {
payload.base_color_a *= color; payload.base_color_a *= color;
payload.emissive.rgb *= color.rgb; payload.emissive.rgb *= color.rgb;
if (ubo.ubo.debug_display_only == DEBUG_DISPLAY_SURFHASH) {
const uint hash = xxhash32(geom.kusok_index);
payload.emissive.rgb = vec3(0xff & (hash>>16), 0xff & (hash>>8), 0xff & hash) / 255.;
}
} }
#endif // ifndef RAY_PRIMARY_HIT_GLSL_INCLUDED #endif // ifndef RAY_PRIMARY_HIT_GLSL_INCLUDED

View File

@ -163,6 +163,7 @@ static void parseDebugDisplayValue( void ) {
X(EMISSIVE) \ X(EMISSIVE) \
X(NSHADE) \ X(NSHADE) \
X(NGEOM) \ X(NGEOM) \
X(SURFHASH) \
#define X(suffix) \ #define X(suffix) \
if (0 == Q_stricmp(cvalue, #suffix)) { \ if (0 == Q_stricmp(cvalue, #suffix)) { \