rtx: add r_lightmap cvar, fix #75

This commit is contained in:
Ivan Avdeev 2021-11-02 10:14:28 -07:00 committed by Ivan Avdeev
parent 54e549d726
commit f14b01f195
5 changed files with 7 additions and 1 deletions

View File

@ -87,7 +87,7 @@ void main() {
const vec4 uv_lods = UVDerivsFromRayCone(gl_WorldRayDirectionEXT, normal, ray_cone_width, uvs, pos, matWorldRotation);
const vec4 tex_color = textureGrad(textures[nonuniformEXT(tex_index)], texture_uv, uv_lods.xy, uv_lods.zw);
//const vec3 base_color = pow(tex_color.rgb, vec3(2.));
const vec3 base_color = tex_color.rgb;// pow(tex_color.rgb, vec3(2.));
const vec3 base_color = ((push_constants.flags & PUSH_FLAG_LIGHTMAP_ONLY) != 0) ? vec3(1.) : tex_color.rgb;// pow(tex_color.rgb, vec3(2.));
/* tex_color = pow(tex_color, vec4(2.)); */
/* const vec3 base_color = tex_color.rgb; */

View File

@ -84,6 +84,8 @@ struct LightCluster {
uint8_t emissive_surfaces[MAX_VISIBLE_SURFACE_LIGHTS];
};
#define PUSH_FLAG_LIGHTMAP_ONLY 0x01
struct PushConstants {
float time;
uint random_seed;
@ -91,6 +93,7 @@ struct PushConstants {
float prev_frame_blend_factor;
float pixel_cone_spread_angle;
uint debug_light_index_begin, debug_light_index_end;
uint flags;
};
#undef PAD

View File

@ -17,4 +17,5 @@ void VK_LoadCvars( void )
vk_rtx_light_begin = gEngine.Cvar_Get( "vk_rtx_light_begin", "0", 0, "DEBUG: disable lights with index lower than this");
vk_rtx_light_end = gEngine.Cvar_Get( "vk_rtx_light_end", "0", 0, "DEBUG: disable lights with index higher than this ");
r_lightmap = gEngine.Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" );
}

View File

@ -13,6 +13,7 @@ void VK_LoadCvars( void );
X(vk_rtx_prev_frame_blend_factor) \
X(vk_rtx_light_begin) \
X(vk_rtx_light_end) \
X(r_lightmap) \
#define EXTERN_CVAR(cvar) extern cvar_t *cvar;
DECLARE_CVAR(EXTERN_CVAR)

View File

@ -672,6 +672,7 @@ static qboolean rayTrace( VkCommandBuffer cmdbuf, VkImage frame_dst, float fov_a
.pixel_cone_spread_angle = atanf((2.0f*tanf(fov_angle_y * 0.5f)) / (float)FRAME_HEIGHT),
.debug_light_index_begin = (uint32_t)(vk_rtx_light_begin->value),
.debug_light_index_end = (uint32_t)(vk_rtx_light_end->value),
.flags = r_lightmap->value ? PUSH_FLAG_LIGHTMAP_ONLY : 0,
};
vkCmdPushConstants(cmdbuf, g_rtx.descriptors.pipeline_layout, VK_SHADER_STAGE_RAYGEN_BIT_KHR | VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR | VK_SHADER_STAGE_ANY_HIT_BIT_KHR, 0, sizeof(push_constants), &push_constants);
}