D3D: remove dead code used by the old external image API
Bug: chromium:335003893
Change-Id: I3815323c08796db031107fb2d3dcc562c8148a28
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/226494
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
diff --git a/src/dawn/native/BUILD.gn b/src/dawn/native/BUILD.gn
index adc0b0e..d48f1d7 100644
--- a/src/dawn/native/BUILD.gn
+++ b/src/dawn/native/BUILD.gn
@@ -475,8 +475,6 @@
"d3d/SharedTextureMemoryD3D.h",
"d3d/SwapChainD3D.cpp",
"d3d/SwapChainD3D.h",
- "d3d/TextureD3D.cpp",
- "d3d/TextureD3D.h",
"d3d/UtilsD3D.cpp",
"d3d/UtilsD3D.h",
"d3d/d3d_platform.h",
diff --git a/src/dawn/native/CMakeLists.txt b/src/dawn/native/CMakeLists.txt
index e9ec574..0bb33f7 100644
--- a/src/dawn/native/CMakeLists.txt
+++ b/src/dawn/native/CMakeLists.txt
@@ -319,7 +319,6 @@
"d3d/SharedFenceD3D.h"
"d3d/SharedTextureMemoryD3D.h"
"d3d/SwapChainD3D.h"
- "d3d/TextureD3D.h"
"d3d/UtilsD3D.h"
)
list(APPEND sources
@@ -335,7 +334,6 @@
"d3d/SharedFenceD3D.cpp"
"d3d/SharedTextureMemoryD3D.cpp"
"d3d/SwapChainD3D.cpp"
- "d3d/TextureD3D.cpp"
"d3d/UtilsD3D.cpp"
)
list(APPEND conditional_private_platform_depends dxguid.lib)
diff --git a/src/dawn/native/d3d/TextureD3D.cpp b/src/dawn/native/d3d/TextureD3D.cpp
deleted file mode 100644
index 206d703..0000000
--- a/src/dawn/native/d3d/TextureD3D.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2023 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "dawn/native/d3d/TextureD3D.h"
-
-namespace dawn::native::d3d {
-
-Texture::~Texture() = default;
-
-} // namespace dawn::native::d3d
diff --git a/src/dawn/native/d3d/TextureD3D.h b/src/dawn/native/d3d/TextureD3D.h
deleted file mode 100644
index 3b91e12..0000000
--- a/src/dawn/native/d3d/TextureD3D.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2023 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef SRC_DAWN_NATIVE_D3D_TEXTURED3D_H_
-#define SRC_DAWN_NATIVE_D3D_TEXTURED3D_H_
-
-#include "dawn/native/Error.h"
-#include "dawn/native/IntegerTypes.h"
-#include "dawn/native/Texture.h"
-
-namespace dawn::native::d3d {
-
-class Texture : public TextureBase {
- public:
- virtual ResultOrError<ExecutionSerial> EndAccess() = 0;
-
- protected:
- using TextureBase::TextureBase;
- ~Texture() override;
-};
-
-} // namespace dawn::native::d3d
-
-#endif // SRC_DAWN_NATIVE_D3D_TEXTURED3D_H_
diff --git a/src/dawn/native/d3d11/TextureD3D11.cpp b/src/dawn/native/d3d11/TextureD3D11.cpp
index 9e70da5..433fadb 100644
--- a/src/dawn/native/d3d11/TextureD3D11.cpp
+++ b/src/dawn/native/d3d11/TextureD3D11.cpp
@@ -1074,18 +1074,6 @@
return {};
}
-ResultOrError<ExecutionSerial> Texture::EndAccess() {
- // TODO(dawn:1705): submit pending commands if deferred context is used.
- if (mLastSharedTextureMemoryUsageSerial != kBeginningOfGPUTime) {
- // Make the queue signal the fence in finite time.
- DAWN_TRY(
- GetDevice()->GetQueue()->EnsureCommandsFlushed(mLastSharedTextureMemoryUsageSerial));
- }
- ExecutionSerial ret = mLastSharedTextureMemoryUsageSerial;
- mLastSharedTextureMemoryUsageSerial = kBeginningOfGPUTime;
- return ret;
-}
-
ResultOrError<ComPtr<ID3D11ShaderResourceView>> Texture::GetStencilSRV(
const ScopedCommandRecordingContext* commandContext,
const TextureView* view) {
diff --git a/src/dawn/native/d3d11/TextureD3D11.h b/src/dawn/native/d3d11/TextureD3D11.h
index b008fe0..3f9b21f 100644
--- a/src/dawn/native/d3d11/TextureD3D11.h
+++ b/src/dawn/native/d3d11/TextureD3D11.h
@@ -34,7 +34,7 @@
#include "dawn/native/Error.h"
#include "dawn/native/IntegerTypes.h"
#include "dawn/native/PassResourceUsage.h"
-#include "dawn/native/d3d/TextureD3D.h"
+#include "dawn/native/Texture.h"
#include "dawn/native/d3d/d3d_platform.h"
namespace dawn::native {
@@ -53,7 +53,7 @@
class ScopedCommandRecordingContext;
class SharedTextureMemory;
-class Texture final : public d3d::Texture {
+class Texture final : public TextureBase {
public:
static ResultOrError<Ref<Texture>> Create(Device* device,
const UnpackedPtr<TextureDescriptor>& descriptor);
@@ -99,7 +99,6 @@
static MaybeError Copy(const ScopedCommandRecordingContext* commandContext,
CopyTextureToTextureCmd* copy);
- ResultOrError<ExecutionSerial> EndAccess() override;
// As D3D11 SRV doesn't support 'Shader4ComponentMapping' for depth-stencil textures, we can't
// sample the stencil component directly. As a workaround we create an internal R8Uint texture,
@@ -109,7 +108,7 @@
const TextureView* view);
private:
- using Base = d3d::Texture;
+ using Base = TextureBase;
enum class Kind { Normal, Staging, Interim };
diff --git a/src/dawn/native/d3d12/TextureD3D12.cpp b/src/dawn/native/d3d12/TextureD3D12.cpp
index 385f77e..2b376c3 100644
--- a/src/dawn/native/d3d12/TextureD3D12.cpp
+++ b/src/dawn/native/d3d12/TextureD3D12.cpp
@@ -323,32 +323,6 @@
mSwapChainTexture = false;
}
-ResultOrError<ExecutionSerial> Texture::EndAccess() {
- DAWN_ASSERT(mD3D12ResourceFlags & D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS);
-
- NotifySwapChainPresentToPIX();
-
- // Synchronize if texture access wasn't synchronized already due to ExecuteCommandLists. If
- // there were pending commands that used this texture mLastSharedTextureMemoryUsageSerial will
- // be set, but if it's still not set, generate a signal fence after waiting on wait fences.
- Queue* queue = ToBackend(GetDevice()->GetQueue());
- if (mLastSharedTextureMemoryUsageSerial == kBeginningOfGPUTime) {
- // Even though we aren't recording any commands here, asking for a command context ensures
- // that the device fence is signaled eventually even if no commands were recorded before
- // EndAccess. This is a little sub-optimal, but shouldn't occur often in practice.
- CommandRecordingContext* context =
- queue->GetPendingCommandContext(ExecutionQueueBase::SubmitMode::Passive);
- DAWN_TRY(SynchronizeTextureBeforeUse(context));
- DAWN_ASSERT(mLastSharedTextureMemoryUsageSerial != kBeginningOfGPUTime);
- }
- // Make the queue signal the fence in finite time.
- DAWN_TRY(queue->EnsureCommandsFlushed(mLastSharedTextureMemoryUsageSerial));
-
- ExecutionSerial ret = mLastSharedTextureMemoryUsageSerial;
- mLastSharedTextureMemoryUsageSerial = kBeginningOfGPUTime;
- return ret;
-}
-
DXGI_FORMAT Texture::GetD3D12Format() const {
return d3d::DXGITextureFormat(GetDevice(), GetFormat().format);
}
diff --git a/src/dawn/native/d3d12/TextureD3D12.h b/src/dawn/native/d3d12/TextureD3D12.h
index 29c3ec7..d6eb657 100644
--- a/src/dawn/native/d3d12/TextureD3D12.h
+++ b/src/dawn/native/d3d12/TextureD3D12.h
@@ -32,11 +32,11 @@
#include <vector>
#include "dawn/native/Error.h"
-#include "dawn/native/d3d/TextureD3D.h"
#include "dawn/native/DawnNative.h"
#include "dawn/native/IntegerTypes.h"
#include "dawn/native/PassResourceUsage.h"
+#include "dawn/native/Texture.h"
#include "dawn/native/d3d12/IntegerTypes.h"
#include "dawn/native/d3d12/ResourceHeapAllocationD3D12.h"
#include "dawn/native/d3d12/d3d12_platform.h"
@@ -51,7 +51,7 @@
class CommandRecordingContext;
class Device;
-class Texture final : public d3d::Texture {
+class Texture final : public TextureBase {
public:
static ResultOrError<Ref<Texture>> Create(Device* device,
const UnpackedPtr<TextureDescriptor>& descriptor);
@@ -64,10 +64,6 @@
SharedTextureMemory* memory,
const UnpackedPtr<TextureDescriptor>& descriptor);
- // For external textures, returns the Device internal fence's value associated with the last
- // ExecuteCommandLists that used this texture. If nullopt is returned, the texture wasn't used.
- ResultOrError<ExecutionSerial> EndAccess() override;
-
DXGI_FORMAT GetD3D12Format() const;
ID3D12Resource* GetD3D12Resource() const;
DXGI_FORMAT GetD3D12CopyableSubresourceFormat(Aspect aspect) const;
@@ -114,7 +110,7 @@
D3D12_RESOURCE_STATES GetCurrentStateForSwapChain() const;
private:
- using Base = d3d::Texture;
+ using Base = TextureBase;
Texture(Device* device, const UnpackedPtr<TextureDescriptor>& descriptor);
~Texture() override;