Skip to content

Commit

Permalink
MVKDevice: Add debug labels to barrier fences.
Browse files Browse the repository at this point in the history
  • Loading branch information
js6i committed Dec 17, 2024
1 parent 0464099 commit 81e8c23
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4792,6 +4792,16 @@ static uint32_t mvkGetEntryProperty(io_registry_entry_t entry, CFStringRef prope

#pragma mark Construction

static NSString *mvkBarrierStageName(MVKBarrierStage stage) {
switch (stage) {
case kMVKBarrierStageVertex: return @"Vertex";
case kMVKBarrierStageFragment: return @"Fragment";
case kMVKBarrierStageCompute: return @"Compute";
case kMVKBarrierStageCopy: return @"Copy";
default: return [NSString stringWithFormat:@"Invalid (%d)", stage];
}
}

MVKDevice::MVKDevice(MVKPhysicalDevice* physicalDevice, const VkDeviceCreateInfo* pCreateInfo) : _enabledExtensions(this) {

// If the physical device is lost, bail.
Expand All @@ -4809,7 +4819,15 @@ static uint32_t mvkGetEntryProperty(io_registry_entry_t entry, CFStringRef prope
reservePrivateData(pCreateInfo);

// Initialize fences for execution barriers
for (auto &stage: _barrierFences) for (auto &fence: stage) fence = [_physicalDevice->getMTLDevice() newFence];
@autoreleasepool {
for (int stage = 0; stage < kMVKBarrierStageCount; ++stage) {
for (int index = 0; index < kMVKBarrierFenceCount; ++index) {
auto &fence = _barrierFences[stage][index];
fence = [_physicalDevice->getMTLDevice() newFence];
[fence setLabel:[NSString stringWithFormat:@"%@ Fence %d", mvkBarrierStageName((MVKBarrierStage)stage), index]];
}
}
}

#if MVK_MACOS
// After enableExtensions
Expand Down

0 comments on commit 81e8c23

Please sign in to comment.