Skip to content

Commit

Permalink
Vulkan: Fix non-vbo lightdir buffer offset & merge latest changes fro…
Browse files Browse the repository at this point in the history
…m inspector
  • Loading branch information
JKSunny committed Oct 15, 2024
1 parent 0360229 commit f1cfaf2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion codemp/rd-vulkan/vk_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ typedef struct vk_tess_s {

VkDescriptorSet uniform_descriptor;

VkDeviceSize buf_offset[9];
VkDeviceSize buf_offset[12]; // 10 is ok, bones & weights are ghoul2 vbo only anyway
VkDeviceSize vbo_offset[12];

VkBuffer curr_index_buffer;
Expand Down
14 changes: 7 additions & 7 deletions codemp/rd-vulkan/vk_shade_geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2415,6 +2415,8 @@ void RB_StageIteratorGeneric( void )
pipeline = pStage->vk_pipeline[fog_stage];
}

Com_Memset( &def, 0, sizeof(Vk_Pipeline_Def) );

// for 2D flipped images
if ( backEnd.projection2D ) {
if ( !pStage->vk_2d_pipeline ) {
Expand All @@ -2426,7 +2428,6 @@ void RB_StageIteratorGeneric( void )
tess.xstages[stage]->vk_2d_pipeline = vk_find_pipeline_ext(0, &def, qfalse);
}


pipeline = pStage->vk_2d_pipeline;
}
else if ( backEnd.currentEntity ) {
Expand Down Expand Up @@ -2467,7 +2468,8 @@ void RB_StageIteratorGeneric( void )
def.vbo_ghoul2 = is_ghoul2_vbo;
def.vbo_mdv = is_mdv_vbo;

if ( !tess.vbo_world_index && !tess.vbo_model_index )
// sunny forgot why this is here.. @!&!%!
if ( backEnd.currentEntity != &tr.worldEntity && !tess.vbo_model_index )
def.vk_light_flags = 0;

pipeline = vk_find_pipeline_ext( 0, &def, qfalse );
Expand All @@ -2489,7 +2491,9 @@ void RB_StageIteratorGeneric( void )

// removed glow handling statement, this results in unnecessary glow pass binds?
{
if ( tess.vbo_world_index || tess.vbo_model_index )
qboolean has_cubemap = ( !vk.useFastLight && tr.numCubemaps && tess.cubemapIndex > 0) ? qtrue : qfalse;

if ( def.vk_light_flags )
vk_update_pbr_descriptor(6, vk.brdflut_image_descriptor);

if ( pStage->vk_pbr_flags & PBR_HAS_NORMALMAP )
Expand All @@ -2509,8 +2513,6 @@ void RB_StageIteratorGeneric( void )
uniform_global.specularScale[1] = 0.5f;
}

qboolean has_cubemap = ( !vk.useFastLight && tr.numCubemaps && tess.cubemapIndex > 0) ? qtrue : qfalse;

if ( !has_cubemap || backEnd.viewParms.targetCube != nullptr )
vk_update_pbr_descriptor(9, tr.emptyCubemap->descriptor_set);
else
Expand Down Expand Up @@ -2558,11 +2560,9 @@ void RB_StageIteratorGeneric( void )
item.reset_uniform = qfalse;
}


vk_push_uniform_global( &uniform_global );
}


RB_AddDrawItemIndexBinding( item );
RB_AddDrawItemVertexBinding( item );
RB_AddDrawItemUniformBinding( item, backEnd.currentEntity );
Expand Down

0 comments on commit f1cfaf2

Please sign in to comment.