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:
parent
4d968c63d3
commit
39c4fcbdd3
|
@ -62,13 +62,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
mFormat(descriptor->format),
|
mFormat(descriptor->format),
|
||||||
mMipLevelCount(descriptor->mipLevelCount),
|
mMipLevelCount(descriptor->mipLevelCount),
|
||||||
mSampleCount(descriptor->sampleCount) {
|
mSampleCount(descriptor->sampleCount) {
|
||||||
ASSERT(!descriptor->nextInChain ||
|
ASSERT(descriptor->nextInChain == nullptr);
|
||||||
descriptor->nextInChain->sType == WGPUSType_DawnTextureInternalUsageDescriptor);
|
|
||||||
if (descriptor->nextInChain) {
|
|
||||||
mUsageInternal = reinterpret_cast<const WGPUDawnTextureInternalUsageDescriptor*>(
|
|
||||||
descriptor->nextInChain)
|
|
||||||
->internalUsage;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WGPUTexture ExternalImageDXGI::ProduceTexture(
|
WGPUTexture ExternalImageDXGI::ProduceTexture(
|
||||||
|
@ -90,13 +84,6 @@ namespace dawn_native { namespace d3d12 {
|
||||||
textureDescriptor.mipLevelCount = mMipLevelCount;
|
textureDescriptor.mipLevelCount = mMipLevelCount;
|
||||||
textureDescriptor.sampleCount = mSampleCount;
|
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(
|
Ref<TextureBase> texture = backendDevice->CreateExternalTexture(
|
||||||
&textureDescriptor, mD3D12Resource, ExternalMutexSerial(descriptor->acquireMutexKey),
|
&textureDescriptor, mD3D12Resource, ExternalMutexSerial(descriptor->acquireMutexKey),
|
||||||
ExternalMutexSerial(descriptor->releaseMutexKey), descriptor->isSwapChainTexture,
|
ExternalMutexSerial(descriptor->releaseMutexKey), descriptor->isSwapChainTexture,
|
||||||
|
|
|
@ -79,7 +79,6 @@ namespace dawn_native { namespace d3d12 {
|
||||||
// Contents of WGPUTextureDescriptor are stored individually since the descriptor
|
// Contents of WGPUTextureDescriptor are stored individually since the descriptor
|
||||||
// could outlive this image.
|
// could outlive this image.
|
||||||
WGPUTextureUsageFlags mUsage;
|
WGPUTextureUsageFlags mUsage;
|
||||||
WGPUTextureUsageFlags mUsageInternal = WGPUTextureUsage_None;
|
|
||||||
WGPUTextureDimension mDimension;
|
WGPUTextureDimension mDimension;
|
||||||
WGPUExtent3D mSize;
|
WGPUExtent3D mSize;
|
||||||
WGPUTextureFormat mFormat;
|
WGPUTextureFormat mFormat;
|
||||||
|
|
|
@ -28,11 +28,6 @@ using Microsoft::WRL::ComPtr;
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class D3D12ResourceTestBase : public DawnTest {
|
class D3D12ResourceTestBase : public DawnTest {
|
||||||
protected:
|
|
||||||
std::vector<const char*> GetRequiredExtensions() override {
|
|
||||||
return {"dawn-internal-usages"};
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
DawnTest::SetUp();
|
DawnTest::SetUp();
|
||||||
|
@ -166,28 +161,11 @@ TEST_P(D3D12SharedHandleValidation, Success) {
|
||||||
ASSERT_NE(texture.Get(), nullptr);
|
ASSERT_NE(texture.Get(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test a successful wrapping of an D3D12Resource with DawnTextureInternalUsageDescriptor
|
// Test an error occurs if the texture descriptor is invalid
|
||||||
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_P(D3D12SharedHandleValidation, InvalidTextureDescriptor) {
|
TEST_P(D3D12SharedHandleValidation, InvalidTextureDescriptor) {
|
||||||
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
|
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
|
||||||
|
|
||||||
wgpu::ChainedStruct chainedDescriptor;
|
wgpu::ChainedStruct chainedDescriptor;
|
||||||
chainedDescriptor.sType = wgpu::SType::SurfaceDescriptorFromWindowsSwapChainPanel;
|
|
||||||
baseDawnDescriptor.nextInChain = &chainedDescriptor;
|
baseDawnDescriptor.nextInChain = &chainedDescriptor;
|
||||||
|
|
||||||
wgpu::Texture texture;
|
wgpu::Texture texture;
|
||||||
|
|
|
@ -114,11 +114,6 @@ namespace {
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
class EGLImageTestBase : public DawnTest {
|
class EGLImageTestBase : public DawnTest {
|
||||||
protected:
|
|
||||||
std::vector<const char*> GetRequiredExtensions() override {
|
|
||||||
return {"dawn-internal-usages"};
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScopedEGLImage CreateEGLImage(uint32_t width,
|
ScopedEGLImage CreateEGLImage(uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
|
@ -182,30 +177,15 @@ TEST_P(EGLImageValidationTests, Success) {
|
||||||
ASSERT_NE(texture.Get(), nullptr);
|
ASSERT_NE(texture.Get(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test a successful wrapping of an EGLImage in a texture with DawnTextureInternalUsageDescriptor
|
// Test an error occurs if the texture descriptor is invalid
|
||||||
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_P(EGLImageValidationTests, InvalidTextureDescriptor) {
|
TEST_P(EGLImageValidationTests, InvalidTextureDescriptor) {
|
||||||
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
|
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
|
||||||
|
|
||||||
wgpu::ChainedStruct chainedDescriptor;
|
wgpu::ChainedStruct chainedDescriptor;
|
||||||
chainedDescriptor.sType = wgpu::SType::SurfaceDescriptorFromWindowsSwapChainPanel;
|
|
||||||
descriptor.nextInChain = &chainedDescriptor;
|
descriptor.nextInChain = &chainedDescriptor;
|
||||||
|
|
||||||
ScopedEGLImage image = CreateDefaultEGLImage();
|
ScopedEGLImage image = CreateDefaultEGLImage();
|
||||||
ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapEGLImage(&descriptor, image.getImage()));
|
ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapEGLImage(&descriptor, image.getImage()));
|
||||||
|
|
||||||
ASSERT_EQ(texture.Get(), nullptr);
|
ASSERT_EQ(texture.Get(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,12 +291,6 @@ class EGLImageUsageTests : public EGLImageTestBase {
|
||||||
textureDescriptor.sampleCount = 1;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.mipLevelCount = 1;
|
textureDescriptor.mipLevelCount = 1;
|
||||||
textureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
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);
|
wgpu::Texture eglImageTexture = WrapEGLImage(&textureDescriptor, eglImage);
|
||||||
ASSERT_NE(eglImageTexture, nullptr);
|
ASSERT_NE(eglImageTexture, nullptr);
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,6 @@ namespace dawn_native { namespace vulkan {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class VulkanImageWrappingTestBase : public DawnTest {
|
class VulkanImageWrappingTestBase : public DawnTest {
|
||||||
protected:
|
|
||||||
std::vector<const char*> GetRequiredExtensions() override {
|
|
||||||
return {"dawn-internal-usages"};
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
|
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
|
||||||
|
@ -185,24 +180,10 @@ namespace dawn_native { namespace vulkan {
|
||||||
IgnoreSignalSemaphore(texture);
|
IgnoreSignalSemaphore(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test no error occurs if the import is valid with DawnTextureInternalUsageDescriptor
|
// Test an error occurs if the texture descriptor is invalid
|
||||||
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_P(VulkanImageWrappingValidationTests, InvalidTextureDescriptor) {
|
TEST_P(VulkanImageWrappingValidationTests, InvalidTextureDescriptor) {
|
||||||
wgpu::ChainedStruct chainedDescriptor;
|
wgpu::ChainedStruct chainedDescriptor;
|
||||||
chainedDescriptor.sType = wgpu::SType::SurfaceDescriptorFromWindowsSwapChainPanel;
|
defaultDescriptor.nextInChain = &chainedDescriptor;
|
||||||
descriptor.nextInChain = &chainedDescriptor;
|
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(wgpu::Texture texture =
|
ASSERT_DEVICE_ERROR(wgpu::Texture texture =
|
||||||
WrapVulkanImage(device, &defaultDescriptor, defaultFd,
|
WrapVulkanImage(device, &defaultDescriptor, defaultFd,
|
||||||
|
|
|
@ -30,11 +30,6 @@ namespace dawn_native { namespace vulkan {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class VulkanImageWrappingTestBase : public DawnTest {
|
class VulkanImageWrappingTestBase : public DawnTest {
|
||||||
protected:
|
|
||||||
std::vector<const char*> GetRequiredExtensions() override {
|
|
||||||
return {"dawn-internal-usages"};
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
DawnTest::SetUp();
|
DawnTest::SetUp();
|
||||||
|
@ -270,24 +265,9 @@ namespace dawn_native { namespace vulkan {
|
||||||
IgnoreSignalSemaphore(texture);
|
IgnoreSignalSemaphore(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test no error occurs if the import is valid with DawnTextureInternalUsageDescriptor
|
// Test an error occurs if the texture descriptor is invalid
|
||||||
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_P(VulkanImageWrappingValidationTests, InvalidTextureDescriptor) {
|
TEST_P(VulkanImageWrappingValidationTests, InvalidTextureDescriptor) {
|
||||||
wgpu::ChainedStruct chainedDescriptor;
|
wgpu::ChainedStruct chainedDescriptor;
|
||||||
chainedDescriptor.sType = wgpu::SType::SurfaceDescriptorFromWindowsSwapChainPanel;
|
|
||||||
defaultDescriptor.nextInChain = &chainedDescriptor;
|
defaultDescriptor.nextInChain = &chainedDescriptor;
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapVulkanImage(
|
ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapVulkanImage(
|
||||||
|
|
Loading…
Reference in New Issue