mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
BUILD.gn: enable additional warnings.
Skia uses more warnings than Dawn, enable in Dawn directly so that rolls of Dawn into Skia don't introduce warnings. These warnings seem useful anyway. Bug: chromium:1064305 Change-Id: I13dc776af84151131584a95caeee2cd21ae80fea Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18964 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
c08a0d40fc
commit
7119a0278d
@@ -132,7 +132,7 @@ void InitDawnEnd2EndTestEnvironment(int argc, char** argv);
|
||||
class DawnTestEnvironment : public testing::Environment {
|
||||
public:
|
||||
DawnTestEnvironment(int argc, char** argv);
|
||||
~DawnTestEnvironment() = default;
|
||||
~DawnTestEnvironment() override = default;
|
||||
|
||||
static void SetEnvironment(DawnTestEnvironment* env);
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ protected:
|
||||
}
|
||||
|
||||
wgpu::PipelineLayout MakeBasicPipelineLayout(
|
||||
wgpu::Device device,
|
||||
std::vector<wgpu::BindGroupLayout> bindingInitializer) const {
|
||||
wgpu::PipelineLayoutDescriptor descriptor;
|
||||
|
||||
@@ -103,7 +102,7 @@ protected:
|
||||
wgpu::ShaderModule vsModule = MakeSimpleVSModule();
|
||||
wgpu::ShaderModule fsModule = MakeFSModule(bindingTypes);
|
||||
|
||||
wgpu::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(device, bindGroupLayouts);
|
||||
wgpu::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(bindGroupLayouts);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.layout = pipelineLayout;
|
||||
|
||||
@@ -59,37 +59,37 @@ namespace {
|
||||
mD3d11Device = std::move(d3d11Device);
|
||||
mD3d11DeviceContext = std::move(d3d11DeviceContext);
|
||||
|
||||
dawnDescriptor.dimension = wgpu::TextureDimension::e2D;
|
||||
dawnDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
dawnDescriptor.size = {kTestWidth, kTestHeight, 1};
|
||||
dawnDescriptor.sampleCount = 1;
|
||||
dawnDescriptor.arrayLayerCount = 1;
|
||||
dawnDescriptor.mipLevelCount = 1;
|
||||
dawnDescriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc |
|
||||
wgpu::TextureUsage::OutputAttachment |
|
||||
wgpu::TextureUsage::CopyDst;
|
||||
baseDawnDescriptor.dimension = wgpu::TextureDimension::e2D;
|
||||
baseDawnDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
baseDawnDescriptor.size = {kTestWidth, kTestHeight, 1};
|
||||
baseDawnDescriptor.sampleCount = 1;
|
||||
baseDawnDescriptor.arrayLayerCount = 1;
|
||||
baseDawnDescriptor.mipLevelCount = 1;
|
||||
baseDawnDescriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc |
|
||||
wgpu::TextureUsage::OutputAttachment |
|
||||
wgpu::TextureUsage::CopyDst;
|
||||
|
||||
d3dDescriptor.Width = kTestWidth;
|
||||
d3dDescriptor.Height = kTestHeight;
|
||||
d3dDescriptor.MipLevels = 1;
|
||||
d3dDescriptor.ArraySize = 1;
|
||||
d3dDescriptor.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
d3dDescriptor.SampleDesc.Count = 1;
|
||||
d3dDescriptor.SampleDesc.Quality = 0;
|
||||
d3dDescriptor.Usage = D3D11_USAGE_DEFAULT;
|
||||
d3dDescriptor.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
|
||||
d3dDescriptor.CPUAccessFlags = 0;
|
||||
d3dDescriptor.MiscFlags =
|
||||
baseD3dDescriptor.Width = kTestWidth;
|
||||
baseD3dDescriptor.Height = kTestHeight;
|
||||
baseD3dDescriptor.MipLevels = 1;
|
||||
baseD3dDescriptor.ArraySize = 1;
|
||||
baseD3dDescriptor.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
baseD3dDescriptor.SampleDesc.Count = 1;
|
||||
baseD3dDescriptor.SampleDesc.Quality = 0;
|
||||
baseD3dDescriptor.Usage = D3D11_USAGE_DEFAULT;
|
||||
baseD3dDescriptor.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
|
||||
baseD3dDescriptor.CPUAccessFlags = 0;
|
||||
baseD3dDescriptor.MiscFlags =
|
||||
D3D11_RESOURCE_MISC_SHARED_NTHANDLE | D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
|
||||
}
|
||||
|
||||
protected:
|
||||
void WrapSharedHandle(const wgpu::TextureDescriptor* dawnDescriptor,
|
||||
const D3D11_TEXTURE2D_DESC* d3dDescriptor,
|
||||
void WrapSharedHandle(const wgpu::TextureDescriptor* dawnDesc,
|
||||
const D3D11_TEXTURE2D_DESC* baseD3dDescriptor,
|
||||
wgpu::Texture* dawnTexture,
|
||||
ID3D11Texture2D** d3d11TextureOut) const {
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
HRESULT hr = mD3d11Device->CreateTexture2D(d3dDescriptor, nullptr, &d3d11Texture);
|
||||
HRESULT hr = mD3d11Device->CreateTexture2D(baseD3dDescriptor, nullptr, &d3d11Texture);
|
||||
ASSERT_EQ(hr, S_OK);
|
||||
|
||||
ComPtr<IDXGIResource1> dxgiResource;
|
||||
@@ -104,7 +104,7 @@ namespace {
|
||||
|
||||
dawn_native::d3d12::ExternalImageDescriptorDXGISharedHandle externDesc;
|
||||
externDesc.cTextureDescriptor =
|
||||
reinterpret_cast<const WGPUTextureDescriptor*>(dawnDescriptor);
|
||||
reinterpret_cast<const WGPUTextureDescriptor*>(dawnDesc);
|
||||
externDesc.sharedHandle = sharedHandle;
|
||||
externDesc.acquireMutexKey = 0;
|
||||
WGPUTexture texture = dawn_native::d3d12::WrapSharedHandle(device.Get(), &externDesc);
|
||||
@@ -123,8 +123,8 @@ namespace {
|
||||
ComPtr<ID3D11Device> mD3d11Device;
|
||||
ComPtr<ID3D11DeviceContext> mD3d11DeviceContext;
|
||||
|
||||
D3D11_TEXTURE2D_DESC d3dDescriptor;
|
||||
wgpu::TextureDescriptor dawnDescriptor;
|
||||
D3D11_TEXTURE2D_DESC baseD3dDescriptor;
|
||||
wgpu::TextureDescriptor baseDawnDescriptor;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
@@ -140,7 +140,7 @@ TEST_P(D3D12SharedHandleValidation, Success) {
|
||||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
WrapSharedHandle(&dawnDescriptor, &d3dDescriptor, &texture, &d3d11Texture);
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture);
|
||||
|
||||
ASSERT_NE(texture.Get(), nullptr);
|
||||
}
|
||||
@@ -150,11 +150,12 @@ TEST_P(D3D12SharedHandleValidation, InvalidTextureDescriptor) {
|
||||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
|
||||
wgpu::ChainedStruct chainedDescriptor;
|
||||
dawnDescriptor.nextInChain = &chainedDescriptor;
|
||||
baseDawnDescriptor.nextInChain = &chainedDescriptor;
|
||||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&dawnDescriptor, &d3dDescriptor, &texture, &d3d11Texture));
|
||||
ASSERT_DEVICE_ERROR(
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture));
|
||||
|
||||
ASSERT_EQ(texture.Get(), nullptr);
|
||||
}
|
||||
@@ -162,11 +163,12 @@ TEST_P(D3D12SharedHandleValidation, InvalidTextureDescriptor) {
|
||||
// Test an error occurs if the descriptor mip level count isn't 1
|
||||
TEST_P(D3D12SharedHandleValidation, InvalidMipLevelCount) {
|
||||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
dawnDescriptor.mipLevelCount = 2;
|
||||
baseDawnDescriptor.mipLevelCount = 2;
|
||||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&dawnDescriptor, &d3dDescriptor, &texture, &d3d11Texture));
|
||||
ASSERT_DEVICE_ERROR(
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture));
|
||||
|
||||
ASSERT_EQ(texture.Get(), nullptr);
|
||||
}
|
||||
@@ -174,11 +176,12 @@ TEST_P(D3D12SharedHandleValidation, InvalidMipLevelCount) {
|
||||
// Test an error occurs if the descriptor array layer count isn't 1
|
||||
TEST_P(D3D12SharedHandleValidation, InvalidArrayLayerCount) {
|
||||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
dawnDescriptor.arrayLayerCount = 2;
|
||||
baseDawnDescriptor.arrayLayerCount = 2;
|
||||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&dawnDescriptor, &d3dDescriptor, &texture, &d3d11Texture));
|
||||
ASSERT_DEVICE_ERROR(
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture));
|
||||
|
||||
ASSERT_EQ(texture.Get(), nullptr);
|
||||
}
|
||||
@@ -186,11 +189,12 @@ TEST_P(D3D12SharedHandleValidation, InvalidArrayLayerCount) {
|
||||
// Test an error occurs if the descriptor sample count isn't 1
|
||||
TEST_P(D3D12SharedHandleValidation, InvalidSampleCount) {
|
||||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
dawnDescriptor.sampleCount = 4;
|
||||
baseDawnDescriptor.sampleCount = 4;
|
||||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&dawnDescriptor, &d3dDescriptor, &texture, &d3d11Texture));
|
||||
ASSERT_DEVICE_ERROR(
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture));
|
||||
|
||||
ASSERT_EQ(texture.Get(), nullptr);
|
||||
}
|
||||
@@ -198,11 +202,12 @@ TEST_P(D3D12SharedHandleValidation, InvalidSampleCount) {
|
||||
// Test an error occurs if the descriptor width doesn't match the texture's
|
||||
TEST_P(D3D12SharedHandleValidation, InvalidWidth) {
|
||||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
dawnDescriptor.size.width = kTestWidth + 1;
|
||||
baseDawnDescriptor.size.width = kTestWidth + 1;
|
||||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&dawnDescriptor, &d3dDescriptor, &texture, &d3d11Texture));
|
||||
ASSERT_DEVICE_ERROR(
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture));
|
||||
|
||||
ASSERT_EQ(texture.Get(), nullptr);
|
||||
}
|
||||
@@ -210,11 +215,12 @@ TEST_P(D3D12SharedHandleValidation, InvalidWidth) {
|
||||
// Test an error occurs if the descriptor height doesn't match the texture's
|
||||
TEST_P(D3D12SharedHandleValidation, InvalidHeight) {
|
||||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
dawnDescriptor.size.height = kTestHeight + 1;
|
||||
baseDawnDescriptor.size.height = kTestHeight + 1;
|
||||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&dawnDescriptor, &d3dDescriptor, &texture, &d3d11Texture));
|
||||
ASSERT_DEVICE_ERROR(
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture));
|
||||
|
||||
ASSERT_EQ(texture.Get(), nullptr);
|
||||
}
|
||||
@@ -222,11 +228,12 @@ TEST_P(D3D12SharedHandleValidation, InvalidHeight) {
|
||||
// Test an error occurs if the descriptor format isn't compatible with the D3D12 Resource
|
||||
TEST_P(D3D12SharedHandleValidation, InvalidFormat) {
|
||||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
dawnDescriptor.format = wgpu::TextureFormat::R8Unorm;
|
||||
baseDawnDescriptor.format = wgpu::TextureFormat::R8Unorm;
|
||||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&dawnDescriptor, &d3dDescriptor, &texture, &d3d11Texture));
|
||||
ASSERT_DEVICE_ERROR(
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture));
|
||||
|
||||
ASSERT_EQ(texture.Get(), nullptr);
|
||||
}
|
||||
@@ -234,11 +241,12 @@ TEST_P(D3D12SharedHandleValidation, InvalidFormat) {
|
||||
// Test an error occurs if the number of D3D mip levels is greater than 1.
|
||||
TEST_P(D3D12SharedHandleValidation, InvalidNumD3DMipLevels) {
|
||||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
d3dDescriptor.MipLevels = 2;
|
||||
baseD3dDescriptor.MipLevels = 2;
|
||||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&dawnDescriptor, &d3dDescriptor, &texture, &d3d11Texture));
|
||||
ASSERT_DEVICE_ERROR(
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture));
|
||||
|
||||
ASSERT_EQ(texture.Get(), nullptr);
|
||||
}
|
||||
@@ -246,11 +254,12 @@ TEST_P(D3D12SharedHandleValidation, InvalidNumD3DMipLevels) {
|
||||
// Test an error occurs if the number of array levels is greater than 1.
|
||||
TEST_P(D3D12SharedHandleValidation, InvalidD3DArraySize) {
|
||||
DAWN_SKIP_TEST_IF(UsesWire());
|
||||
d3dDescriptor.ArraySize = 2;
|
||||
baseD3dDescriptor.ArraySize = 2;
|
||||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&dawnDescriptor, &d3dDescriptor, &texture, &d3d11Texture));
|
||||
ASSERT_DEVICE_ERROR(
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture));
|
||||
|
||||
ASSERT_EQ(texture.Get(), nullptr);
|
||||
}
|
||||
@@ -416,11 +425,11 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D11CopyAndReadbackInD3D12) {
|
||||
wgpu::Texture dawnSrcTexture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ComPtr<IDXGIKeyedMutex> dxgiKeyedMutex;
|
||||
WrapAndClearD3D11Texture(&dawnDescriptor, &d3dDescriptor, &dawnSrcTexture, clearColor,
|
||||
WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnSrcTexture, clearColor,
|
||||
&d3d11Texture, &dxgiKeyedMutex);
|
||||
|
||||
// Create a texture on the device and copy the source texture to it.
|
||||
wgpu::Texture dawnCopyDestTexture = device.CreateTexture(&dawnDescriptor);
|
||||
wgpu::Texture dawnCopyDestTexture = device.CreateTexture(&baseDawnDescriptor);
|
||||
SimpleCopyTextureToTexture(dawnSrcTexture, dawnCopyDestTexture);
|
||||
|
||||
// Readback the destination texture and ensure it contains the colors we used
|
||||
@@ -439,7 +448,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D11ReadbackInD3D12) {
|
||||
wgpu::Texture dawnTexture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ComPtr<IDXGIKeyedMutex> dxgiKeyedMutex;
|
||||
WrapAndClearD3D11Texture(&dawnDescriptor, &d3dDescriptor, &dawnTexture, clearColor,
|
||||
WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnTexture, clearColor,
|
||||
&d3d11Texture, &dxgiKeyedMutex);
|
||||
|
||||
// Readback the destination texture and ensure it contains the colors we used
|
||||
@@ -459,7 +468,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D12ReadbackInD3D11) {
|
||||
wgpu::Texture dawnTexture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ComPtr<IDXGIKeyedMutex> dxgiKeyedMutex;
|
||||
WrapAndClearD3D11Texture(&dawnDescriptor, &d3dDescriptor, &dawnTexture, d3d11ClearColor,
|
||||
WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnTexture, d3d11ClearColor,
|
||||
&d3d11Texture, &dxgiKeyedMutex);
|
||||
|
||||
const wgpu::Color d3d12ClearColor{0.0f, 0.0f, 1.0f, 1.0f};
|
||||
@@ -484,7 +493,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearTwiceInD3D12ReadbackInD3D11) {
|
||||
wgpu::Texture dawnTexture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ComPtr<IDXGIKeyedMutex> dxgiKeyedMutex;
|
||||
WrapAndClearD3D11Texture(&dawnDescriptor, &d3dDescriptor, &dawnTexture, d3d11ClearColor,
|
||||
WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnTexture, d3d11ClearColor,
|
||||
&d3d11Texture, &dxgiKeyedMutex);
|
||||
|
||||
const wgpu::Color d3d12ClearColor1{0.0f, 0.0f, 1.0f, 1.0f};
|
||||
@@ -511,7 +520,7 @@ TEST_P(D3D12SharedHandleUsageTests, UnclearedTextureIsCleared) {
|
||||
wgpu::Texture dawnTexture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ComPtr<IDXGIKeyedMutex> dxgiKeyedMutex;
|
||||
WrapAndClearD3D11Texture(&dawnDescriptor, &d3dDescriptor, &dawnTexture, clearColor,
|
||||
WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnTexture, clearColor,
|
||||
&d3d11Texture, &dxgiKeyedMutex, false);
|
||||
|
||||
// Readback the destination texture and ensure it contains the colors we used
|
||||
|
||||
@@ -28,7 +28,7 @@ void InitDawnPerfTestEnvironment(int argc, char** argv);
|
||||
class DawnPerfTestEnvironment : public DawnTestEnvironment {
|
||||
public:
|
||||
DawnPerfTestEnvironment(int argc, char** argv);
|
||||
~DawnPerfTestEnvironment();
|
||||
~DawnPerfTestEnvironment() override;
|
||||
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
class ValidationTest : public testing::Test {
|
||||
public:
|
||||
ValidationTest();
|
||||
~ValidationTest();
|
||||
~ValidationTest() override;
|
||||
|
||||
wgpu::Device CreateDeviceFromAdapter(dawn_native::Adapter adapter,
|
||||
const std::vector<const char*>& requiredExtensions);
|
||||
|
||||
@@ -315,12 +315,12 @@ TEST_F(WireArgumentTests, StructureOfStructureArrayArgument) {
|
||||
static constexpr int NUM_BINDINGS = 3;
|
||||
WGPUBindGroupLayoutEntry bindings[NUM_BINDINGS]{
|
||||
{0, WGPUShaderStage_Vertex, WGPUBindingType_Sampler, false, false,
|
||||
WGPUTextureViewDimension_2D, WGPUTextureComponentType_Float},
|
||||
WGPUTextureViewDimension_2D, WGPUTextureComponentType_Float, WGPUTextureFormat_RGBA8Unorm},
|
||||
{1, WGPUShaderStage_Vertex, WGPUBindingType_SampledTexture, false, false,
|
||||
WGPUTextureViewDimension_2D, WGPUTextureComponentType_Float},
|
||||
WGPUTextureViewDimension_2D, WGPUTextureComponentType_Float, WGPUTextureFormat_RGBA8Unorm},
|
||||
{2, static_cast<WGPUShaderStage>(WGPUShaderStage_Vertex | WGPUShaderStage_Fragment),
|
||||
WGPUBindingType_UniformBuffer, false, false, WGPUTextureViewDimension_2D,
|
||||
WGPUTextureComponentType_Float},
|
||||
WGPUTextureComponentType_Float, WGPUTextureFormat_RGBA8Unorm},
|
||||
};
|
||||
WGPUBindGroupLayoutDescriptor bglDescriptor = {};
|
||||
bglDescriptor.bindingCount = NUM_BINDINGS;
|
||||
|
||||
@@ -55,8 +55,7 @@ class D3D12DescriptorHeapTests : public DawnTest {
|
||||
})");
|
||||
}
|
||||
|
||||
utils::BasicRenderPass MakeRenderPass(const wgpu::Device& device,
|
||||
uint32_t width,
|
||||
utils::BasicRenderPass MakeRenderPass(uint32_t width,
|
||||
uint32_t height,
|
||||
wgpu::TextureFormat format) {
|
||||
DAWN_ASSERT(width > 0 && height > 0);
|
||||
@@ -291,7 +290,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBO) {
|
||||
dawn_native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting));
|
||||
|
||||
utils::BasicRenderPass renderPass =
|
||||
MakeRenderPass(device, kRTSize, kRTSize, wgpu::TextureFormat::R32Float);
|
||||
MakeRenderPass(kRTSize, kRTSize, wgpu::TextureFormat::R32Float);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = mSimpleVSModule;
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace dawn_native { namespace vulkan {
|
||||
return gbmBo;
|
||||
}
|
||||
|
||||
wgpu::Texture WrapVulkanImage(wgpu::Device device,
|
||||
wgpu::Texture WrapVulkanImage(wgpu::Device dawnDevice,
|
||||
const wgpu::TextureDescriptor* textureDescriptor,
|
||||
int memoryFd,
|
||||
uint32_t stride,
|
||||
@@ -117,7 +117,7 @@ namespace dawn_native { namespace vulkan {
|
||||
descriptor.waitFDs = waitFDs;
|
||||
|
||||
WGPUTexture texture =
|
||||
dawn_native::vulkan::WrapVulkanImage(device.Get(), &descriptor);
|
||||
dawn_native::vulkan::WrapVulkanImage(dawnDevice.Get(), &descriptor);
|
||||
|
||||
if (expectValid) {
|
||||
EXPECT_NE(texture, nullptr) << "Failed to wrap image, are external memory / "
|
||||
@@ -132,8 +132,8 @@ namespace dawn_native { namespace vulkan {
|
||||
// Exports the signal from a wrapped texture and ignores it
|
||||
// We have to export the signal before destroying the wrapped texture else it's an
|
||||
// assertion failure
|
||||
void IgnoreSignalSemaphore(wgpu::Device device, wgpu::Texture wrappedTexture) {
|
||||
int fd = dawn_native::vulkan::ExportSignalSemaphoreOpaqueFD(device.Get(),
|
||||
void IgnoreSignalSemaphore(wgpu::Device dawnDevice, wgpu::Texture wrappedTexture) {
|
||||
int fd = dawn_native::vulkan::ExportSignalSemaphoreOpaqueFD(dawnDevice.Get(),
|
||||
wrappedTexture.Get());
|
||||
ASSERT_NE(fd, -1);
|
||||
close(fd);
|
||||
@@ -289,7 +289,9 @@ namespace dawn_native { namespace vulkan {
|
||||
dawn_native::vulkan::Device* secondDeviceVk;
|
||||
|
||||
// Clear a texture on a given device
|
||||
void ClearImage(wgpu::Device device, wgpu::Texture wrappedTexture, wgpu::Color clearColor) {
|
||||
void ClearImage(wgpu::Device dawnDevice,
|
||||
wgpu::Texture wrappedTexture,
|
||||
wgpu::Color clearColor) {
|
||||
wgpu::TextureView wrappedView = wrappedTexture.CreateView();
|
||||
|
||||
// Submit a clear operation
|
||||
@@ -297,19 +299,19 @@ namespace dawn_native { namespace vulkan {
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = clearColor;
|
||||
renderPassDescriptor.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::CommandEncoder encoder = dawnDevice.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||
pass.EndPass();
|
||||
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
|
||||
wgpu::Queue queue = device.CreateQueue();
|
||||
wgpu::Queue queue = dawnDevice.CreateQueue();
|
||||
queue.Submit(1, &commands);
|
||||
}
|
||||
|
||||
// Submits a 1x1x1 copy from source to destination
|
||||
void SimpleCopyTextureToTexture(wgpu::Device device,
|
||||
wgpu::Queue queue,
|
||||
void SimpleCopyTextureToTexture(wgpu::Device dawnDevice,
|
||||
wgpu::Queue dawnQueue,
|
||||
wgpu::Texture source,
|
||||
wgpu::Texture destination) {
|
||||
wgpu::TextureCopyView copySrc;
|
||||
@@ -326,11 +328,11 @@ namespace dawn_native { namespace vulkan {
|
||||
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::CommandEncoder encoder = dawnDevice.CreateCommandEncoder();
|
||||
encoder.CopyTextureToTexture(©Src, ©Dst, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
|
||||
queue.Submit(1, &commands);
|
||||
dawnQueue.Submit(1, &commands);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace dawn_native { namespace vulkan {
|
||||
}
|
||||
|
||||
// Wraps a vulkan image from external memory
|
||||
wgpu::Texture WrapVulkanImage(wgpu::Device device,
|
||||
wgpu::Texture WrapVulkanImage(wgpu::Device dawnDevice,
|
||||
const wgpu::TextureDescriptor* textureDescriptor,
|
||||
int memoryFd,
|
||||
VkDeviceSize allocationSize,
|
||||
@@ -170,7 +170,7 @@ namespace dawn_native { namespace vulkan {
|
||||
descriptor.waitFDs = waitFDs;
|
||||
|
||||
WGPUTexture texture =
|
||||
dawn_native::vulkan::WrapVulkanImage(device.Get(), &descriptor);
|
||||
dawn_native::vulkan::WrapVulkanImage(dawnDevice.Get(), &descriptor);
|
||||
|
||||
if (expectValid) {
|
||||
EXPECT_NE(texture, nullptr) << "Failed to wrap image, are external memory / "
|
||||
@@ -185,8 +185,8 @@ namespace dawn_native { namespace vulkan {
|
||||
// Exports the signal from a wrapped texture and ignores it
|
||||
// We have to export the signal before destroying the wrapped texture else it's an
|
||||
// assertion failure
|
||||
void IgnoreSignalSemaphore(wgpu::Device device, wgpu::Texture wrappedTexture) {
|
||||
int fd = dawn_native::vulkan::ExportSignalSemaphoreOpaqueFD(device.Get(),
|
||||
void IgnoreSignalSemaphore(wgpu::Device dawnDevice, wgpu::Texture wrappedTexture) {
|
||||
int fd = dawn_native::vulkan::ExportSignalSemaphoreOpaqueFD(dawnDevice.Get(),
|
||||
wrappedTexture.Get());
|
||||
ASSERT_NE(fd, -1);
|
||||
close(fd);
|
||||
@@ -407,26 +407,28 @@ namespace dawn_native { namespace vulkan {
|
||||
int defaultFd;
|
||||
|
||||
// Clear a texture on a given device
|
||||
void ClearImage(wgpu::Device device, wgpu::Texture wrappedTexture, wgpu::Color clearColor) {
|
||||
void ClearImage(wgpu::Device dawnDevice,
|
||||
wgpu::Texture wrappedTexture,
|
||||
wgpu::Color clearColor) {
|
||||
wgpu::TextureView wrappedView = wrappedTexture.CreateView();
|
||||
|
||||
// Submit a clear operation
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({wrappedView}, {});
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = clearColor;
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::CommandEncoder encoder = dawnDevice.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||
pass.EndPass();
|
||||
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
|
||||
wgpu::Queue queue = device.CreateQueue();
|
||||
wgpu::Queue queue = dawnDevice.CreateQueue();
|
||||
queue.Submit(1, &commands);
|
||||
}
|
||||
|
||||
// Submits a 1x1x1 copy from source to destination
|
||||
void SimpleCopyTextureToTexture(wgpu::Device device,
|
||||
wgpu::Queue queue,
|
||||
void SimpleCopyTextureToTexture(wgpu::Device dawnDevice,
|
||||
wgpu::Queue dawnQueue,
|
||||
wgpu::Texture source,
|
||||
wgpu::Texture destination) {
|
||||
wgpu::TextureCopyView copySrc;
|
||||
@@ -443,11 +445,11 @@ namespace dawn_native { namespace vulkan {
|
||||
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::CommandEncoder encoder = dawnDevice.CreateCommandEncoder();
|
||||
encoder.CopyTextureToTexture(©Src, ©Dst, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
|
||||
queue.Submit(1, &commands);
|
||||
dawnQueue.Submit(1, &commands);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user