mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 08:57:26 +00:00
Rename several parameters to match WebGPU IDL
This patch renames the following parameters to match the latest WebGPU IDL: - BindGroupDescriptor.numBindings -> bindingCount - BindGroupLayoutDescriptor.numBindings -> bindingCount - BindGroupDescriptor.numBindings -> bindingCount - queue.submit(numCommands, ..) -> commandCount - RenderPipelineDescriptor.numColorStates -> colorStateCount - TextureDescriptor: arraySize -> arrayLayerCount levelCount -> mipLevelCount - TextureViewDescriptor: levelCount -> mipLevelCount layerCount -> arrayLayerCount BUG=dawn:80 Change-Id: I615842dd5754d1ae1ddff31e25403bb3161f0201 Reviewed-on: https://dawn-review.googlesource.com/c/4881 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
11d32c8095
commit
2030166137
@@ -41,10 +41,10 @@ class BindGroupValidationTest : public ValidationTest {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
descriptor.size = {16, 16, 1};
|
||||
descriptor.arraySize = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.levelCount = 1;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::Sampled;
|
||||
mSampledTexture = device.CreateTexture(&descriptor);
|
||||
mSampledTextureView = mSampledTexture.CreateDefaultTextureView();
|
||||
@@ -65,7 +65,7 @@ TEST_F(BindGroupValidationTest, NextInChainNullptr) {
|
||||
|
||||
dawn::BindGroupDescriptor descriptor;
|
||||
descriptor.layout = layout;
|
||||
descriptor.numBindings = 0;
|
||||
descriptor.bindingCount = 0;
|
||||
descriptor.bindings = nullptr;
|
||||
|
||||
// Control case: check that nextInChain = nullptr is valid
|
||||
@@ -77,8 +77,8 @@ TEST_F(BindGroupValidationTest, NextInChainNullptr) {
|
||||
ASSERT_DEVICE_ERROR(device.CreateBindGroup(&descriptor));
|
||||
}
|
||||
|
||||
// Check constraints on numBindings
|
||||
TEST_F(BindGroupValidationTest, NumBindingsMismatch) {
|
||||
// Check constraints on bindingCount
|
||||
TEST_F(BindGroupValidationTest, bindingCountMismatch) {
|
||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
|
||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler}
|
||||
});
|
||||
@@ -86,7 +86,7 @@ TEST_F(BindGroupValidationTest, NumBindingsMismatch) {
|
||||
// Control case: check that a descriptor with one binding is ok
|
||||
utils::MakeBindGroup(device, layout, {{0, mSampler}});
|
||||
|
||||
// Check that numBindings != layout.numBindings fails.
|
||||
// Check that bindingCount != layout.bindingCount fails.
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {}));
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ TEST_F(BindGroupValidationTest, SamplerBindingType) {
|
||||
|
||||
dawn::BindGroupDescriptor descriptor;
|
||||
descriptor.layout = layout;
|
||||
descriptor.numBindings = 1;
|
||||
descriptor.bindingCount = 1;
|
||||
descriptor.bindings = &binding;
|
||||
|
||||
// Not setting anything fails
|
||||
@@ -192,7 +192,7 @@ TEST_F(BindGroupValidationTest, TextureBindingType) {
|
||||
|
||||
dawn::BindGroupDescriptor descriptor;
|
||||
descriptor.layout = layout;
|
||||
descriptor.numBindings = 1;
|
||||
descriptor.bindingCount = 1;
|
||||
descriptor.bindings = &binding;
|
||||
|
||||
// Not setting anything fails
|
||||
@@ -218,9 +218,9 @@ TEST_F(BindGroupValidationTest, TextureBindingType) {
|
||||
viewDesc.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
viewDesc.dimension = dawn::TextureViewDimension::e2D;
|
||||
viewDesc.baseMipLevel = 0;
|
||||
viewDesc.levelCount = 0;
|
||||
viewDesc.mipLevelCount = 0;
|
||||
viewDesc.baseArrayLayer = 0;
|
||||
viewDesc.layerCount = 0;
|
||||
viewDesc.arrayLayerCount = 0;
|
||||
|
||||
dawn::TextureView errorView;
|
||||
ASSERT_DEVICE_ERROR(errorView = mSampledTexture.CreateTextureView(&viewDesc));
|
||||
@@ -247,7 +247,7 @@ TEST_F(BindGroupValidationTest, BufferBindingType) {
|
||||
|
||||
dawn::BindGroupDescriptor descriptor;
|
||||
descriptor.layout = layout;
|
||||
descriptor.numBindings = 1;
|
||||
descriptor.bindingCount = 1;
|
||||
descriptor.bindings = &binding;
|
||||
|
||||
// Not setting anything fails
|
||||
@@ -295,10 +295,10 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
descriptor.size = {16, 16, 1};
|
||||
descriptor.arraySize = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.levelCount = 1;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
dawn::Texture outputTexture = device.CreateTexture(&descriptor);
|
||||
dawn::TextureView outputTextureView = outputTexture.CreateDefaultTextureView();
|
||||
|
||||
@@ -181,9 +181,9 @@ TEST_F(CommandBufferValidationTest, TextureWithReadAndWriteUsage) {
|
||||
textureDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
textureDescriptor.dimension = dawn::TextureDimension::e2D;
|
||||
textureDescriptor.size = {1, 1, 1};
|
||||
textureDescriptor.arraySize = 1;
|
||||
textureDescriptor.arrayLayerCount = 1;
|
||||
textureDescriptor.sampleCount = 1;
|
||||
textureDescriptor.levelCount = 1;
|
||||
textureDescriptor.mipLevelCount = 1;
|
||||
dawn::Texture texture = device.CreateTexture(&textureDescriptor);
|
||||
dawn::TextureView view = texture.CreateDefaultTextureView();
|
||||
|
||||
|
||||
@@ -27,18 +27,18 @@ class CopyCommandTest : public ValidationTest {
|
||||
return device.CreateBuffer(&descriptor);
|
||||
}
|
||||
|
||||
dawn::Texture Create2DTexture(uint32_t width, uint32_t height, uint32_t levels,
|
||||
uint32_t arraySize, dawn::TextureFormat format,
|
||||
dawn::Texture Create2DTexture(uint32_t width, uint32_t height, uint32_t mipLevelCount,
|
||||
uint32_t arrayLayerCount, dawn::TextureFormat format,
|
||||
dawn::TextureUsageBit usage) {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
descriptor.size.width = width;
|
||||
descriptor.size.height = height;
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arraySize = arraySize;
|
||||
descriptor.arrayLayerCount = arrayLayerCount;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = format;
|
||||
descriptor.levelCount = levels;
|
||||
descriptor.mipLevelCount = mipLevelCount;
|
||||
descriptor.usage = usage;
|
||||
dawn::Texture tex = device.CreateTexture(&descriptor);
|
||||
return tex;
|
||||
|
||||
@@ -26,17 +26,17 @@ dawn::Texture CreateTexture(dawn::Device& device,
|
||||
dawn::TextureFormat format,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
uint32_t arraySize,
|
||||
uint32_t levelCount) {
|
||||
uint32_t arrayLayerCount,
|
||||
uint32_t mipLevelCount) {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
descriptor.dimension = dimension;
|
||||
descriptor.size.width = width;
|
||||
descriptor.size.height = height;
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arraySize = arraySize;
|
||||
descriptor.arrayLayerCount = arrayLayerCount;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = format;
|
||||
descriptor.levelCount = levelCount;
|
||||
descriptor.mipLevelCount = mipLevelCount;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
|
||||
return device.CreateTexture(&descriptor);
|
||||
@@ -239,7 +239,7 @@ TEST_F(RenderPassDescriptorValidationTest, FormatMismatch) {
|
||||
}
|
||||
}
|
||||
|
||||
// Currently only texture views with layerCount == 1 are allowed to be color and depth stencil
|
||||
// Currently only texture views with arrayLayerCount == 1 are allowed to be color and depth stencil
|
||||
// attachments
|
||||
TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepthStencil) {
|
||||
constexpr uint32_t kLevelCount = 1;
|
||||
@@ -258,15 +258,15 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
||||
dawn::TextureViewDescriptor baseDescriptor;
|
||||
baseDescriptor.dimension = dawn::TextureViewDimension::e2DArray;
|
||||
baseDescriptor.baseArrayLayer = 0;
|
||||
baseDescriptor.layerCount = kArrayLayers;
|
||||
baseDescriptor.arrayLayerCount = kArrayLayers;
|
||||
baseDescriptor.baseMipLevel = 0;
|
||||
baseDescriptor.levelCount = kLevelCount;
|
||||
baseDescriptor.mipLevelCount = kLevelCount;
|
||||
|
||||
// Using 2D array texture view with layerCount > 1 is not allowed for color
|
||||
// Using 2D array texture view with arrayLayerCount > 1 is not allowed for color
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = baseDescriptor;
|
||||
descriptor.format = kColorFormat;
|
||||
descriptor.layerCount = 5;
|
||||
descriptor.arrayLayerCount = 5;
|
||||
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
|
||||
dawn::RenderPassColorAttachmentDescriptor colorAttachment;
|
||||
@@ -281,11 +281,11 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
// Using 2D array texture view with layerCount > 1 is not allowed for depth stencil
|
||||
// Using 2D array texture view with arrayLayerCount > 1 is not allowed for depth stencil
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = baseDescriptor;
|
||||
descriptor.format = kDepthStencilFormat;
|
||||
descriptor.layerCount = 5;
|
||||
descriptor.arrayLayerCount = 5;
|
||||
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateTextureView(&descriptor);
|
||||
dawn::RenderPassDepthStencilAttachmentDescriptor depthStencilAttachment;
|
||||
@@ -306,7 +306,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
||||
dawn::TextureViewDescriptor descriptor = baseDescriptor;
|
||||
descriptor.format = kColorFormat;
|
||||
descriptor.baseArrayLayer = 0;
|
||||
descriptor.layerCount = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
|
||||
dawn::RenderPassColorAttachmentDescriptor colorAttachment;
|
||||
@@ -325,7 +325,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
||||
dawn::TextureViewDescriptor descriptor = baseDescriptor;
|
||||
descriptor.format = kDepthStencilFormat;
|
||||
descriptor.baseArrayLayer = 0;
|
||||
descriptor.layerCount = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
|
||||
dawn::TextureView depthStencilTextureView =
|
||||
depthStencilTexture.CreateTextureView(&descriptor);
|
||||
@@ -347,7 +347,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
||||
dawn::TextureViewDescriptor descriptor = baseDescriptor;
|
||||
descriptor.format = kColorFormat;
|
||||
descriptor.baseArrayLayer = kArrayLayers - 1;
|
||||
descriptor.layerCount = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
|
||||
dawn::RenderPassColorAttachmentDescriptor colorAttachment;
|
||||
@@ -366,7 +366,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
||||
dawn::TextureViewDescriptor descriptor = baseDescriptor;
|
||||
descriptor.format = kDepthStencilFormat;
|
||||
descriptor.baseArrayLayer = kArrayLayers - 1;
|
||||
descriptor.layerCount = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
|
||||
dawn::TextureView depthStencilTextureView =
|
||||
depthStencilTexture.CreateTextureView(&descriptor);
|
||||
@@ -384,7 +384,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
||||
}
|
||||
}
|
||||
|
||||
// Only 2D texture views with levelCount == 1 are allowed to be color attachments
|
||||
// Only 2D texture views with mipLevelCount == 1 are allowed to be color attachments
|
||||
TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepthStencil) {
|
||||
constexpr uint32_t kArrayLayers = 1;
|
||||
constexpr uint32_t kSize = 32;
|
||||
@@ -402,15 +402,15 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
|
||||
dawn::TextureViewDescriptor baseDescriptor;
|
||||
baseDescriptor.dimension = dawn::TextureViewDimension::e2D;
|
||||
baseDescriptor.baseArrayLayer = 0;
|
||||
baseDescriptor.layerCount = kArrayLayers;
|
||||
baseDescriptor.arrayLayerCount = kArrayLayers;
|
||||
baseDescriptor.baseMipLevel = 0;
|
||||
baseDescriptor.levelCount = kLevelCount;
|
||||
baseDescriptor.mipLevelCount = kLevelCount;
|
||||
|
||||
// Using 2D texture view with levelCount > 1 is not allowed for color
|
||||
// Using 2D texture view with mipLevelCount > 1 is not allowed for color
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = baseDescriptor;
|
||||
descriptor.format = kColorFormat;
|
||||
descriptor.levelCount = 2;
|
||||
descriptor.mipLevelCount = 2;
|
||||
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
|
||||
dawn::RenderPassColorAttachmentDescriptor colorAttachment;
|
||||
@@ -424,11 +424,11 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
// Using 2D texture view with levelCount > 1 is not allowed for depth stencil
|
||||
// Using 2D texture view with mipLevelCount > 1 is not allowed for depth stencil
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = baseDescriptor;
|
||||
descriptor.format = kDepthStencilFormat;
|
||||
descriptor.levelCount = 2;
|
||||
descriptor.mipLevelCount = 2;
|
||||
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateTextureView(&descriptor);
|
||||
dawn::RenderPassDepthStencilAttachmentDescriptor depthStencilAttachment;
|
||||
@@ -449,7 +449,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
|
||||
dawn::TextureViewDescriptor descriptor = baseDescriptor;
|
||||
descriptor.format = kColorFormat;
|
||||
descriptor.baseMipLevel = 0;
|
||||
descriptor.levelCount = 1;
|
||||
descriptor.mipLevelCount = 1;
|
||||
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
|
||||
dawn::RenderPassColorAttachmentDescriptor colorAttachment;
|
||||
@@ -468,7 +468,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
|
||||
dawn::TextureViewDescriptor descriptor = baseDescriptor;
|
||||
descriptor.format = kDepthStencilFormat;
|
||||
descriptor.baseMipLevel = 0;
|
||||
descriptor.levelCount = 1;
|
||||
descriptor.mipLevelCount = 1;
|
||||
|
||||
dawn::TextureView depthStencilTextureView =
|
||||
depthStencilTexture.CreateTextureView(&descriptor);
|
||||
@@ -490,7 +490,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
|
||||
dawn::TextureViewDescriptor descriptor = baseDescriptor;
|
||||
descriptor.format = kColorFormat;
|
||||
descriptor.baseMipLevel = kLevelCount - 1;
|
||||
descriptor.levelCount = 1;
|
||||
descriptor.mipLevelCount = 1;
|
||||
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
|
||||
dawn::RenderPassColorAttachmentDescriptor colorAttachment;
|
||||
@@ -509,7 +509,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
|
||||
dawn::TextureViewDescriptor descriptor = baseDescriptor;
|
||||
descriptor.format = kDepthStencilFormat;
|
||||
descriptor.baseMipLevel = kLevelCount - 1;
|
||||
descriptor.levelCount = 1;
|
||||
descriptor.mipLevelCount = 1;
|
||||
|
||||
dawn::TextureView depthStencilTextureView =
|
||||
depthStencilTexture.CreateTextureView(&descriptor);
|
||||
|
||||
@@ -57,7 +57,7 @@ TEST_F(RenderPipelineValidationTest, ColorState) {
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.cVertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.numColorStates = 1;
|
||||
descriptor.colorStateCount = 1;
|
||||
|
||||
device.CreateRenderPipeline(&descriptor);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ TEST_F(RenderPipelineValidationTest, ColorState) {
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.cVertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.numColorStates = 0;
|
||||
descriptor.colorStateCount = 0;
|
||||
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ dawn::TextureDescriptor CreateDefaultTextureDescriptor() {
|
||||
descriptor.size.width = kWidth;
|
||||
descriptor.size.height = kHeight;
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arraySize = kDefaultArraySize;
|
||||
descriptor.levelCount = kDefaultMipLevels;
|
||||
descriptor.arrayLayerCount = kDefaultArraySize;
|
||||
descriptor.mipLevelCount = kDefaultMipLevels;
|
||||
descriptor.sampleCount = kDefaultSampleCount;
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
descriptor.format = kDefaultTextureFormat;
|
||||
|
||||
@@ -26,7 +26,7 @@ constexpr uint32_t kDefaultMipLevels = 6u;
|
||||
constexpr dawn::TextureFormat kDefaultTextureFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
|
||||
dawn::Texture Create2DArrayTexture(dawn::Device& device,
|
||||
uint32_t arraySize,
|
||||
uint32_t arrayLayerCount,
|
||||
uint32_t width = kWidth,
|
||||
uint32_t height = kHeight) {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
@@ -34,10 +34,10 @@ dawn::Texture Create2DArrayTexture(dawn::Device& device,
|
||||
descriptor.size.width = width;
|
||||
descriptor.size.height = height;
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arraySize = arraySize;
|
||||
descriptor.arrayLayerCount = arrayLayerCount;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = kDefaultTextureFormat;
|
||||
descriptor.levelCount = kDefaultMipLevels;
|
||||
descriptor.mipLevelCount = kDefaultMipLevels;
|
||||
descriptor.usage = dawn::TextureUsageBit::Sampled;
|
||||
return device.CreateTexture(&descriptor);
|
||||
}
|
||||
@@ -47,9 +47,9 @@ dawn::TextureViewDescriptor CreateDefaultTextureViewDescriptor(dawn::TextureView
|
||||
descriptor.format = kDefaultTextureFormat;
|
||||
descriptor.dimension = dimension;
|
||||
descriptor.baseMipLevel = 0;
|
||||
descriptor.levelCount = kDefaultMipLevels;
|
||||
descriptor.mipLevelCount = kDefaultMipLevels;
|
||||
descriptor.baseArrayLayer = 0;
|
||||
descriptor.layerCount = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2D) {
|
||||
// It is OK to create a 2D texture view on a 2D texture.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.layerCount = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
texture.CreateTextureView(&descriptor);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2D) {
|
||||
// is 2D.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.layerCount = 2;
|
||||
descriptor.arrayLayerCount = 2;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
}
|
||||
|
||||
@@ -79,14 +79,14 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2D) {
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::e2DArray;
|
||||
descriptor.layerCount = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
texture.CreateTextureView(&descriptor);
|
||||
}
|
||||
|
||||
// It is an error to specify levelCount == 0.
|
||||
// It is an error to specify mipLevelCount == 0.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.levelCount = 0;
|
||||
descriptor.mipLevelCount = 0;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2D) {
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.baseMipLevel = kDefaultMipLevels - 1;
|
||||
descriptor.levelCount = 2;
|
||||
descriptor.mipLevelCount = 2;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
}
|
||||
}
|
||||
@@ -112,28 +112,28 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2DArray) {
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::e2D;
|
||||
descriptor.layerCount = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
texture.CreateTextureView(&descriptor);
|
||||
}
|
||||
|
||||
// It is OK to create a 2D array texture view on a 2D array texture.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.layerCount = kDefaultArrayLayers;
|
||||
descriptor.arrayLayerCount = kDefaultArrayLayers;
|
||||
texture.CreateTextureView(&descriptor);
|
||||
}
|
||||
|
||||
// It is an error to specify layerCount == 0.
|
||||
// It is an error to specify arrayLayerCount == 0.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.layerCount = 0;
|
||||
descriptor.arrayLayerCount = 0;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
}
|
||||
|
||||
// It is an error to make the array layer out of range.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.layerCount = kDefaultArrayLayers + 1;
|
||||
descriptor.arrayLayerCount = kDefaultArrayLayers + 1;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
}
|
||||
}
|
||||
@@ -147,35 +147,35 @@ TEST_F(TextureViewValidationTest, CreateCubeMapTextureView) {
|
||||
dawn::TextureViewDescriptor base2DArrayTextureViewDescriptor =
|
||||
CreateDefaultTextureViewDescriptor(dawn::TextureViewDimension::e2DArray);
|
||||
|
||||
// It is OK to create a cube map texture view with layerCount == 6.
|
||||
// It is OK to create a cube map texture view with arrayLayerCount == 6.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::Cube;
|
||||
descriptor.layerCount = 6;
|
||||
descriptor.arrayLayerCount = 6;
|
||||
texture.CreateTextureView(&descriptor);
|
||||
}
|
||||
|
||||
// It is an error to create a cube map texture view with layerCount != 6.
|
||||
// It is an error to create a cube map texture view with arrayLayerCount != 6.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::Cube;
|
||||
descriptor.layerCount = 3;
|
||||
descriptor.arrayLayerCount = 3;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
}
|
||||
|
||||
// It is OK to create a cube map array texture view with layerCount % 6 == 0.
|
||||
// It is OK to create a cube map array texture view with arrayLayerCount % 6 == 0.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::CubeArray;
|
||||
descriptor.layerCount = 12;
|
||||
descriptor.arrayLayerCount = 12;
|
||||
texture.CreateTextureView(&descriptor);
|
||||
}
|
||||
|
||||
// It is an error to create a cube map array texture view with layerCount % 6 != 0.
|
||||
// It is an error to create a cube map array texture view with arrayLayerCount % 6 != 0.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::CubeArray;
|
||||
descriptor.layerCount = 11;
|
||||
descriptor.arrayLayerCount = 11;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ TEST_F(TextureViewValidationTest, CreateCubeMapTextureView) {
|
||||
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::Cube;
|
||||
descriptor.layerCount = 6;
|
||||
descriptor.arrayLayerCount = 6;
|
||||
ASSERT_DEVICE_ERROR(nonSquareTexture.CreateTextureView(&descriptor));
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ TEST_F(TextureViewValidationTest, CreateCubeMapTextureView) {
|
||||
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::CubeArray;
|
||||
descriptor.layerCount = 12;
|
||||
descriptor.arrayLayerCount = 12;
|
||||
ASSERT_DEVICE_ERROR(nonSquareTexture.CreateTextureView(&descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,10 +90,10 @@ dawn::RenderPassDescriptor ValidationTest::CreateSimpleRenderPass() {
|
||||
descriptor.size.width = 640;
|
||||
descriptor.size.height = 480;
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arraySize = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.levelCount = 1;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
|
||||
auto colorBuffer = device.CreateTexture(&descriptor);
|
||||
@@ -149,10 +149,10 @@ ValidationTest::DummyRenderPass ValidationTest::CreateDummyRenderPass() {
|
||||
descriptor.size.width = dummy.width;
|
||||
descriptor.size.height = dummy.height;
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arraySize = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dummy.attachmentFormat;
|
||||
descriptor.levelCount = 1;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
dummy.attachment = device.CreateTexture(&descriptor);
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ TEST_F(WireArgumentTests, CStringArgument) {
|
||||
// Create the pipeline layout
|
||||
dawnPipelineLayoutDescriptor layoutDescriptor;
|
||||
layoutDescriptor.nextInChain = nullptr;
|
||||
layoutDescriptor.numBindGroupLayouts = 0;
|
||||
layoutDescriptor.bindGroupLayoutCount = 0;
|
||||
layoutDescriptor.bindGroupLayouts = nullptr;
|
||||
dawnPipelineLayout layout = dawnDeviceCreatePipelineLayout(device, &layoutDescriptor);
|
||||
dawnPipelineLayout apiLayout = api.GetNewPipelineLayout();
|
||||
@@ -153,7 +153,7 @@ TEST_F(WireArgumentTests, CStringArgument) {
|
||||
fragmentStage.entryPoint = "main";
|
||||
pipelineDescriptor.fragmentStage = &fragmentStage;
|
||||
|
||||
pipelineDescriptor.numColorStates = 1;
|
||||
pipelineDescriptor.colorStateCount = 1;
|
||||
dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
|
||||
pipelineDescriptor.colorStates = colorStatesPtr;
|
||||
|
||||
@@ -288,7 +288,7 @@ TEST_F(WireArgumentTests, StructureOfValuesArgument) {
|
||||
// Test that the wire is able to send structures that contain objects
|
||||
TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) {
|
||||
dawnBindGroupLayoutDescriptor bglDescriptor;
|
||||
bglDescriptor.numBindings = 0;
|
||||
bglDescriptor.bindingCount = 0;
|
||||
bglDescriptor.bindings = nullptr;
|
||||
|
||||
dawnBindGroupLayout bgl = dawnDeviceCreateBindGroupLayout(device, &bglDescriptor);
|
||||
@@ -297,7 +297,7 @@ TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) {
|
||||
|
||||
dawnPipelineLayoutDescriptor descriptor;
|
||||
descriptor.nextInChain = nullptr;
|
||||
descriptor.numBindGroupLayouts = 1;
|
||||
descriptor.bindGroupLayoutCount = 1;
|
||||
descriptor.bindGroupLayouts = &bgl;
|
||||
|
||||
dawnDeviceCreatePipelineLayout(device, &descriptor);
|
||||
@@ -305,7 +305,7 @@ TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) {
|
||||
apiDevice,
|
||||
MatchesLambda([apiBgl](const dawnPipelineLayoutDescriptor* desc) -> bool {
|
||||
return desc->nextInChain == nullptr &&
|
||||
desc->numBindGroupLayouts == 1 &&
|
||||
desc->bindGroupLayoutCount == 1 &&
|
||||
desc->bindGroupLayouts[0] == apiBgl;
|
||||
})))
|
||||
.WillOnce(Return(nullptr));
|
||||
@@ -326,7 +326,7 @@ TEST_F(WireArgumentTests, StructureOfStructureArrayArgument) {
|
||||
DAWN_BINDING_TYPE_UNIFORM_BUFFER},
|
||||
};
|
||||
dawnBindGroupLayoutDescriptor bglDescriptor;
|
||||
bglDescriptor.numBindings = NUM_BINDINGS;
|
||||
bglDescriptor.bindingCount = NUM_BINDINGS;
|
||||
bglDescriptor.bindings = bindings;
|
||||
|
||||
dawnDeviceCreateBindGroupLayout(device, &bglDescriptor);
|
||||
@@ -343,7 +343,7 @@ TEST_F(WireArgumentTests, StructureOfStructureArrayArgument) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return desc->nextInChain == nullptr && desc->numBindings == 3;
|
||||
return desc->nextInChain == nullptr && desc->bindingCount == 3;
|
||||
})))
|
||||
.WillOnce(Return(apiBgl));
|
||||
|
||||
@@ -357,14 +357,14 @@ TEST_F(WireArgumentTests, DISABLED_NullptrInArray) {
|
||||
|
||||
dawnPipelineLayoutDescriptor descriptor;
|
||||
descriptor.nextInChain = nullptr;
|
||||
descriptor.numBindGroupLayouts = 1;
|
||||
descriptor.bindGroupLayoutCount = 1;
|
||||
descriptor.bindGroupLayouts = &nullBGL;
|
||||
|
||||
dawnDeviceCreatePipelineLayout(device, &descriptor);
|
||||
EXPECT_CALL(api,
|
||||
DeviceCreatePipelineLayout(
|
||||
apiDevice, MatchesLambda([](const dawnPipelineLayoutDescriptor* desc) -> bool {
|
||||
return desc->nextInChain == nullptr && desc->numBindGroupLayouts == 1 &&
|
||||
return desc->nextInChain == nullptr && desc->bindGroupLayoutCount == 1 &&
|
||||
desc->bindGroupLayouts[0] == nullptr;
|
||||
})))
|
||||
.WillOnce(Return(nullptr));
|
||||
|
||||
@@ -28,7 +28,7 @@ class WireOptionalTests : public WireTest {
|
||||
TEST_F(WireOptionalTests, OptionalObjectValue) {
|
||||
dawnBindGroupLayoutDescriptor bglDesc;
|
||||
bglDesc.nextInChain = nullptr;
|
||||
bglDesc.numBindings = 0;
|
||||
bglDesc.bindingCount = 0;
|
||||
dawnBindGroupLayout bgl = dawnDeviceCreateBindGroupLayout(device, &bglDesc);
|
||||
|
||||
dawnBindGroupLayout apiBindGroupLayout = api.GetNewBindGroupLayout();
|
||||
@@ -45,13 +45,13 @@ TEST_F(WireOptionalTests, OptionalObjectValue) {
|
||||
dawnBindGroupDescriptor bgDesc;
|
||||
bgDesc.nextInChain = nullptr;
|
||||
bgDesc.layout = bgl;
|
||||
bgDesc.numBindings = 1;
|
||||
bgDesc.bindingCount = 1;
|
||||
bgDesc.bindings = &binding;
|
||||
|
||||
dawnDeviceCreateBindGroup(device, &bgDesc);
|
||||
EXPECT_CALL(api, DeviceCreateBindGroup(
|
||||
apiDevice, MatchesLambda([](const dawnBindGroupDescriptor* desc) -> bool {
|
||||
return desc->nextInChain == nullptr && desc->numBindings == 1 &&
|
||||
return desc->nextInChain == nullptr && desc->bindingCount == 1 &&
|
||||
desc->bindings[0].binding == 0 &&
|
||||
desc->bindings[0].sampler == nullptr &&
|
||||
desc->bindings[0].buffer == nullptr &&
|
||||
@@ -116,7 +116,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
|
||||
// Create the pipeline layout
|
||||
dawnPipelineLayoutDescriptor layoutDescriptor;
|
||||
layoutDescriptor.nextInChain = nullptr;
|
||||
layoutDescriptor.numBindGroupLayouts = 0;
|
||||
layoutDescriptor.bindGroupLayoutCount = 0;
|
||||
layoutDescriptor.bindGroupLayouts = nullptr;
|
||||
dawnPipelineLayout layout = dawnDeviceCreatePipelineLayout(device, &layoutDescriptor);
|
||||
dawnPipelineLayout apiLayout = api.GetNewPipelineLayout();
|
||||
@@ -138,7 +138,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
|
||||
fragmentStage.entryPoint = "main";
|
||||
pipelineDescriptor.fragmentStage = &fragmentStage;
|
||||
|
||||
pipelineDescriptor.numColorStates = 1;
|
||||
pipelineDescriptor.colorStateCount = 1;
|
||||
dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
|
||||
pipelineDescriptor.colorStates = colorStatesPtr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user