Skip to content

Commit 04d99c6

Browse files
committed
WIP
1 parent 15c8e2f commit 04d99c6

File tree

9 files changed

+2266
-1403
lines changed

9 files changed

+2266
-1403
lines changed

extensions/pl_graphics_ext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,7 @@ typedef struct _plComputeShaderDesc
818818
plBindGroupLayoutDesc atBindGroupLayouts[3];
819819
plSpecializationConstant atConstants[PL_MAX_SHADER_SPECIALIZATION_CONSTANTS];
820820
const void* pTempConstantData;
821+
const char* pcDebugName; // default: "unnamed compute shader"
821822

822823
// [INTERNAL]
823824
uint32_t _uConstantCount;
@@ -894,6 +895,7 @@ typedef struct _plShaderDesc
894895
plBindGroupLayoutDesc atBindGroupLayouts[3];
895896
plRenderPassLayoutHandle tRenderPassLayout;
896897
plSampleCount tMSAASampleCount;
898+
const char* pcDebugName; // default: "unnamed shader"
897899

898900
// [INTERNAL]
899901
uint32_t _uConstantCount;

extensions/pl_graphics_vulkan.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,9 @@ pl_create_compute_shader(plDevice* ptDevice, const plComputeShaderDesc* ptDescri
13561356
plComputeShaderHandle tHandle = pl__get_new_compute_shader_handle(ptDevice);
13571357
plComputeShader* ptShader = pl__get_compute_shader(ptDevice, tHandle);
13581358
ptShader->tDesc = *ptDescription;
1359+
1360+
if(ptShader->tDesc.pcDebugName == NULL)
1361+
ptShader->tDesc.pcDebugName = "unnamed compute shader";
13591362

13601363
plVulkanComputeShader* ptVulkanShader = &ptDevice->sbtComputeShadersHot[tHandle.uIndex];
13611364

@@ -1437,7 +1440,7 @@ pl_create_compute_shader(plDevice* ptDevice, const plComputeShaderDesc* ptDescri
14371440
.stage = tShaderStage
14381441
};
14391442
PL_VULKAN(vkCreateComputePipelines(ptDevice->tLogicalDevice, VK_NULL_HANDLE, 1, &tPipelineCreateInfo, gptGraphics->ptAllocationCallbacks, &ptVulkanShader->tPipeline));
1440-
1443+
pl__set_vulkan_object_name(ptDevice, (uint64_t)ptVulkanShader->tPipeline, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, ptShader->tDesc.pcDebugName);
14411444
return tHandle;
14421445
}
14431446

@@ -1449,6 +1452,9 @@ pl_create_shader(plDevice* ptDevice, const plShaderDesc* ptDescription)
14491452
ptShader->tDesc = *ptDescription;
14501453
uint32_t uStageCount = 1;
14511454

1455+
if(ptShader->tDesc.pcDebugName == NULL)
1456+
ptShader->tDesc.pcDebugName = "unnamed shader";
1457+
14521458
plVulkanShader* ptVulkanShader = &ptDevice->sbtShadersHot[tHandle.uIndex];
14531459

14541460
// TODO: handle these properly
@@ -1705,6 +1711,7 @@ pl_create_shader(plDevice* ptDevice, const plShaderDesc* ptDescription)
17051711
};
17061712

17071713
PL_VULKAN(vkCreateGraphicsPipelines(ptDevice->tLogicalDevice, VK_NULL_HANDLE, 1, &tPipelineInfo, gptGraphics->ptAllocationCallbacks, &tVulkanShader.tPipeline));
1714+
pl__set_vulkan_object_name(ptDevice, (uint64_t)tVulkanShader.tPipeline, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, ptShader->tDesc.pcDebugName);
17081715
ptVulkanShader->tPipeline = tVulkanShader.tPipeline;
17091716
ptVulkanShader->tPipelineLayout = tVulkanShader.tPipelineLayout;
17101717
return tHandle;

extensions/pl_renderer_ext.c

Lines changed: 48 additions & 637 deletions
Large diffs are not rendered by default.

extensions/pl_renderer_internal.c

Lines changed: 40 additions & 460 deletions
Large diffs are not rendered by default.

extensions/pl_renderer_internal.h

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,6 @@ typedef struct _plScene
526526
bool bActive;
527527
plShaderHandle tLightingShader;
528528
plShaderHandle tEnvLightingShader;
529-
plShaderHandle tTonemapShader;
530529

531530
// skybox resources (optional)
532531
plDrawable tSkyboxDrawable;
@@ -653,35 +652,8 @@ typedef struct _plRefRendererData
653652
plRenderPassLayoutHandle tPickRenderPassLayout;
654653

655654
// bind group layouts
656-
plBindGroupLayoutHandle tGlobalSceneBindGroupLayout;
657-
plBindGroupLayoutHandle tLightingViewBindGroupLayout;
658-
plBindGroupLayoutHandle tPickViewBindGroupLayout;
659-
plBindGroupLayoutHandle tSkyboxComputeBindGroupLayout;
660-
plBindGroupLayoutHandle tSkyboxBindGroupLayout;
661-
plBindGroupLayoutHandle tSkyboxBG0Layout;
662-
plBindGroupLayoutHandle tSkyboxBG1Layout;
663-
plBindGroupLayoutHandle tDeferredBG1Layout;
664655
plBindGroupLayoutHandle tSceneBGLayout;
665-
plBindGroupLayoutHandle tPickBG0Layout;
666-
plBindGroupLayoutHandle tJFABGLayout;
667656
plBindGroupLayoutHandle tShadowGlobalBGLayout;
668-
plBindGroupLayoutHandle tOutlineBGLayout;
669-
plBindGroupLayoutHandle tSkinBGLayout;
670-
plBindGroupLayoutHandle tSkin2BGLayout;
671-
plBindGroupLayoutHandle tEnvBGLayout;
672-
673-
// shader templates (variants are made from these)
674-
plShaderHandle tShadowShader;
675-
plShaderHandle tAlphaShadowShader;
676-
plShaderHandle tDeferredShader;
677-
plShaderHandle tForwardShader;
678-
plShaderHandle tSkyboxShader;
679-
plShaderHandle tPickShader;
680-
plComputeShaderHandle tEnvFilterShader;
681-
682-
// outline shaders
683-
plShaderHandle tUVShader;
684-
plComputeShaderHandle tJFAShader;
685657

686658
// renderer specific log channel
687659
uint64_t uLogChannel;
@@ -782,7 +754,6 @@ static void pl__renderer_post_process_scene(plCommandBuffer*, plView*, const plM
782754
static inline plDynamicBinding pl__allocate_dynamic_data(plDevice* ptDevice){ return pl_allocate_dynamic_data(gptGfx, gptData->ptDevice, &gptData->tCurrentDynamicDataBlock);}
783755
static void pl__renderer_add_drawable_skin_data_to_global_buffers(plScene*, uint32_t uDrawableIndex);
784756
static void pl__renderer_add_drawable_data_to_global_buffer(plScene*, uint32_t uDrawableIndex);
785-
static void pl__renderer_create_global_shaders(void);
786757
static size_t pl__renderer_get_data_type_size2(plDataType tType);
787758
static plBlendState pl__renderer_get_blend_state(plBlendMode tBlendMode);
788759
static uint32_t pl__renderer_get_bindless_texture_index(plScene*, plTextureHandle);

0 commit comments

Comments
 (0)