Revert "Making D3D12 accept InternalUsageDescriptors"

This reverts commit 365d40b93a.

Reason for revert: Broke the ChromeOS build in the Dawn roll.
https://chromium-review.googlesource.com/c/chromium/src/+/3090302

Original change's description:
> Making D3D12 accept InternalUsageDescriptors
>
> This is a follow up from two previous CLs,
> https://dawn-review.googlesource.com/c/dawn/+/58440
> and
> https://dawn-review.googlesource.com/c/dawn/+/58140
>
> This CL adds in the D3D12Backend the possibility to use Dawn Texture
> Internal Usage Descriptor, and adds a series of tests to validate it.
>
> Change-Id: I94f6b39153b60ec8af61bda22d41a865898da613
> Bug: dawn:1027, dawn:1052
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61520
> Commit-Queue: Juanmi Huertas <juanmihd@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>

TBR=kainino@chromium.org,enga@chromium.org,juanmihd@chromium.org,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I11b246f38505df23a6c61e851d6d90e34c8d1287
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:1027, dawn:1052
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61820
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2021-08-12 17:05:21 +00:00 committed by Dawn LUCI CQ
parent 4d968c63d3
commit 39c4fcbdd3
6 changed files with 6 additions and 107 deletions

View File

@ -62,13 +62,7 @@ namespace dawn_native { namespace d3d12 {
mFormat(descriptor->format),
mMipLevelCount(descriptor->mipLevelCount),
mSampleCount(descriptor->sampleCount) {
ASSERT(!descriptor->nextInChain ||
descriptor->nextInChain->sType == WGPUSType_DawnTextureInternalUsageDescriptor);
if (descriptor->nextInChain) {
mUsageInternal = reinterpret_cast<const WGPUDawnTextureInternalUsageDescriptor*>(
descriptor->nextInChain)
->internalUsage;
}
ASSERT(descriptor->nextInChain == nullptr);
}
WGPUTexture ExternalImageDXGI::ProduceTexture(
@ -90,13 +84,6 @@ namespace dawn_native { namespace d3d12 {
textureDescriptor.mipLevelCount = mMipLevelCount;
textureDescriptor.sampleCount = mSampleCount;
DawnTextureInternalUsageDescriptor internalDesc = {};
if (mUsageInternal) {
textureDescriptor.nextInChain = &internalDesc;
internalDesc.internalUsage = static_cast<wgpu::TextureUsage>(mUsageInternal);
internalDesc.sType = wgpu::SType::DawnTextureInternalUsageDescriptor;
}
Ref<TextureBase> texture = backendDevice->CreateExternalTexture(
&textureDescriptor, mD3D12Resource, ExternalMutexSerial(descriptor->acquireMutexKey),
ExternalMutexSerial(descriptor->releaseMutexKey), descriptor->isSwapChainTexture,

View File

@ -79,7 +79,6 @@ namespace dawn_native { namespace d3d12 {
// Contents of WGPUTextureDescriptor are stored individually since the descriptor
// could outlive this image.
WGPUTextureUsageFlags mUsage;
WGPUTextureUsageFlags mUsageInternal = WGPUTextureUsage_None;
WGPUTextureDimension mDimension;
WGPUExtent3D mSize;
WGPUTextureFormat mFormat;

View File

@ -28,11 +28,6 @@ using Microsoft::WRL::ComPtr;
namespace {
class D3D12ResourceTestBase : public DawnTest {
protected:
std::vector<const char*> GetRequiredExtensions() override {
return {"dawn-internal-usages"};
}
public:
void SetUp() override {
DawnTest::SetUp();
@ -166,28 +161,11 @@ TEST_P(D3D12SharedHandleValidation, Success) {
ASSERT_NE(texture.Get(), nullptr);
}
// Test a successful wrapping of an D3D12Resource with DawnTextureInternalUsageDescriptor
TEST_P(D3D12SharedHandleValidation, SuccessWithInternalUsageDescriptor) {
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
wgpu::DawnTextureInternalUsageDescriptor internalDesc = {};
baseDawnDescriptor.nextInChain = &internalDesc;
internalDesc.internalUsage = wgpu::TextureUsage::CopySrc;
internalDesc.sType = wgpu::SType::DawnTextureInternalUsageDescriptor;
wgpu::Texture texture;
ComPtr<ID3D11Texture2D> d3d11Texture;
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture);
ASSERT_NE(texture.Get(), nullptr);
}
// Test an error occurs if an invalid sType is the nextInChain
// Test an error occurs if the texture descriptor is invalid
TEST_P(D3D12SharedHandleValidation, InvalidTextureDescriptor) {
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
wgpu::ChainedStruct chainedDescriptor;
chainedDescriptor.sType = wgpu::SType::SurfaceDescriptorFromWindowsSwapChainPanel;
baseDawnDescriptor.nextInChain = &chainedDescriptor;
wgpu::Texture texture;

View File

@ -114,11 +114,6 @@ namespace {
} // anonymous namespace
class EGLImageTestBase : public DawnTest {
protected:
std::vector<const char*> GetRequiredExtensions() override {
return {"dawn-internal-usages"};
}
public:
ScopedEGLImage CreateEGLImage(uint32_t width,
uint32_t height,
@ -182,30 +177,15 @@ TEST_P(EGLImageValidationTests, Success) {
ASSERT_NE(texture.Get(), nullptr);
}
// Test a successful wrapping of an EGLImage in a texture with DawnTextureInternalUsageDescriptor
TEST_P(EGLImageValidationTests, SuccessWithInternalUsageDescriptor) {
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
wgpu::DawnTextureInternalUsageDescriptor internalDesc = {};
descriptor.nextInChain = &internalDesc;
internalDesc.internalUsage = wgpu::TextureUsage::CopySrc;
internalDesc.sType = wgpu::SType::DawnTextureInternalUsageDescriptor;
ScopedEGLImage image = CreateDefaultEGLImage();
wgpu::Texture texture = WrapEGLImage(&descriptor, image.getImage());
ASSERT_NE(texture.Get(), nullptr);
}
// Test an error occurs if an invalid sType is the nextInChain
// Test an error occurs if the texture descriptor is invalid
TEST_P(EGLImageValidationTests, InvalidTextureDescriptor) {
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
wgpu::ChainedStruct chainedDescriptor;
chainedDescriptor.sType = wgpu::SType::SurfaceDescriptorFromWindowsSwapChainPanel;
descriptor.nextInChain = &chainedDescriptor;
ScopedEGLImage image = CreateDefaultEGLImage();
ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapEGLImage(&descriptor, image.getImage()));
ASSERT_EQ(texture.Get(), nullptr);
}
@ -311,12 +291,6 @@ class EGLImageUsageTests : public EGLImageTestBase {
textureDescriptor.sampleCount = 1;
textureDescriptor.mipLevelCount = 1;
textureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
wgpu::DawnTextureInternalUsageDescriptor internalDesc = {};
textureDescriptor.nextInChain = &internalDesc;
internalDesc.internalUsage = wgpu::TextureUsage::CopySrc;
internalDesc.sType = wgpu::SType::DawnTextureInternalUsageDescriptor;
wgpu::Texture eglImageTexture = WrapEGLImage(&textureDescriptor, eglImage);
ASSERT_NE(eglImageTexture, nullptr);

View File

@ -33,11 +33,6 @@ namespace dawn_native { namespace vulkan {
namespace {
class VulkanImageWrappingTestBase : public DawnTest {
protected:
std::vector<const char*> GetRequiredExtensions() override {
return {"dawn-internal-usages"};
}
public:
void SetUp() override {
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
@ -185,24 +180,10 @@ namespace dawn_native { namespace vulkan {
IgnoreSignalSemaphore(texture);
}
// Test no error occurs if the import is valid with DawnTextureInternalUsageDescriptor
TEST_P(VulkanImageWrappingValidationTests, SuccessfulImportWithInternalUsageDescriptor) {
wgpu::DawnTextureInternalUsageDescriptor internalDesc = {};
defaultDescriptor.nextInChain = &internalDesc;
internalDesc.internalUsage = wgpu::TextureUsage::CopySrc;
internalDesc.sType = wgpu::SType::DawnTextureInternalUsageDescriptor;
wgpu::Texture texture = WrapVulkanImage(device, &defaultDescriptor, defaultFd,
defaultStride, defaultModifier, {}, true, true);
EXPECT_NE(texture.Get(), nullptr);
IgnoreSignalSemaphore(texture);
}
// Test an error occurs if an invalid sType is the nextInChain
// Test an error occurs if the texture descriptor is invalid
TEST_P(VulkanImageWrappingValidationTests, InvalidTextureDescriptor) {
wgpu::ChainedStruct chainedDescriptor;
chainedDescriptor.sType = wgpu::SType::SurfaceDescriptorFromWindowsSwapChainPanel;
descriptor.nextInChain = &chainedDescriptor;
defaultDescriptor.nextInChain = &chainedDescriptor;
ASSERT_DEVICE_ERROR(wgpu::Texture texture =
WrapVulkanImage(device, &defaultDescriptor, defaultFd,

View File

@ -30,11 +30,6 @@ namespace dawn_native { namespace vulkan {
namespace {
class VulkanImageWrappingTestBase : public DawnTest {
protected:
std::vector<const char*> GetRequiredExtensions() override {
return {"dawn-internal-usages"};
}
public:
void SetUp() override {
DawnTest::SetUp();
@ -270,24 +265,9 @@ namespace dawn_native { namespace vulkan {
IgnoreSignalSemaphore(texture);
}
// Test no error occurs if the import is valid with DawnTextureInternalUsageDescriptor
TEST_P(VulkanImageWrappingValidationTests, SuccessfulImportWithInternalUsageDescriptor) {
wgpu::DawnTextureInternalUsageDescriptor internalDesc = {};
defaultDescriptor.nextInChain = &internalDesc;
internalDesc.internalUsage = wgpu::TextureUsage::CopySrc;
internalDesc.sType = wgpu::SType::DawnTextureInternalUsageDescriptor;
wgpu::Texture texture =
WrapVulkanImage(device, &defaultDescriptor, defaultFd, defaultAllocationSize,
defaultMemoryTypeIndex, {}, true, true);
EXPECT_NE(texture.Get(), nullptr);
IgnoreSignalSemaphore(texture);
}
// Test an error occurs if an invalid sType is the nextInChain
// Test an error occurs if the texture descriptor is invalid
TEST_P(VulkanImageWrappingValidationTests, InvalidTextureDescriptor) {
wgpu::ChainedStruct chainedDescriptor;
chainedDescriptor.sType = wgpu::SType::SurfaceDescriptorFromWindowsSwapChainPanel;
defaultDescriptor.nextInChain = &chainedDescriptor;
ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapVulkanImage(