diff --git a/src/dawn/native/Toggles.cpp b/src/dawn/native/Toggles.cpp index 8ae66b7951..d16cbf5451 100644 --- a/src/dawn/native/Toggles.cpp +++ b/src/dawn/native/Toggles.cpp @@ -306,9 +306,9 @@ static constexpr ToggleEnumAndInfoList kToggleNameAndInfoList = {{ "integer that is greater than 2^24 or smaller than -2^24). This toggle is also enabled on " "Intel GPUs on Metal backend due to a driver issue on Intel Metal driver.", "https://crbug.com/dawn/537"}}, - {Toggle::MetalUseDummyBlitEncoderForWriteTimestamp, - {"metal_use_dummy_blit_encoder_for_write_timestamp", - "Add dummy blit command to blit encoder when encoding writeTimestamp as workaround on Metal." + {Toggle::MetalUseMockBlitEncoderForWriteTimestamp, + {"metal_use_mock_blit_encoder_for_write_timestamp", + "Add mock blit command to blit encoder when encoding writeTimestamp as workaround on Metal." "This toggle is enabled by default on Metal backend where GPU counters cannot be stored to" "sampleBufferAttachments on empty blit encoder.", "https://crbug.com/dawn/1473"}}, diff --git a/src/dawn/native/Toggles.h b/src/dawn/native/Toggles.h index 8cfc9d4da3..36221ee82f 100644 --- a/src/dawn/native/Toggles.h +++ b/src/dawn/native/Toggles.h @@ -79,7 +79,7 @@ enum class Toggle { D3D12AllocateExtraMemoryFor2DArrayTexture, D3D12UseTempBufferInDepthStencilTextureAndBufferCopyWithNonZeroBufferOffset, ApplyClearBigIntegerColorValueWithDraw, - MetalUseDummyBlitEncoderForWriteTimestamp, + MetalUseMockBlitEncoderForWriteTimestamp, VulkanSplitCommandBufferOnDepthStencilComputeSampleAfterRenderPass, EnumCount, diff --git a/src/dawn/native/metal/CommandBufferMTL.mm b/src/dawn/native/metal/CommandBufferMTL.mm index 2bb83ee1db..91aacbff92 100644 --- a/src/dawn/native/metal/CommandBufferMTL.mm +++ b/src/dawn/native/metal/CommandBufferMTL.mm @@ -342,8 +342,8 @@ void EncodeEmptyBlitEncoderForWriteTimestamp(Device* device, descriptor.sampleBufferAttachments[0].endOfEncoderSampleIndex = NSUInteger(cmd->queryIndex); id blit = commandContext->BeginBlit(descriptor); - if (device->IsToggleEnabled(Toggle::MetalUseDummyBlitEncoderForWriteTimestamp)) { - [blit fillBuffer:device->GetDummyBlitMtlBuffer() range:NSMakeRange(0, 1) value:0]; + if (device->IsToggleEnabled(Toggle::MetalUseMockBlitEncoderForWriteTimestamp)) { + [blit fillBuffer:device->GetMockBlitMtlBuffer() range:NSMakeRange(0, 1) value:0]; } commandContext->EndBlit(); } diff --git a/src/dawn/native/metal/DeviceMTL.h b/src/dawn/native/metal/DeviceMTL.h index f36c22819c..529abb6713 100644 --- a/src/dawn/native/metal/DeviceMTL.h +++ b/src/dawn/native/metal/DeviceMTL.h @@ -82,9 +82,9 @@ class Device final : public DeviceBase { bool UseCounterSamplingAtCommandBoundary() const; bool UseCounterSamplingAtStageBoundary() const; - // Get a MTLBuffer that can be used as a dummy in a no-op blit encoder based on filling this + // Get a MTLBuffer that can be used as a mock in a no-op blit encoder based on filling this // single-byte buffer - id GetDummyBlitMtlBuffer(); + id GetMockBlitMtlBuffer(); void ForceEventualFlushOfCommands() override; @@ -168,7 +168,7 @@ class Device final : public DeviceBase { // Support counter sampling at the begin and end of blit pass, compute pass and render pass's // vertex/fragement stage bool mCounterSamplingAtStageBoundary; - NSPRef> mDummyBlitMtlBuffer; + NSPRef> mMockBlitMtlBuffer; }; } // namespace dawn::native::metal diff --git a/src/dawn/native/metal/DeviceMTL.mm b/src/dawn/native/metal/DeviceMTL.mm index 5073e0c6cd..71d7d5405b 100644 --- a/src/dawn/native/metal/DeviceMTL.mm +++ b/src/dawn/native/metal/DeviceMTL.mm @@ -251,11 +251,11 @@ void Device::InitTogglesFromDriver() { } // TODO(dawn:1473): Metal fails to store GPU counters to sampleBufferAttachments on empty - // encoders on macOS 11.0+, we need to add dummy blit command to blit encoder when encoding + // encoders on macOS 11.0+, we need to add mock blit command to blit encoder when encoding // writeTimestamp as workaround by enabling the toggle - // "metal_use_dummy_blit_encoder_for_write_timestamp". + // "metal_use_mock_blit_encoder_for_write_timestamp". if (@available(macos 11.0, iOS 14.0, *)) { - SetToggle(Toggle::MetalUseDummyBlitEncoderForWriteTimestamp, true); + SetToggle(Toggle::MetalUseMockBlitEncoderForWriteTimestamp, true); } } @@ -558,7 +558,7 @@ void Device::DestroyImpl() { mCommandQueue = nullptr; mMtlDevice = nullptr; - mDummyBlitMtlBuffer = nullptr; + mMockBlitMtlBuffer = nullptr; } uint32_t Device::GetOptimalBytesPerRowAlignment() const { @@ -581,13 +581,13 @@ bool Device::UseCounterSamplingAtStageBoundary() const { return mCounterSamplingAtStageBoundary; } -id Device::GetDummyBlitMtlBuffer() { - if (mDummyBlitMtlBuffer == nullptr) { - mDummyBlitMtlBuffer.Acquire( +id Device::GetMockBlitMtlBuffer() { + if (mMockBlitMtlBuffer == nullptr) { + mMockBlitMtlBuffer.Acquire( [GetMTLDevice() newBufferWithLength:1 options:MTLResourceStorageModePrivate]); } - return mDummyBlitMtlBuffer.Get(); + return mMockBlitMtlBuffer.Get(); } } // namespace dawn::native::metal