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:
Jiawei Shao 2019-02-21 00:45:19 +00:00 committed by Commit Bot service account
parent 11d32c8095
commit 2030166137
47 changed files with 236 additions and 234 deletions

View File

@ -43,8 +43,8 @@
"extensible": true, "extensible": true,
"members": [ "members": [
{"name": "layout", "type": "bind group layout"}, {"name": "layout", "type": "bind group layout"},
{"name": "num bindings", "type": "uint32_t"}, {"name": "binding count", "type": "uint32_t"},
{"name": "bindings", "type": "bind group binding", "annotation": "const*", "length": "num bindings"} {"name": "bindings", "type": "bind group binding", "annotation": "const*", "length": "binding count"}
] ]
}, },
"bind group layout": { "bind group layout": {
@ -63,8 +63,8 @@
"category": "structure", "category": "structure",
"extensible": true, "extensible": true,
"members": [ "members": [
{"name": "num bindings", "type": "uint32_t"}, {"name": "binding count", "type": "uint32_t"},
{"name": "bindings", "type": "bind group layout binding", "annotation": "const*", "length": "num bindings"} {"name": "bindings", "type": "bind group layout binding", "annotation": "const*", "length": "binding count"}
] ]
}, },
"binding type": { "binding type": {
@ -680,8 +680,8 @@
"category": "structure", "category": "structure",
"extensible": true, "extensible": true,
"members": [ "members": [
{"name": "num bind group layouts", "type": "uint32_t"}, {"name": "bind group layout count", "type": "uint32_t"},
{"name": "bind group layouts", "type": "bind group layout", "annotation": "const*", "length": "num bind group layouts"} {"name": "bind group layouts", "type": "bind group layout", "annotation": "const*", "length": "bind group layout count"}
] ]
}, },
"pipeline stage descriptor": { "pipeline stage descriptor": {
@ -708,8 +708,8 @@
{ {
"name": "submit", "name": "submit",
"args": [ "args": [
{"name": "num commands", "type": "uint32_t"}, {"name": "command count", "type": "uint32_t"},
{"name": "commands", "type": "command buffer", "annotation": "const*", "length": "num commands"} {"name": "commands", "type": "command buffer", "annotation": "const*", "length": "command count"}
] ]
}, },
{ {
@ -894,8 +894,8 @@
{"name": "primitive topology", "type": "primitive topology"}, {"name": "primitive topology", "type": "primitive topology"},
{"name": "sample count", "type": "uint32_t"}, {"name": "sample count", "type": "uint32_t"},
{"name": "depth stencil state", "type": "depth stencil state descriptor", "annotation": "const*", "optional": true}, {"name": "depth stencil state", "type": "depth stencil state descriptor", "annotation": "const*", "optional": true},
{"name": "num color states", "type": "uint32_t"}, {"name": "color state count", "type": "uint32_t"},
{"name": "color states", "type": "color state descriptor", "annotation": "const*const*", "length": "num color states"} {"name": "color states", "type": "color state descriptor", "annotation": "const*const*", "length": "color state count"}
] ]
}, },
"sampler": { "sampler": {
@ -1040,9 +1040,9 @@
{"name": "usage", "type": "texture usage bit"}, {"name": "usage", "type": "texture usage bit"},
{"name": "dimension", "type": "texture dimension"}, {"name": "dimension", "type": "texture dimension"},
{"name": "size", "type": "extent 3D"}, {"name": "size", "type": "extent 3D"},
{"name": "array size", "type": "uint32_t"}, {"name": "array layer count", "type": "uint32_t"},
{"name": "format", "type": "texture format"}, {"name": "format", "type": "texture format"},
{"name": "level count", "type": "uint32_t"}, {"name": "mip level count", "type": "uint32_t"},
{"name": "sample count", "type": "uint32_t"} {"name": "sample count", "type": "uint32_t"}
] ]
}, },
@ -1084,9 +1084,9 @@
{"name": "format", "type": "texture format"}, {"name": "format", "type": "texture format"},
{"name": "dimension", "type": "texture view dimension"}, {"name": "dimension", "type": "texture view dimension"},
{"name": "base mip level", "type": "uint32_t"}, {"name": "base mip level", "type": "uint32_t"},
{"name": "level count", "type": "uint32_t"}, {"name": "mip level count", "type": "uint32_t"},
{"name": "base array layer", "type": "uint32_t"}, {"name": "base array layer", "type": "uint32_t"},
{"name": "layer count", "type": "uint32_t"} {"name": "array layer count", "type": "uint32_t"}
], ],
"TODO": [ "TODO": [
"jiawei.shao@intel.com: Allow choosing the aspect (depth vs. stencil)" "jiawei.shao@intel.com: Allow choosing the aspect (depth vs. stencil)"

View File

@ -83,13 +83,13 @@ void init() {
colorStateDescriptor.colorBlend = blendDescriptor; colorStateDescriptor.colorBlend = blendDescriptor;
colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL; colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL;
descriptor.numColorStates = 1; descriptor.colorStateCount = 1;
dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor}; dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
descriptor.colorStates = colorStatesPtr; descriptor.colorStates = colorStatesPtr;
dawnPipelineLayoutDescriptor pl; dawnPipelineLayoutDescriptor pl;
pl.nextInChain = nullptr; pl.nextInChain = nullptr;
pl.numBindGroupLayouts = 0; pl.bindGroupLayoutCount = 0;
pl.bindGroupLayouts = nullptr; pl.bindGroupLayouts = nullptr;
descriptor.layout = dawnDeviceCreatePipelineLayout(device, &pl); descriptor.layout = dawnDeviceCreatePipelineLayout(device, &pl);

View File

@ -54,10 +54,10 @@ void initTextures() {
descriptor.size.width = 1024; descriptor.size.width = 1024;
descriptor.size.height = 1024; descriptor.size.height = 1024;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled; descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
texture = device.CreateTexture(&descriptor); texture = device.CreateTexture(&descriptor);

View File

@ -161,10 +161,10 @@ dawn::TextureView CreateDefaultDepthStencilView(const dawn::Device& device) {
descriptor.size.width = 640; descriptor.size.width = 640;
descriptor.size.height = 480; descriptor.size.height = 480;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::D32FloatS8Uint; descriptor.format = dawn::TextureFormat::D32FloatS8Uint;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsageBit::OutputAttachment; descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
auto depthStencilTexture = device.CreateTexture(&descriptor); auto depthStencilTexture = device.CreateTexture(&descriptor);
return depthStencilTexture.CreateDefaultTextureView(); return depthStencilTexture.CreateDefaultTextureView();

View File

@ -419,10 +419,10 @@ namespace {
descriptor.size.width = iImage.width; descriptor.size.width = iImage.width;
descriptor.size.height = iImage.height; descriptor.size.height = iImage.height;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = format; descriptor.format = format;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled; descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
auto oTexture = device.CreateTexture(&descriptor); auto oTexture = device.CreateTexture(&descriptor);
// TODO: release this texture // TODO: release this texture

View File

@ -100,12 +100,12 @@ namespace dawn_native {
const BindGroupLayoutBase::LayoutBindingInfo& layoutInfo = const BindGroupLayoutBase::LayoutBindingInfo& layoutInfo =
descriptor->layout->GetBindingInfo(); descriptor->layout->GetBindingInfo();
if (descriptor->numBindings != layoutInfo.mask.count()) { if (descriptor->bindingCount != layoutInfo.mask.count()) {
return DAWN_VALIDATION_ERROR("numBindings mismatch"); return DAWN_VALIDATION_ERROR("numBindings mismatch");
} }
std::bitset<kMaxBindingsPerGroup> bindingsSet; std::bitset<kMaxBindingsPerGroup> bindingsSet;
for (uint32_t i = 0; i < descriptor->numBindings; ++i) { for (uint32_t i = 0; i < descriptor->bindingCount; ++i) {
const BindGroupBinding& binding = descriptor->bindings[i]; const BindGroupBinding& binding = descriptor->bindings[i];
uint32_t bindingIndex = binding.binding; uint32_t bindingIndex = binding.binding;
@ -155,7 +155,7 @@ namespace dawn_native {
BindGroupBase::BindGroupBase(DeviceBase* device, const BindGroupDescriptor* descriptor) BindGroupBase::BindGroupBase(DeviceBase* device, const BindGroupDescriptor* descriptor)
: ObjectBase(device), mLayout(descriptor->layout) { : ObjectBase(device), mLayout(descriptor->layout) {
for (uint32_t i = 0; i < descriptor->numBindings; ++i) { for (uint32_t i = 0; i < descriptor->bindingCount; ++i) {
const BindGroupBinding& binding = descriptor->bindings[i]; const BindGroupBinding& binding = descriptor->bindings[i];
uint32_t bindingIndex = binding.binding; uint32_t bindingIndex = binding.binding;

View File

@ -30,7 +30,7 @@ namespace dawn_native {
} }
std::bitset<kMaxBindingsPerGroup> bindingsSet; std::bitset<kMaxBindingsPerGroup> bindingsSet;
for (uint32_t i = 0; i < descriptor->numBindings; ++i) { for (uint32_t i = 0; i < descriptor->bindingCount; ++i) {
auto& binding = descriptor->bindings[i]; auto& binding = descriptor->bindings[i];
DAWN_TRY(ValidateShaderStageBit(binding.visibility)); DAWN_TRY(ValidateShaderStageBit(binding.visibility));
DAWN_TRY(ValidateBindingType(binding.type)); DAWN_TRY(ValidateBindingType(binding.type));
@ -80,7 +80,7 @@ namespace dawn_native {
const BindGroupLayoutDescriptor* descriptor, const BindGroupLayoutDescriptor* descriptor,
bool blueprint) bool blueprint)
: ObjectBase(device), mIsBlueprint(blueprint) { : ObjectBase(device), mIsBlueprint(blueprint) {
for (uint32_t i = 0; i < descriptor->numBindings; ++i) { for (uint32_t i = 0; i < descriptor->bindingCount; ++i) {
auto& binding = descriptor->bindings[i]; auto& binding = descriptor->bindings[i];
uint32_t index = binding.binding; uint32_t index = binding.binding;

View File

@ -26,11 +26,11 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR("nextInChain must be nullptr"); return DAWN_VALIDATION_ERROR("nextInChain must be nullptr");
} }
if (descriptor->numBindGroupLayouts > kMaxBindGroups) { if (descriptor->bindGroupLayoutCount > kMaxBindGroups) {
return DAWN_VALIDATION_ERROR("too many bind group layouts"); return DAWN_VALIDATION_ERROR("too many bind group layouts");
} }
for (uint32_t i = 0; i < descriptor->numBindGroupLayouts; ++i) { for (uint32_t i = 0; i < descriptor->bindGroupLayoutCount; ++i) {
DAWN_TRY(device->ValidateObject(descriptor->bindGroupLayouts[i])); DAWN_TRY(device->ValidateObject(descriptor->bindGroupLayouts[i]));
} }
return {}; return {};
@ -41,8 +41,8 @@ namespace dawn_native {
PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device, PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device,
const PipelineLayoutDescriptor* descriptor) const PipelineLayoutDescriptor* descriptor)
: ObjectBase(device) { : ObjectBase(device) {
ASSERT(descriptor->numBindGroupLayouts <= kMaxBindGroups); ASSERT(descriptor->bindGroupLayoutCount <= kMaxBindGroups);
for (uint32_t group = 0; group < descriptor->numBindGroupLayouts; ++group) { for (uint32_t group = 0; group < descriptor->bindGroupLayoutCount; ++group) {
mBindGroupLayouts[group] = descriptor->bindGroupLayouts[group]; mBindGroupLayouts[group] = descriptor->bindGroupLayouts[group];
mMask.set(group); mMask.set(group);
} }

View File

@ -28,13 +28,13 @@ namespace dawn_native {
QueueBase::QueueBase(DeviceBase* device) : ObjectBase(device) { QueueBase::QueueBase(DeviceBase* device) : ObjectBase(device) {
} }
void QueueBase::Submit(uint32_t numCommands, CommandBufferBase* const* commands) { void QueueBase::Submit(uint32_t commandCount, CommandBufferBase* const* commands) {
if (GetDevice()->ConsumedError(ValidateSubmit(numCommands, commands))) { if (GetDevice()->ConsumedError(ValidateSubmit(commandCount, commands))) {
return; return;
} }
ASSERT(!IsError()); ASSERT(!IsError());
SubmitImpl(numCommands, commands); SubmitImpl(commandCount, commands);
} }
void QueueBase::Signal(FenceBase* fence, uint64_t signalValue) { void QueueBase::Signal(FenceBase* fence, uint64_t signalValue) {
@ -47,10 +47,11 @@ namespace dawn_native {
GetDevice()->GetFenceSignalTracker()->UpdateFenceOnComplete(fence, signalValue); GetDevice()->GetFenceSignalTracker()->UpdateFenceOnComplete(fence, signalValue);
} }
MaybeError QueueBase::ValidateSubmit(uint32_t numCommands, CommandBufferBase* const* commands) { MaybeError QueueBase::ValidateSubmit(uint32_t commandCount,
CommandBufferBase* const* commands) {
DAWN_TRY(GetDevice()->ValidateObject(this)); DAWN_TRY(GetDevice()->ValidateObject(this));
for (uint32_t i = 0; i < numCommands; ++i) { for (uint32_t i = 0; i < commandCount; ++i) {
// TODO(cwallez@chromium.org): Remove this once CommandBufferBuilder doesn't use the // TODO(cwallez@chromium.org): Remove this once CommandBufferBuilder doesn't use the
// builder mechanism anymore. // builder mechanism anymore.
if (commands[i] == nullptr) { if (commands[i] == nullptr) {

View File

@ -29,13 +29,13 @@ namespace dawn_native {
QueueBase(DeviceBase* device); QueueBase(DeviceBase* device);
// Dawn API // Dawn API
void Submit(uint32_t numCommands, CommandBufferBase* const* commands); void Submit(uint32_t commandCount, CommandBufferBase* const* commands);
void Signal(FenceBase* fence, uint64_t signalValue); void Signal(FenceBase* fence, uint64_t signalValue);
private: private:
virtual void SubmitImpl(uint32_t numCommands, CommandBufferBase* const* commands) = 0; virtual void SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) = 0;
MaybeError ValidateSubmit(uint32_t numCommands, CommandBufferBase* const* commands); MaybeError ValidateSubmit(uint32_t commandCount, CommandBufferBase* const* commands);
MaybeError ValidateSignal(const FenceBase* fence, uint64_t signalValue); MaybeError ValidateSignal(const FenceBase* fence, uint64_t signalValue);
}; };

View File

@ -122,15 +122,15 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR("Sample count must be one"); return DAWN_VALIDATION_ERROR("Sample count must be one");
} }
if (descriptor->numColorStates > kMaxColorAttachments) { if (descriptor->colorStateCount > kMaxColorAttachments) {
return DAWN_VALIDATION_ERROR("Color States number exceeds maximum"); return DAWN_VALIDATION_ERROR("Color States number exceeds maximum");
} }
if (descriptor->numColorStates == 0 && !descriptor->depthStencilState) { if (descriptor->colorStateCount == 0 && !descriptor->depthStencilState) {
return DAWN_VALIDATION_ERROR("Should have at least one attachment"); return DAWN_VALIDATION_ERROR("Should have at least one attachment");
} }
for (uint32_t i = 0; i < descriptor->numColorStates; ++i) { for (uint32_t i = 0; i < descriptor->colorStateCount; ++i) {
DAWN_TRY(ValidateColorStateDescriptor(descriptor->colorStates[i])); DAWN_TRY(ValidateColorStateDescriptor(descriptor->colorStates[i]));
} }
@ -195,7 +195,7 @@ namespace dawn_native {
ExtractModuleData(dawn::ShaderStage::Vertex, descriptor->vertexStage->module); ExtractModuleData(dawn::ShaderStage::Vertex, descriptor->vertexStage->module);
ExtractModuleData(dawn::ShaderStage::Fragment, descriptor->fragmentStage->module); ExtractModuleData(dawn::ShaderStage::Fragment, descriptor->fragmentStage->module);
for (uint32_t i = 0; i < descriptor->numColorStates; ++i) { for (uint32_t i = 0; i < descriptor->colorStateCount; ++i) {
mColorAttachmentsSet.set(i); mColorAttachmentsSet.set(i);
mColorStates[i] = *descriptor->colorStates[i]; mColorStates[i] = *descriptor->colorStates[i];
} }

View File

@ -110,10 +110,10 @@ namespace dawn_native {
descriptor.size.width = mWidth; descriptor.size.width = mWidth;
descriptor.size.height = mHeight; descriptor.size.height = mHeight;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = mFormat; descriptor.format = mFormat;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = mAllowedUsage; descriptor.usage = mAllowedUsage;
auto* texture = GetNextTextureImpl(&descriptor); auto* texture = GetNextTextureImpl(&descriptor);

View File

@ -95,7 +95,7 @@ namespace dawn_native {
const TextureBase* texture, const TextureBase* texture,
const TextureViewDescriptor* descriptor) { const TextureViewDescriptor* descriptor) {
if (!IsArrayLayerValidForTextureViewDimension(descriptor->dimension, if (!IsArrayLayerValidForTextureViewDimension(descriptor->dimension,
descriptor->layerCount)) { descriptor->arrayLayerCount)) {
return DAWN_VALIDATION_ERROR( return DAWN_VALIDATION_ERROR(
"The dimension of the texture view is not compatible with the layer count"); "The dimension of the texture view is not compatible with the layer count");
} }
@ -121,9 +121,9 @@ namespace dawn_native {
TextureViewDescriptor descriptor; TextureViewDescriptor descriptor;
descriptor.format = texture->GetFormat(); descriptor.format = texture->GetFormat();
descriptor.baseArrayLayer = 0; descriptor.baseArrayLayer = 0;
descriptor.layerCount = texture->GetArrayLayers(); descriptor.arrayLayerCount = texture->GetArrayLayers();
descriptor.baseMipLevel = 0; descriptor.baseMipLevel = 0;
descriptor.levelCount = texture->GetNumMipLevels(); descriptor.mipLevelCount = texture->GetNumMipLevels();
// TODO(jiawei.shao@intel.com): support all texture dimensions. // TODO(jiawei.shao@intel.com): support all texture dimensions.
switch (texture->GetDimension()) { switch (texture->GetDimension()) {
@ -155,8 +155,8 @@ namespace dawn_native {
// TODO(jiawei.shao@intel.com): check stuff based on the dimension // TODO(jiawei.shao@intel.com): check stuff based on the dimension
if (descriptor->size.width == 0 || descriptor->size.height == 0 || if (descriptor->size.width == 0 || descriptor->size.height == 0 ||
descriptor->size.depth == 0 || descriptor->arraySize == 0 || descriptor->size.depth == 0 || descriptor->arrayLayerCount == 0 ||
descriptor->levelCount == 0) { descriptor->mipLevelCount == 0) {
return DAWN_VALIDATION_ERROR("Cannot create an empty texture"); return DAWN_VALIDATION_ERROR("Cannot create an empty texture");
} }
@ -175,16 +175,16 @@ namespace dawn_native {
DAWN_TRY(ValidateTextureFormat(descriptor->format)); DAWN_TRY(ValidateTextureFormat(descriptor->format));
// TODO(jiawei.shao@intel.com): check stuff based on resource limits // TODO(jiawei.shao@intel.com): check stuff based on resource limits
if (descriptor->layerCount == 0 || descriptor->levelCount == 0) { if (descriptor->arrayLayerCount == 0 || descriptor->mipLevelCount == 0) {
return DAWN_VALIDATION_ERROR("Cannot create an empty texture view"); return DAWN_VALIDATION_ERROR("Cannot create an empty texture view");
} }
if (uint64_t(descriptor->baseArrayLayer) + uint64_t(descriptor->layerCount) > if (uint64_t(descriptor->baseArrayLayer) + uint64_t(descriptor->arrayLayerCount) >
uint64_t(texture->GetArrayLayers())) { uint64_t(texture->GetArrayLayers())) {
return DAWN_VALIDATION_ERROR("Texture view array-layer out of range"); return DAWN_VALIDATION_ERROR("Texture view array-layer out of range");
} }
if (uint64_t(descriptor->baseMipLevel) + uint64_t(descriptor->levelCount) > if (uint64_t(descriptor->baseMipLevel) + uint64_t(descriptor->mipLevelCount) >
uint64_t(texture->GetNumMipLevels())) { uint64_t(texture->GetNumMipLevels())) {
return DAWN_VALIDATION_ERROR("Texture view mip-level out of range"); return DAWN_VALIDATION_ERROR("Texture view mip-level out of range");
} }
@ -288,8 +288,8 @@ namespace dawn_native {
mDimension(descriptor->dimension), mDimension(descriptor->dimension),
mFormat(descriptor->format), mFormat(descriptor->format),
mSize(descriptor->size), mSize(descriptor->size),
mArrayLayers(descriptor->arraySize), mArrayLayerCount(descriptor->arrayLayerCount),
mNumMipLevels(descriptor->levelCount), mMipLevelCount(descriptor->mipLevelCount),
mUsage(descriptor->usage) { mUsage(descriptor->usage) {
} }
@ -316,11 +316,11 @@ namespace dawn_native {
} }
uint32_t TextureBase::GetArrayLayers() const { uint32_t TextureBase::GetArrayLayers() const {
ASSERT(!IsError()); ASSERT(!IsError());
return mArrayLayers; return mArrayLayerCount;
} }
uint32_t TextureBase::GetNumMipLevels() const { uint32_t TextureBase::GetNumMipLevels() const {
ASSERT(!IsError()); ASSERT(!IsError());
return mNumMipLevels; return mMipLevelCount;
} }
dawn::TextureUsageBit TextureBase::GetUsage() const { dawn::TextureUsageBit TextureBase::GetUsage() const {
ASSERT(!IsError()); ASSERT(!IsError());
@ -353,9 +353,9 @@ namespace dawn_native {
mTexture(texture), mTexture(texture),
mFormat(descriptor->format), mFormat(descriptor->format),
mBaseMipLevel(descriptor->baseMipLevel), mBaseMipLevel(descriptor->baseMipLevel),
mLevelCount(descriptor->levelCount), mMipLevelCount(descriptor->mipLevelCount),
mBaseArrayLayer(descriptor->baseArrayLayer), mBaseArrayLayer(descriptor->baseArrayLayer),
mLayerCount(descriptor->layerCount) { mArrayLayerCount(descriptor->arrayLayerCount) {
} }
TextureViewBase::TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag) TextureViewBase::TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag)
@ -389,7 +389,7 @@ namespace dawn_native {
uint32_t TextureViewBase::GetLevelCount() const { uint32_t TextureViewBase::GetLevelCount() const {
ASSERT(!IsError()); ASSERT(!IsError());
return mLevelCount; return mMipLevelCount;
} }
uint32_t TextureViewBase::GetBaseArrayLayer() const { uint32_t TextureViewBase::GetBaseArrayLayer() const {
@ -399,6 +399,6 @@ namespace dawn_native {
uint32_t TextureViewBase::GetLayerCount() const { uint32_t TextureViewBase::GetLayerCount() const {
ASSERT(!IsError()); ASSERT(!IsError());
return mLayerCount; return mArrayLayerCount;
} }
} // namespace dawn_native } // namespace dawn_native

View File

@ -68,8 +68,8 @@ namespace dawn_native {
dawn::TextureDimension mDimension; dawn::TextureDimension mDimension;
dawn::TextureFormat mFormat; dawn::TextureFormat mFormat;
Extent3D mSize; Extent3D mSize;
uint32_t mArrayLayers; uint32_t mArrayLayerCount;
uint32_t mNumMipLevels; uint32_t mMipLevelCount;
dawn::TextureUsageBit mUsage = dawn::TextureUsageBit::None; dawn::TextureUsageBit mUsage = dawn::TextureUsageBit::None;
}; };
@ -95,9 +95,9 @@ namespace dawn_native {
dawn::TextureFormat mFormat; dawn::TextureFormat mFormat;
uint32_t mBaseMipLevel; uint32_t mBaseMipLevel;
uint32_t mLevelCount; uint32_t mMipLevelCount;
uint32_t mBaseArrayLayer; uint32_t mBaseArrayLayer;
uint32_t mLayerCount; uint32_t mArrayLayerCount;
}; };
} // namespace dawn_native } // namespace dawn_native

View File

@ -22,13 +22,13 @@ namespace dawn_native { namespace d3d12 {
Queue::Queue(Device* device) : QueueBase(device) { Queue::Queue(Device* device) : QueueBase(device) {
} }
void Queue::SubmitImpl(uint32_t numCommands, CommandBufferBase* const* commands) { void Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
Device* device = ToBackend(GetDevice()); Device* device = ToBackend(GetDevice());
device->Tick(); device->Tick();
device->OpenCommandList(&mCommandList); device->OpenCommandList(&mCommandList);
for (uint32_t i = 0; i < numCommands; ++i) { for (uint32_t i = 0; i < commandCount; ++i) {
ToBackend(commands[i])->RecordCommands(mCommandList, i); ToBackend(commands[i])->RecordCommands(mCommandList, i);
} }
ASSERT_SUCCESS(mCommandList->Close()); ASSERT_SUCCESS(mCommandList->Close());

View File

@ -29,7 +29,7 @@ namespace dawn_native { namespace d3d12 {
Queue(Device* device); Queue(Device* device);
private: private:
void SubmitImpl(uint32_t numCommands, CommandBufferBase* const* commands) override; void SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
ComPtr<ID3D12GraphicsCommandList> mCommandList; ComPtr<ID3D12GraphicsCommandList> mCommandList;
}; };

View File

@ -203,9 +203,9 @@ namespace dawn_native { namespace d3d12 {
case dawn::TextureViewDimension::e2DArray: case dawn::TextureViewDimension::e2DArray:
ASSERT(texture->GetDimension() == dawn::TextureDimension::e2D); ASSERT(texture->GetDimension() == dawn::TextureDimension::e2D);
mSrvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DARRAY; mSrvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DARRAY;
mSrvDesc.Texture2DArray.ArraySize = descriptor->layerCount; mSrvDesc.Texture2DArray.ArraySize = descriptor->arrayLayerCount;
mSrvDesc.Texture2DArray.FirstArraySlice = descriptor->baseArrayLayer; mSrvDesc.Texture2DArray.FirstArraySlice = descriptor->baseArrayLayer;
mSrvDesc.Texture2DArray.MipLevels = descriptor->levelCount; mSrvDesc.Texture2DArray.MipLevels = descriptor->mipLevelCount;
mSrvDesc.Texture2DArray.MostDetailedMip = descriptor->baseMipLevel; mSrvDesc.Texture2DArray.MostDetailedMip = descriptor->baseMipLevel;
mSrvDesc.Texture2DArray.PlaneSlice = 0; mSrvDesc.Texture2DArray.PlaneSlice = 0;
mSrvDesc.Texture2DArray.ResourceMinLODClamp = 0; mSrvDesc.Texture2DArray.ResourceMinLODClamp = 0;
@ -213,12 +213,12 @@ namespace dawn_native { namespace d3d12 {
case dawn::TextureViewDimension::Cube: case dawn::TextureViewDimension::Cube:
case dawn::TextureViewDimension::CubeArray: case dawn::TextureViewDimension::CubeArray:
ASSERT(texture->GetDimension() == dawn::TextureDimension::e2D); ASSERT(texture->GetDimension() == dawn::TextureDimension::e2D);
ASSERT(descriptor->layerCount % 6 == 0); ASSERT(descriptor->arrayLayerCount % 6 == 0);
mSrvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBEARRAY; mSrvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBEARRAY;
mSrvDesc.TextureCubeArray.First2DArrayFace = descriptor->baseArrayLayer; mSrvDesc.TextureCubeArray.First2DArrayFace = descriptor->baseArrayLayer;
mSrvDesc.TextureCubeArray.NumCubes = descriptor->layerCount / 6; mSrvDesc.TextureCubeArray.NumCubes = descriptor->arrayLayerCount / 6;
mSrvDesc.TextureCubeArray.MostDetailedMip = descriptor->baseMipLevel; mSrvDesc.TextureCubeArray.MostDetailedMip = descriptor->baseMipLevel;
mSrvDesc.TextureCubeArray.MipLevels = descriptor->levelCount; mSrvDesc.TextureCubeArray.MipLevels = descriptor->mipLevelCount;
mSrvDesc.TextureCubeArray.ResourceMinLODClamp = 0; mSrvDesc.TextureCubeArray.ResourceMinLODClamp = 0;
break; break;
default: default:

View File

@ -27,7 +27,7 @@ namespace dawn_native { namespace metal {
Queue(Device* device); Queue(Device* device);
private: private:
void SubmitImpl(uint32_t numCommands, CommandBufferBase* const* commands) override; void SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
}; };
}} // namespace dawn_native::metal }} // namespace dawn_native::metal

View File

@ -22,12 +22,12 @@ namespace dawn_native { namespace metal {
Queue::Queue(Device* device) : QueueBase(device) { Queue::Queue(Device* device) : QueueBase(device) {
} }
void Queue::SubmitImpl(uint32_t numCommands, CommandBufferBase* const* commands) { void Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
Device* device = ToBackend(GetDevice()); Device* device = ToBackend(GetDevice());
device->Tick(); device->Tick();
id<MTLCommandBuffer> commandBuffer = device->GetPendingCommandBuffer(); id<MTLCommandBuffer> commandBuffer = device->GetPendingCommandBuffer();
for (uint32_t i = 0; i < numCommands; ++i) { for (uint32_t i = 0; i < commandCount; ++i) {
ToBackend(commands[i])->FillCommands(commandBuffer); ToBackend(commands[i])->FillCommands(commandBuffer);
} }

View File

@ -97,11 +97,11 @@ namespace dawn_native { namespace metal {
return true; return true;
} }
if (texture->GetArrayLayers() != textureViewDescriptor->layerCount) { if (texture->GetArrayLayers() != textureViewDescriptor->arrayLayerCount) {
return true; return true;
} }
if (texture->GetNumMipLevels() != textureViewDescriptor->levelCount) { if (texture->GetNumMipLevels() != textureViewDescriptor->mipLevelCount) {
return true; return true;
} }
@ -162,8 +162,9 @@ namespace dawn_native { namespace metal {
} else { } else {
MTLPixelFormat format = MetalPixelFormat(descriptor->format); MTLPixelFormat format = MetalPixelFormat(descriptor->format);
MTLTextureType textureViewType = MetalTextureViewType(descriptor->dimension); MTLTextureType textureViewType = MetalTextureViewType(descriptor->dimension);
auto mipLevelRange = NSMakeRange(descriptor->baseMipLevel, descriptor->levelCount); auto mipLevelRange = NSMakeRange(descriptor->baseMipLevel, descriptor->mipLevelCount);
auto arrayLayerRange = NSMakeRange(descriptor->baseArrayLayer, descriptor->layerCount); auto arrayLayerRange =
NSMakeRange(descriptor->baseArrayLayer, descriptor->arrayLayerCount);
mMtlTextureView = [mtlTexture newTextureViewWithPixelFormat:format mMtlTextureView = [mtlTexture newTextureViewWithPixelFormat:format
textureType:textureViewType textureType:textureViewType

View File

@ -172,7 +172,7 @@ namespace dawn_native { namespace null {
~Queue(); ~Queue();
private: private:
void SubmitImpl(uint32_t numCommands, CommandBufferBase* const* commands) override; void SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
}; };
class SwapChain : public SwapChainBase { class SwapChain : public SwapChainBase {

View File

@ -22,10 +22,10 @@ namespace dawn_native { namespace opengl {
Queue::Queue(Device* device) : QueueBase(device) { Queue::Queue(Device* device) : QueueBase(device) {
} }
void Queue::SubmitImpl(uint32_t numCommands, CommandBufferBase* const* commands) { void Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
Device* device = ToBackend(GetDevice()); Device* device = ToBackend(GetDevice());
for (uint32_t i = 0; i < numCommands; ++i) { for (uint32_t i = 0; i < commandCount; ++i) {
ToBackend(commands[i])->Execute(); ToBackend(commands[i])->Execute();
} }

View File

@ -27,7 +27,7 @@ namespace dawn_native { namespace opengl {
Queue(Device* device); Queue(Device* device);
private: private:
void SubmitImpl(uint32_t numCommands, CommandBufferBase* const* commands) override; void SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
}; };
}} // namespace dawn_native::opengl }} // namespace dawn_native::opengl

View File

@ -25,10 +25,10 @@ namespace dawn_native { namespace opengl {
namespace { namespace {
GLenum TargetForDimensionAndArrayLayers(dawn::TextureDimension dimension, GLenum TargetForDimensionAndArrayLayers(dawn::TextureDimension dimension,
uint32_t arrayLayer) { uint32_t arrayLayerCount) {
switch (dimension) { switch (dimension) {
case dawn::TextureDimension::e2D: case dawn::TextureDimension::e2D:
return (arrayLayer > 1) ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D; return (arrayLayerCount > 1) ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
default: default:
UNREACHABLE(); UNREACHABLE();
return GL_TEXTURE_2D; return GL_TEXTURE_2D;
@ -154,8 +154,8 @@ namespace dawn_native { namespace opengl {
const Texture* textureGL = ToBackend(texture); const Texture* textureGL = ToBackend(texture);
TextureFormatInfo textureViewFormat = GetGLFormatInfo(descriptor->format); TextureFormatInfo textureViewFormat = GetGLFormatInfo(descriptor->format);
glTextureView(mHandle, mTarget, textureGL->GetHandle(), textureViewFormat.internalFormat, glTextureView(mHandle, mTarget, textureGL->GetHandle(), textureViewFormat.internalFormat,
descriptor->baseMipLevel, descriptor->levelCount, descriptor->baseArrayLayer, descriptor->baseMipLevel, descriptor->mipLevelCount,
descriptor->layerCount); descriptor->baseArrayLayer, descriptor->arrayLayerCount);
} }
TextureView::~TextureView() { TextureView::~TextureView() {

View File

@ -25,13 +25,13 @@ namespace dawn_native { namespace vulkan {
Queue::~Queue() { Queue::~Queue() {
} }
void Queue::SubmitImpl(uint32_t numCommands, CommandBufferBase* const* commands) { void Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
Device* device = ToBackend(GetDevice()); Device* device = ToBackend(GetDevice());
device->Tick(); device->Tick();
VkCommandBuffer commandBuffer = device->GetPendingCommandBuffer(); VkCommandBuffer commandBuffer = device->GetPendingCommandBuffer();
for (uint32_t i = 0; i < numCommands; ++i) { for (uint32_t i = 0; i < commandCount; ++i) {
ToBackend(commands[i])->RecordCommands(commandBuffer); ToBackend(commands[i])->RecordCommands(commandBuffer);
} }

View File

@ -28,7 +28,7 @@ namespace dawn_native { namespace vulkan {
~Queue(); ~Queue();
private: private:
void SubmitImpl(uint32_t numCommands, CommandBufferBase* const* commands) override; void SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
}; };
}} // namespace dawn_native::vulkan }} // namespace dawn_native::vulkan

View File

@ -372,9 +372,9 @@ namespace dawn_native { namespace vulkan {
VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A}; VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A};
createInfo.subresourceRange.aspectMask = VulkanAspectMask(descriptor->format); createInfo.subresourceRange.aspectMask = VulkanAspectMask(descriptor->format);
createInfo.subresourceRange.baseMipLevel = descriptor->baseMipLevel; createInfo.subresourceRange.baseMipLevel = descriptor->baseMipLevel;
createInfo.subresourceRange.levelCount = descriptor->levelCount; createInfo.subresourceRange.levelCount = descriptor->mipLevelCount;
createInfo.subresourceRange.baseArrayLayer = descriptor->baseArrayLayer; createInfo.subresourceRange.baseArrayLayer = descriptor->baseArrayLayer;
createInfo.subresourceRange.layerCount = descriptor->layerCount; createInfo.subresourceRange.layerCount = descriptor->arrayLayerCount;
if (device->fn.CreateImageView(device->GetVkDevice(), &createInfo, nullptr, &mHandle) != if (device->fn.CreateImageView(device->GetVkDevice(), &createInfo, nullptr, &mHandle) !=
VK_SUCCESS) { VK_SUCCESS) {

View File

@ -38,7 +38,7 @@ protected:
std::vector<dawn::BindGroupLayout> bindingInitializer) const { std::vector<dawn::BindGroupLayout> bindingInitializer) const {
dawn::PipelineLayoutDescriptor descriptor; dawn::PipelineLayoutDescriptor descriptor;
descriptor.numBindGroupLayouts = bindingInitializer.size(); descriptor.bindGroupLayoutCount = bindingInitializer.size();
descriptor.bindGroupLayouts = bindingInitializer.data(); descriptor.bindGroupLayouts = bindingInitializer.data();
return device.CreatePipelineLayout(&descriptor); return device.CreatePipelineLayout(&descriptor);
@ -242,10 +242,10 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
descriptor.size.width = kRTSize; descriptor.size.width = kRTSize;
descriptor.size.height = kRTSize; descriptor.size.height = kRTSize;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled; descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
dawn::Texture texture = device.CreateTexture(&descriptor); dawn::Texture texture = device.CreateTexture(&descriptor);
dawn::TextureView textureView = texture.CreateDefaultTextureView(); dawn::TextureView textureView = texture.CreateDefaultTextureView();

View File

@ -758,10 +758,10 @@ TEST_P(ColorStateTest, IndependentColorState) {
descriptor.size.width = kRTSize; descriptor.size.width = kRTSize;
descriptor.size.height = kRTSize; descriptor.size.height = kRTSize;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
for (uint32_t i = 0; i < 4; ++i) { for (uint32_t i = 0; i < 4; ++i) {
@ -808,7 +808,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
baseDescriptor.layout = pipelineLayout; baseDescriptor.layout = pipelineLayout;
baseDescriptor.cVertexStage.module = vsModule; baseDescriptor.cVertexStage.module = vsModule;
baseDescriptor.cFragmentStage.module = fsModule; baseDescriptor.cFragmentStage.module = fsModule;
baseDescriptor.numColorStates = 4; baseDescriptor.colorStateCount = 4;
basePipeline = device.CreateRenderPipeline(&baseDescriptor); basePipeline = device.CreateRenderPipeline(&baseDescriptor);
@ -816,7 +816,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
testDescriptor.layout = pipelineLayout; testDescriptor.layout = pipelineLayout;
testDescriptor.cVertexStage.module = vsModule; testDescriptor.cVertexStage.module = vsModule;
testDescriptor.cFragmentStage.module = fsModule; testDescriptor.cFragmentStage.module = fsModule;
testDescriptor.numColorStates = 4; testDescriptor.colorStateCount = 4;
// set color states // set color states
dawn::BlendDescriptor blend1; dawn::BlendDescriptor blend1;

View File

@ -78,10 +78,10 @@ class CopyTests_T2B : public CopyTests {
descriptor.size.width = textureSpec.width; descriptor.size.width = textureSpec.width;
descriptor.size.height = textureSpec.height; descriptor.size.height = textureSpec.height;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = textureSpec.arraySize; descriptor.arrayLayerCount = textureSpec.arraySize;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
descriptor.levelCount = textureSpec.level + 1; descriptor.mipLevelCount = textureSpec.level + 1;
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc; descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc;
dawn::Texture texture = device.CreateTexture(&descriptor); dawn::Texture texture = device.CreateTexture(&descriptor);
@ -188,10 +188,10 @@ protected:
descriptor.size.width = textureSpec.width; descriptor.size.width = textureSpec.width;
descriptor.size.height = textureSpec.height; descriptor.size.height = textureSpec.height;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
descriptor.levelCount = textureSpec.level + 1; descriptor.mipLevelCount = textureSpec.level + 1;
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc; descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc;
dawn::Texture texture = device.CreateTexture(&descriptor); dawn::Texture texture = device.CreateTexture(&descriptor);

View File

@ -30,10 +30,10 @@ class DepthStencilStateTest : public DawnTest {
renderTargetDescriptor.size.width = kRTSize; renderTargetDescriptor.size.width = kRTSize;
renderTargetDescriptor.size.height = kRTSize; renderTargetDescriptor.size.height = kRTSize;
renderTargetDescriptor.size.depth = 1; renderTargetDescriptor.size.depth = 1;
renderTargetDescriptor.arraySize = 1; renderTargetDescriptor.arrayLayerCount = 1;
renderTargetDescriptor.sampleCount = 1; renderTargetDescriptor.sampleCount = 1;
renderTargetDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; renderTargetDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
renderTargetDescriptor.levelCount = 1; renderTargetDescriptor.mipLevelCount = 1;
renderTargetDescriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; renderTargetDescriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
renderTarget = device.CreateTexture(&renderTargetDescriptor); renderTarget = device.CreateTexture(&renderTargetDescriptor);
@ -44,10 +44,10 @@ class DepthStencilStateTest : public DawnTest {
depthDescriptor.size.width = kRTSize; depthDescriptor.size.width = kRTSize;
depthDescriptor.size.height = kRTSize; depthDescriptor.size.height = kRTSize;
depthDescriptor.size.depth = 1; depthDescriptor.size.depth = 1;
depthDescriptor.arraySize = 1; depthDescriptor.arrayLayerCount = 1;
depthDescriptor.sampleCount = 1; depthDescriptor.sampleCount = 1;
depthDescriptor.format = dawn::TextureFormat::D32FloatS8Uint; depthDescriptor.format = dawn::TextureFormat::D32FloatS8Uint;
depthDescriptor.levelCount = 1; depthDescriptor.mipLevelCount = 1;
depthDescriptor.usage = dawn::TextureUsageBit::OutputAttachment; depthDescriptor.usage = dawn::TextureUsageBit::OutputAttachment;
depthTexture = device.CreateTexture(&depthDescriptor); depthTexture = device.CreateTexture(&depthDescriptor);

View File

@ -62,10 +62,10 @@ class RenderPassLoadOpTests : public DawnTest {
descriptor.size.width = kRTSize; descriptor.size.width = kRTSize;
descriptor.size.height = kRTSize; descriptor.size.height = kRTSize;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
renderTarget = device.CreateTexture(&descriptor); renderTarget = device.CreateTexture(&descriptor);

View File

@ -59,10 +59,10 @@ protected:
descriptor.size.width = kRTSize; descriptor.size.width = kRTSize;
descriptor.size.height = kRTSize; descriptor.size.height = kRTSize;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = kFormat; descriptor.format = kFormat;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = descriptor.usage =
dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
return device.CreateTexture(&descriptor); return device.CreateTexture(&descriptor);

View File

@ -86,10 +86,10 @@ protected:
descriptor.size.width = 2; descriptor.size.width = 2;
descriptor.size.height = 2; descriptor.size.height = 2;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled; descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
dawn::Texture texture = device.CreateTexture(&descriptor); dawn::Texture texture = device.CreateTexture(&descriptor);

View File

@ -30,18 +30,18 @@ namespace {
dawn::Texture Create2DTexture(dawn::Device device, dawn::Texture Create2DTexture(dawn::Device device,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t layerCount, uint32_t arrayLayerCount,
uint32_t levelCount, uint32_t mipLevelCount,
dawn::TextureUsageBit usage) { dawn::TextureUsageBit usage) {
dawn::TextureDescriptor descriptor; dawn::TextureDescriptor descriptor;
descriptor.dimension = dawn::TextureDimension::e2D; descriptor.dimension = dawn::TextureDimension::e2D;
descriptor.size.width = width; descriptor.size.width = width;
descriptor.size.height = height; descriptor.size.height = height;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = layerCount; descriptor.arrayLayerCount = arrayLayerCount;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = kDefaultFormat; descriptor.format = kDefaultFormat;
descriptor.levelCount = levelCount; descriptor.mipLevelCount = mipLevelCount;
descriptor.usage = usage; descriptor.usage = usage;
return device.CreateTexture(&descriptor); return device.CreateTexture(&descriptor);
} }
@ -110,22 +110,22 @@ protected:
mVSModule = CreateDefaultVertexShaderModule(device); mVSModule = CreateDefaultVertexShaderModule(device);
} }
void initTexture(uint32_t layerCount, uint32_t levelCount) { void initTexture(uint32_t arrayLayerCount, uint32_t mipLevelCount) {
ASSERT(layerCount > 0 && levelCount > 0); ASSERT(arrayLayerCount > 0 && mipLevelCount > 0);
const uint32_t textureWidthLevel0 = 1 << levelCount; const uint32_t textureWidthLevel0 = 1 << mipLevelCount;
const uint32_t textureHeightLevel0 = 1 << levelCount; const uint32_t textureHeightLevel0 = 1 << mipLevelCount;
constexpr dawn::TextureUsageBit kUsage = constexpr dawn::TextureUsageBit kUsage =
dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled; dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
mTexture = Create2DTexture( mTexture = Create2DTexture(
device, textureWidthLevel0, textureHeightLevel0, layerCount, levelCount, kUsage); device, textureWidthLevel0, textureHeightLevel0, arrayLayerCount, mipLevelCount, kUsage);
mDefaultTextureViewDescriptor.dimension = dawn::TextureViewDimension::e2DArray; mDefaultTextureViewDescriptor.dimension = dawn::TextureViewDimension::e2DArray;
mDefaultTextureViewDescriptor.format = kDefaultFormat; mDefaultTextureViewDescriptor.format = kDefaultFormat;
mDefaultTextureViewDescriptor.baseMipLevel = 0; mDefaultTextureViewDescriptor.baseMipLevel = 0;
mDefaultTextureViewDescriptor.levelCount = levelCount; mDefaultTextureViewDescriptor.mipLevelCount = mipLevelCount;
mDefaultTextureViewDescriptor.baseArrayLayer = 0; mDefaultTextureViewDescriptor.baseArrayLayer = 0;
mDefaultTextureViewDescriptor.layerCount = layerCount; mDefaultTextureViewDescriptor.arrayLayerCount = arrayLayerCount;
// Create a texture with pixel = (0, 0, 0, level * 10 + layer + 1) at level `level` and // Create a texture with pixel = (0, 0, 0, level * 10 + layer + 1) at level `level` and
// layer `layer`. // layer `layer`.
@ -135,8 +135,8 @@ protected:
ASSERT_LE(textureWidthLevel0, kPixelsPerRowPitch); ASSERT_LE(textureWidthLevel0, kPixelsPerRowPitch);
dawn::CommandEncoder encoder = device.CreateCommandEncoder(); dawn::CommandEncoder encoder = device.CreateCommandEncoder();
for (uint32_t layer = 0; layer < layerCount; ++layer) { for (uint32_t layer = 0; layer < arrayLayerCount; ++layer) {
for (uint32_t level = 0; level < levelCount; ++level) { for (uint32_t level = 0; level < mipLevelCount; ++level) {
const uint32_t texWidth = textureWidthLevel0 >> level; const uint32_t texWidth = textureWidthLevel0 >> level;
const uint32_t texHeight = textureHeightLevel0 >> level; const uint32_t texHeight = textureHeightLevel0 >> level;
@ -207,9 +207,9 @@ protected:
dawn::TextureViewDescriptor descriptor = mDefaultTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = mDefaultTextureViewDescriptor;
descriptor.dimension = dawn::TextureViewDimension::e2D; descriptor.dimension = dawn::TextureViewDimension::e2D;
descriptor.baseArrayLayer = textureViewBaseLayer; descriptor.baseArrayLayer = textureViewBaseLayer;
descriptor.layerCount = 1; descriptor.arrayLayerCount = 1;
descriptor.baseMipLevel = textureViewBaseMipLevel; descriptor.baseMipLevel = textureViewBaseMipLevel;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
dawn::TextureView textureView = mTexture.CreateTextureView(&descriptor); dawn::TextureView textureView = mTexture.CreateTextureView(&descriptor);
const char* fragmentShader = R"( const char* fragmentShader = R"(
@ -246,9 +246,9 @@ protected:
dawn::TextureViewDescriptor descriptor = mDefaultTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = mDefaultTextureViewDescriptor;
descriptor.dimension = dawn::TextureViewDimension::e2DArray; descriptor.dimension = dawn::TextureViewDimension::e2DArray;
descriptor.baseArrayLayer = textureViewBaseLayer; descriptor.baseArrayLayer = textureViewBaseLayer;
descriptor.layerCount = kTextureViewLayerCount; descriptor.arrayLayerCount = kTextureViewLayerCount;
descriptor.baseMipLevel = textureViewBaseMipLevel; descriptor.baseMipLevel = textureViewBaseMipLevel;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
dawn::TextureView textureView = mTexture.CreateTextureView(&descriptor); dawn::TextureView textureView = mTexture.CreateTextureView(&descriptor);
const char* fragmentShader = R"( const char* fragmentShader = R"(
@ -327,7 +327,7 @@ protected:
descriptor.dimension = (isCubeMapArray) ? descriptor.dimension = (isCubeMapArray) ?
dawn::TextureViewDimension::CubeArray : dawn::TextureViewDimension::Cube; dawn::TextureViewDimension::CubeArray : dawn::TextureViewDimension::Cube;
descriptor.baseArrayLayer = textureViewBaseLayer; descriptor.baseArrayLayer = textureViewBaseLayer;
descriptor.layerCount = textureViewLayerCount; descriptor.arrayLayerCount = textureViewLayerCount;
dawn::TextureView cubeMapTextureView = mTexture.CreateTextureView(&descriptor); dawn::TextureView cubeMapTextureView = mTexture.CreateTextureView(&descriptor);
@ -484,9 +484,9 @@ class TextureViewRenderingTest : public DawnTest {
descriptor.format = kDefaultFormat; descriptor.format = kDefaultFormat;
descriptor.dimension = dimension; descriptor.dimension = dimension;
descriptor.baseArrayLayer = textureViewBaseLayer; descriptor.baseArrayLayer = textureViewBaseLayer;
descriptor.layerCount = 1; descriptor.arrayLayerCount = 1;
descriptor.baseMipLevel = textureViewBaseLevel; descriptor.baseMipLevel = textureViewBaseLevel;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
dawn::TextureView textureView = texture.CreateTextureView(&descriptor); dawn::TextureView textureView = texture.CreateTextureView(&descriptor);
dawn::ShaderModule vsModule = CreateDefaultVertexShaderModule(device); dawn::ShaderModule vsModule = CreateDefaultVertexShaderModule(device);

View File

@ -41,10 +41,10 @@ class BindGroupValidationTest : public ValidationTest {
dawn::TextureDescriptor descriptor; dawn::TextureDescriptor descriptor;
descriptor.dimension = dawn::TextureDimension::e2D; descriptor.dimension = dawn::TextureDimension::e2D;
descriptor.size = {16, 16, 1}; descriptor.size = {16, 16, 1};
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsageBit::Sampled; descriptor.usage = dawn::TextureUsageBit::Sampled;
mSampledTexture = device.CreateTexture(&descriptor); mSampledTexture = device.CreateTexture(&descriptor);
mSampledTextureView = mSampledTexture.CreateDefaultTextureView(); mSampledTextureView = mSampledTexture.CreateDefaultTextureView();
@ -65,7 +65,7 @@ TEST_F(BindGroupValidationTest, NextInChainNullptr) {
dawn::BindGroupDescriptor descriptor; dawn::BindGroupDescriptor descriptor;
descriptor.layout = layout; descriptor.layout = layout;
descriptor.numBindings = 0; descriptor.bindingCount = 0;
descriptor.bindings = nullptr; descriptor.bindings = nullptr;
// Control case: check that nextInChain = nullptr is valid // Control case: check that nextInChain = nullptr is valid
@ -77,8 +77,8 @@ TEST_F(BindGroupValidationTest, NextInChainNullptr) {
ASSERT_DEVICE_ERROR(device.CreateBindGroup(&descriptor)); ASSERT_DEVICE_ERROR(device.CreateBindGroup(&descriptor));
} }
// Check constraints on numBindings // Check constraints on bindingCount
TEST_F(BindGroupValidationTest, NumBindingsMismatch) { TEST_F(BindGroupValidationTest, bindingCountMismatch) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, { dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler} {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 // Control case: check that a descriptor with one binding is ok
utils::MakeBindGroup(device, layout, {{0, mSampler}}); 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, {})); ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {}));
} }
@ -142,7 +142,7 @@ TEST_F(BindGroupValidationTest, SamplerBindingType) {
dawn::BindGroupDescriptor descriptor; dawn::BindGroupDescriptor descriptor;
descriptor.layout = layout; descriptor.layout = layout;
descriptor.numBindings = 1; descriptor.bindingCount = 1;
descriptor.bindings = &binding; descriptor.bindings = &binding;
// Not setting anything fails // Not setting anything fails
@ -192,7 +192,7 @@ TEST_F(BindGroupValidationTest, TextureBindingType) {
dawn::BindGroupDescriptor descriptor; dawn::BindGroupDescriptor descriptor;
descriptor.layout = layout; descriptor.layout = layout;
descriptor.numBindings = 1; descriptor.bindingCount = 1;
descriptor.bindings = &binding; descriptor.bindings = &binding;
// Not setting anything fails // Not setting anything fails
@ -218,9 +218,9 @@ TEST_F(BindGroupValidationTest, TextureBindingType) {
viewDesc.format = dawn::TextureFormat::R8G8B8A8Unorm; viewDesc.format = dawn::TextureFormat::R8G8B8A8Unorm;
viewDesc.dimension = dawn::TextureViewDimension::e2D; viewDesc.dimension = dawn::TextureViewDimension::e2D;
viewDesc.baseMipLevel = 0; viewDesc.baseMipLevel = 0;
viewDesc.levelCount = 0; viewDesc.mipLevelCount = 0;
viewDesc.baseArrayLayer = 0; viewDesc.baseArrayLayer = 0;
viewDesc.layerCount = 0; viewDesc.arrayLayerCount = 0;
dawn::TextureView errorView; dawn::TextureView errorView;
ASSERT_DEVICE_ERROR(errorView = mSampledTexture.CreateTextureView(&viewDesc)); ASSERT_DEVICE_ERROR(errorView = mSampledTexture.CreateTextureView(&viewDesc));
@ -247,7 +247,7 @@ TEST_F(BindGroupValidationTest, BufferBindingType) {
dawn::BindGroupDescriptor descriptor; dawn::BindGroupDescriptor descriptor;
descriptor.layout = layout; descriptor.layout = layout;
descriptor.numBindings = 1; descriptor.bindingCount = 1;
descriptor.bindings = &binding; descriptor.bindings = &binding;
// Not setting anything fails // Not setting anything fails
@ -295,10 +295,10 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
dawn::TextureDescriptor descriptor; dawn::TextureDescriptor descriptor;
descriptor.dimension = dawn::TextureDimension::e2D; descriptor.dimension = dawn::TextureDimension::e2D;
descriptor.size = {16, 16, 1}; descriptor.size = {16, 16, 1};
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsageBit::OutputAttachment; descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
dawn::Texture outputTexture = device.CreateTexture(&descriptor); dawn::Texture outputTexture = device.CreateTexture(&descriptor);
dawn::TextureView outputTextureView = outputTexture.CreateDefaultTextureView(); dawn::TextureView outputTextureView = outputTexture.CreateDefaultTextureView();

View File

@ -181,9 +181,9 @@ TEST_F(CommandBufferValidationTest, TextureWithReadAndWriteUsage) {
textureDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; textureDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
textureDescriptor.dimension = dawn::TextureDimension::e2D; textureDescriptor.dimension = dawn::TextureDimension::e2D;
textureDescriptor.size = {1, 1, 1}; textureDescriptor.size = {1, 1, 1};
textureDescriptor.arraySize = 1; textureDescriptor.arrayLayerCount = 1;
textureDescriptor.sampleCount = 1; textureDescriptor.sampleCount = 1;
textureDescriptor.levelCount = 1; textureDescriptor.mipLevelCount = 1;
dawn::Texture texture = device.CreateTexture(&textureDescriptor); dawn::Texture texture = device.CreateTexture(&textureDescriptor);
dawn::TextureView view = texture.CreateDefaultTextureView(); dawn::TextureView view = texture.CreateDefaultTextureView();

View File

@ -27,18 +27,18 @@ class CopyCommandTest : public ValidationTest {
return device.CreateBuffer(&descriptor); return device.CreateBuffer(&descriptor);
} }
dawn::Texture Create2DTexture(uint32_t width, uint32_t height, uint32_t levels, dawn::Texture Create2DTexture(uint32_t width, uint32_t height, uint32_t mipLevelCount,
uint32_t arraySize, dawn::TextureFormat format, uint32_t arrayLayerCount, dawn::TextureFormat format,
dawn::TextureUsageBit usage) { dawn::TextureUsageBit usage) {
dawn::TextureDescriptor descriptor; dawn::TextureDescriptor descriptor;
descriptor.dimension = dawn::TextureDimension::e2D; descriptor.dimension = dawn::TextureDimension::e2D;
descriptor.size.width = width; descriptor.size.width = width;
descriptor.size.height = height; descriptor.size.height = height;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = arraySize; descriptor.arrayLayerCount = arrayLayerCount;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = format; descriptor.format = format;
descriptor.levelCount = levels; descriptor.mipLevelCount = mipLevelCount;
descriptor.usage = usage; descriptor.usage = usage;
dawn::Texture tex = device.CreateTexture(&descriptor); dawn::Texture tex = device.CreateTexture(&descriptor);
return tex; return tex;

View File

@ -26,17 +26,17 @@ dawn::Texture CreateTexture(dawn::Device& device,
dawn::TextureFormat format, dawn::TextureFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t arraySize, uint32_t arrayLayerCount,
uint32_t levelCount) { uint32_t mipLevelCount) {
dawn::TextureDescriptor descriptor; dawn::TextureDescriptor descriptor;
descriptor.dimension = dimension; descriptor.dimension = dimension;
descriptor.size.width = width; descriptor.size.width = width;
descriptor.size.height = height; descriptor.size.height = height;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = arraySize; descriptor.arrayLayerCount = arrayLayerCount;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = format; descriptor.format = format;
descriptor.levelCount = levelCount; descriptor.mipLevelCount = mipLevelCount;
descriptor.usage = dawn::TextureUsageBit::OutputAttachment; descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
return device.CreateTexture(&descriptor); 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 // attachments
TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepthStencil) { TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepthStencil) {
constexpr uint32_t kLevelCount = 1; constexpr uint32_t kLevelCount = 1;
@ -258,15 +258,15 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
dawn::TextureViewDescriptor baseDescriptor; dawn::TextureViewDescriptor baseDescriptor;
baseDescriptor.dimension = dawn::TextureViewDimension::e2DArray; baseDescriptor.dimension = dawn::TextureViewDimension::e2DArray;
baseDescriptor.baseArrayLayer = 0; baseDescriptor.baseArrayLayer = 0;
baseDescriptor.layerCount = kArrayLayers; baseDescriptor.arrayLayerCount = kArrayLayers;
baseDescriptor.baseMipLevel = 0; 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; dawn::TextureViewDescriptor descriptor = baseDescriptor;
descriptor.format = kColorFormat; descriptor.format = kColorFormat;
descriptor.layerCount = 5; descriptor.arrayLayerCount = 5;
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor); dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
dawn::RenderPassColorAttachmentDescriptor colorAttachment; dawn::RenderPassColorAttachmentDescriptor colorAttachment;
@ -281,11 +281,11 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
.GetResult(); .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; dawn::TextureViewDescriptor descriptor = baseDescriptor;
descriptor.format = kDepthStencilFormat; descriptor.format = kDepthStencilFormat;
descriptor.layerCount = 5; descriptor.arrayLayerCount = 5;
dawn::TextureView depthStencilView = depthStencilTexture.CreateTextureView(&descriptor); dawn::TextureView depthStencilView = depthStencilTexture.CreateTextureView(&descriptor);
dawn::RenderPassDepthStencilAttachmentDescriptor depthStencilAttachment; dawn::RenderPassDepthStencilAttachmentDescriptor depthStencilAttachment;
@ -306,7 +306,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
dawn::TextureViewDescriptor descriptor = baseDescriptor; dawn::TextureViewDescriptor descriptor = baseDescriptor;
descriptor.format = kColorFormat; descriptor.format = kColorFormat;
descriptor.baseArrayLayer = 0; descriptor.baseArrayLayer = 0;
descriptor.layerCount = 1; descriptor.arrayLayerCount = 1;
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor); dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
dawn::RenderPassColorAttachmentDescriptor colorAttachment; dawn::RenderPassColorAttachmentDescriptor colorAttachment;
@ -325,7 +325,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
dawn::TextureViewDescriptor descriptor = baseDescriptor; dawn::TextureViewDescriptor descriptor = baseDescriptor;
descriptor.format = kDepthStencilFormat; descriptor.format = kDepthStencilFormat;
descriptor.baseArrayLayer = 0; descriptor.baseArrayLayer = 0;
descriptor.layerCount = 1; descriptor.arrayLayerCount = 1;
dawn::TextureView depthStencilTextureView = dawn::TextureView depthStencilTextureView =
depthStencilTexture.CreateTextureView(&descriptor); depthStencilTexture.CreateTextureView(&descriptor);
@ -347,7 +347,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
dawn::TextureViewDescriptor descriptor = baseDescriptor; dawn::TextureViewDescriptor descriptor = baseDescriptor;
descriptor.format = kColorFormat; descriptor.format = kColorFormat;
descriptor.baseArrayLayer = kArrayLayers - 1; descriptor.baseArrayLayer = kArrayLayers - 1;
descriptor.layerCount = 1; descriptor.arrayLayerCount = 1;
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor); dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
dawn::RenderPassColorAttachmentDescriptor colorAttachment; dawn::RenderPassColorAttachmentDescriptor colorAttachment;
@ -366,7 +366,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
dawn::TextureViewDescriptor descriptor = baseDescriptor; dawn::TextureViewDescriptor descriptor = baseDescriptor;
descriptor.format = kDepthStencilFormat; descriptor.format = kDepthStencilFormat;
descriptor.baseArrayLayer = kArrayLayers - 1; descriptor.baseArrayLayer = kArrayLayers - 1;
descriptor.layerCount = 1; descriptor.arrayLayerCount = 1;
dawn::TextureView depthStencilTextureView = dawn::TextureView depthStencilTextureView =
depthStencilTexture.CreateTextureView(&descriptor); 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) { TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepthStencil) {
constexpr uint32_t kArrayLayers = 1; constexpr uint32_t kArrayLayers = 1;
constexpr uint32_t kSize = 32; constexpr uint32_t kSize = 32;
@ -402,15 +402,15 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
dawn::TextureViewDescriptor baseDescriptor; dawn::TextureViewDescriptor baseDescriptor;
baseDescriptor.dimension = dawn::TextureViewDimension::e2D; baseDescriptor.dimension = dawn::TextureViewDimension::e2D;
baseDescriptor.baseArrayLayer = 0; baseDescriptor.baseArrayLayer = 0;
baseDescriptor.layerCount = kArrayLayers; baseDescriptor.arrayLayerCount = kArrayLayers;
baseDescriptor.baseMipLevel = 0; 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; dawn::TextureViewDescriptor descriptor = baseDescriptor;
descriptor.format = kColorFormat; descriptor.format = kColorFormat;
descriptor.levelCount = 2; descriptor.mipLevelCount = 2;
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor); dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
dawn::RenderPassColorAttachmentDescriptor colorAttachment; dawn::RenderPassColorAttachmentDescriptor colorAttachment;
@ -424,11 +424,11 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
.GetResult(); .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; dawn::TextureViewDescriptor descriptor = baseDescriptor;
descriptor.format = kDepthStencilFormat; descriptor.format = kDepthStencilFormat;
descriptor.levelCount = 2; descriptor.mipLevelCount = 2;
dawn::TextureView depthStencilView = depthStencilTexture.CreateTextureView(&descriptor); dawn::TextureView depthStencilView = depthStencilTexture.CreateTextureView(&descriptor);
dawn::RenderPassDepthStencilAttachmentDescriptor depthStencilAttachment; dawn::RenderPassDepthStencilAttachmentDescriptor depthStencilAttachment;
@ -449,7 +449,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
dawn::TextureViewDescriptor descriptor = baseDescriptor; dawn::TextureViewDescriptor descriptor = baseDescriptor;
descriptor.format = kColorFormat; descriptor.format = kColorFormat;
descriptor.baseMipLevel = 0; descriptor.baseMipLevel = 0;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor); dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
dawn::RenderPassColorAttachmentDescriptor colorAttachment; dawn::RenderPassColorAttachmentDescriptor colorAttachment;
@ -468,7 +468,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
dawn::TextureViewDescriptor descriptor = baseDescriptor; dawn::TextureViewDescriptor descriptor = baseDescriptor;
descriptor.format = kDepthStencilFormat; descriptor.format = kDepthStencilFormat;
descriptor.baseMipLevel = 0; descriptor.baseMipLevel = 0;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
dawn::TextureView depthStencilTextureView = dawn::TextureView depthStencilTextureView =
depthStencilTexture.CreateTextureView(&descriptor); depthStencilTexture.CreateTextureView(&descriptor);
@ -490,7 +490,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
dawn::TextureViewDescriptor descriptor = baseDescriptor; dawn::TextureViewDescriptor descriptor = baseDescriptor;
descriptor.format = kColorFormat; descriptor.format = kColorFormat;
descriptor.baseMipLevel = kLevelCount - 1; descriptor.baseMipLevel = kLevelCount - 1;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor); dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
dawn::RenderPassColorAttachmentDescriptor colorAttachment; dawn::RenderPassColorAttachmentDescriptor colorAttachment;
@ -509,7 +509,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
dawn::TextureViewDescriptor descriptor = baseDescriptor; dawn::TextureViewDescriptor descriptor = baseDescriptor;
descriptor.format = kDepthStencilFormat; descriptor.format = kDepthStencilFormat;
descriptor.baseMipLevel = kLevelCount - 1; descriptor.baseMipLevel = kLevelCount - 1;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
dawn::TextureView depthStencilTextureView = dawn::TextureView depthStencilTextureView =
depthStencilTexture.CreateTextureView(&descriptor); depthStencilTexture.CreateTextureView(&descriptor);

View File

@ -57,7 +57,7 @@ TEST_F(RenderPipelineValidationTest, ColorState) {
utils::ComboRenderPipelineDescriptor descriptor(device); utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule; descriptor.cVertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule; descriptor.cFragmentStage.module = fsModule;
descriptor.numColorStates = 1; descriptor.colorStateCount = 1;
device.CreateRenderPipeline(&descriptor); device.CreateRenderPipeline(&descriptor);
} }
@ -66,7 +66,7 @@ TEST_F(RenderPipelineValidationTest, ColorState) {
utils::ComboRenderPipelineDescriptor descriptor(device); utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule; descriptor.cVertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule; descriptor.cFragmentStage.module = fsModule;
descriptor.numColorStates = 0; descriptor.colorStateCount = 0;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor)); ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
} }

View File

@ -35,8 +35,8 @@ dawn::TextureDescriptor CreateDefaultTextureDescriptor() {
descriptor.size.width = kWidth; descriptor.size.width = kWidth;
descriptor.size.height = kHeight; descriptor.size.height = kHeight;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = kDefaultArraySize; descriptor.arrayLayerCount = kDefaultArraySize;
descriptor.levelCount = kDefaultMipLevels; descriptor.mipLevelCount = kDefaultMipLevels;
descriptor.sampleCount = kDefaultSampleCount; descriptor.sampleCount = kDefaultSampleCount;
descriptor.dimension = dawn::TextureDimension::e2D; descriptor.dimension = dawn::TextureDimension::e2D;
descriptor.format = kDefaultTextureFormat; descriptor.format = kDefaultTextureFormat;

View File

@ -26,7 +26,7 @@ constexpr uint32_t kDefaultMipLevels = 6u;
constexpr dawn::TextureFormat kDefaultTextureFormat = dawn::TextureFormat::R8G8B8A8Unorm; constexpr dawn::TextureFormat kDefaultTextureFormat = dawn::TextureFormat::R8G8B8A8Unorm;
dawn::Texture Create2DArrayTexture(dawn::Device& device, dawn::Texture Create2DArrayTexture(dawn::Device& device,
uint32_t arraySize, uint32_t arrayLayerCount,
uint32_t width = kWidth, uint32_t width = kWidth,
uint32_t height = kHeight) { uint32_t height = kHeight) {
dawn::TextureDescriptor descriptor; dawn::TextureDescriptor descriptor;
@ -34,10 +34,10 @@ dawn::Texture Create2DArrayTexture(dawn::Device& device,
descriptor.size.width = width; descriptor.size.width = width;
descriptor.size.height = height; descriptor.size.height = height;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = arraySize; descriptor.arrayLayerCount = arrayLayerCount;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = kDefaultTextureFormat; descriptor.format = kDefaultTextureFormat;
descriptor.levelCount = kDefaultMipLevels; descriptor.mipLevelCount = kDefaultMipLevels;
descriptor.usage = dawn::TextureUsageBit::Sampled; descriptor.usage = dawn::TextureUsageBit::Sampled;
return device.CreateTexture(&descriptor); return device.CreateTexture(&descriptor);
} }
@ -47,9 +47,9 @@ dawn::TextureViewDescriptor CreateDefaultTextureViewDescriptor(dawn::TextureView
descriptor.format = kDefaultTextureFormat; descriptor.format = kDefaultTextureFormat;
descriptor.dimension = dimension; descriptor.dimension = dimension;
descriptor.baseMipLevel = 0; descriptor.baseMipLevel = 0;
descriptor.levelCount = kDefaultMipLevels; descriptor.mipLevelCount = kDefaultMipLevels;
descriptor.baseArrayLayer = 0; descriptor.baseArrayLayer = 0;
descriptor.layerCount = 1; descriptor.arrayLayerCount = 1;
return descriptor; return descriptor;
} }
@ -63,7 +63,7 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2D) {
// It is OK to create a 2D texture view on a 2D texture. // It is OK to create a 2D texture view on a 2D texture.
{ {
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
descriptor.layerCount = 1; descriptor.arrayLayerCount = 1;
texture.CreateTextureView(&descriptor); texture.CreateTextureView(&descriptor);
} }
@ -71,7 +71,7 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2D) {
// is 2D. // is 2D.
{ {
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
descriptor.layerCount = 2; descriptor.arrayLayerCount = 2;
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor)); ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
} }
@ -79,14 +79,14 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2D) {
{ {
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
descriptor.dimension = dawn::TextureViewDimension::e2DArray; descriptor.dimension = dawn::TextureViewDimension::e2DArray;
descriptor.layerCount = 1; descriptor.arrayLayerCount = 1;
texture.CreateTextureView(&descriptor); texture.CreateTextureView(&descriptor);
} }
// It is an error to specify levelCount == 0. // It is an error to specify mipLevelCount == 0.
{ {
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
descriptor.levelCount = 0; descriptor.mipLevelCount = 0;
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor)); ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
} }
@ -94,7 +94,7 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2D) {
{ {
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
descriptor.baseMipLevel = kDefaultMipLevels - 1; descriptor.baseMipLevel = kDefaultMipLevels - 1;
descriptor.levelCount = 2; descriptor.mipLevelCount = 2;
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor)); ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
} }
} }
@ -112,28 +112,28 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2DArray) {
{ {
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
descriptor.dimension = dawn::TextureViewDimension::e2D; descriptor.dimension = dawn::TextureViewDimension::e2D;
descriptor.layerCount = 1; descriptor.arrayLayerCount = 1;
texture.CreateTextureView(&descriptor); texture.CreateTextureView(&descriptor);
} }
// It is OK to create a 2D array texture view on a 2D array texture. // It is OK to create a 2D array texture view on a 2D array texture.
{ {
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
descriptor.layerCount = kDefaultArrayLayers; descriptor.arrayLayerCount = kDefaultArrayLayers;
texture.CreateTextureView(&descriptor); texture.CreateTextureView(&descriptor);
} }
// It is an error to specify layerCount == 0. // It is an error to specify arrayLayerCount == 0.
{ {
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
descriptor.layerCount = 0; descriptor.arrayLayerCount = 0;
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor)); ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
} }
// It is an error to make the array layer out of range. // It is an error to make the array layer out of range.
{ {
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
descriptor.layerCount = kDefaultArrayLayers + 1; descriptor.arrayLayerCount = kDefaultArrayLayers + 1;
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor)); ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
} }
} }
@ -147,35 +147,35 @@ TEST_F(TextureViewValidationTest, CreateCubeMapTextureView) {
dawn::TextureViewDescriptor base2DArrayTextureViewDescriptor = dawn::TextureViewDescriptor base2DArrayTextureViewDescriptor =
CreateDefaultTextureViewDescriptor(dawn::TextureViewDimension::e2DArray); 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; dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
descriptor.dimension = dawn::TextureViewDimension::Cube; descriptor.dimension = dawn::TextureViewDimension::Cube;
descriptor.layerCount = 6; descriptor.arrayLayerCount = 6;
texture.CreateTextureView(&descriptor); 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; dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
descriptor.dimension = dawn::TextureViewDimension::Cube; descriptor.dimension = dawn::TextureViewDimension::Cube;
descriptor.layerCount = 3; descriptor.arrayLayerCount = 3;
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor)); 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; dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
descriptor.dimension = dawn::TextureViewDimension::CubeArray; descriptor.dimension = dawn::TextureViewDimension::CubeArray;
descriptor.layerCount = 12; descriptor.arrayLayerCount = 12;
texture.CreateTextureView(&descriptor); 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; dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
descriptor.dimension = dawn::TextureViewDimension::CubeArray; descriptor.dimension = dawn::TextureViewDimension::CubeArray;
descriptor.layerCount = 11; descriptor.arrayLayerCount = 11;
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor)); ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
} }
@ -185,7 +185,7 @@ TEST_F(TextureViewValidationTest, CreateCubeMapTextureView) {
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
descriptor.dimension = dawn::TextureViewDimension::Cube; descriptor.dimension = dawn::TextureViewDimension::Cube;
descriptor.layerCount = 6; descriptor.arrayLayerCount = 6;
ASSERT_DEVICE_ERROR(nonSquareTexture.CreateTextureView(&descriptor)); ASSERT_DEVICE_ERROR(nonSquareTexture.CreateTextureView(&descriptor));
} }
@ -195,7 +195,7 @@ TEST_F(TextureViewValidationTest, CreateCubeMapTextureView) {
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor; dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
descriptor.dimension = dawn::TextureViewDimension::CubeArray; descriptor.dimension = dawn::TextureViewDimension::CubeArray;
descriptor.layerCount = 12; descriptor.arrayLayerCount = 12;
ASSERT_DEVICE_ERROR(nonSquareTexture.CreateTextureView(&descriptor)); ASSERT_DEVICE_ERROR(nonSquareTexture.CreateTextureView(&descriptor));
} }
} }

View File

@ -90,10 +90,10 @@ dawn::RenderPassDescriptor ValidationTest::CreateSimpleRenderPass() {
descriptor.size.width = 640; descriptor.size.width = 640;
descriptor.size.height = 480; descriptor.size.height = 480;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsageBit::OutputAttachment; descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
auto colorBuffer = device.CreateTexture(&descriptor); auto colorBuffer = device.CreateTexture(&descriptor);
@ -149,10 +149,10 @@ ValidationTest::DummyRenderPass ValidationTest::CreateDummyRenderPass() {
descriptor.size.width = dummy.width; descriptor.size.width = dummy.width;
descriptor.size.height = dummy.height; descriptor.size.height = dummy.height;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = dummy.attachmentFormat; descriptor.format = dummy.attachmentFormat;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsageBit::OutputAttachment; descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
dummy.attachment = device.CreateTexture(&descriptor); dummy.attachment = device.CreateTexture(&descriptor);

View File

@ -131,7 +131,7 @@ TEST_F(WireArgumentTests, CStringArgument) {
// Create the pipeline layout // Create the pipeline layout
dawnPipelineLayoutDescriptor layoutDescriptor; dawnPipelineLayoutDescriptor layoutDescriptor;
layoutDescriptor.nextInChain = nullptr; layoutDescriptor.nextInChain = nullptr;
layoutDescriptor.numBindGroupLayouts = 0; layoutDescriptor.bindGroupLayoutCount = 0;
layoutDescriptor.bindGroupLayouts = nullptr; layoutDescriptor.bindGroupLayouts = nullptr;
dawnPipelineLayout layout = dawnDeviceCreatePipelineLayout(device, &layoutDescriptor); dawnPipelineLayout layout = dawnDeviceCreatePipelineLayout(device, &layoutDescriptor);
dawnPipelineLayout apiLayout = api.GetNewPipelineLayout(); dawnPipelineLayout apiLayout = api.GetNewPipelineLayout();
@ -153,7 +153,7 @@ TEST_F(WireArgumentTests, CStringArgument) {
fragmentStage.entryPoint = "main"; fragmentStage.entryPoint = "main";
pipelineDescriptor.fragmentStage = &fragmentStage; pipelineDescriptor.fragmentStage = &fragmentStage;
pipelineDescriptor.numColorStates = 1; pipelineDescriptor.colorStateCount = 1;
dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor}; dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
pipelineDescriptor.colorStates = colorStatesPtr; pipelineDescriptor.colorStates = colorStatesPtr;
@ -288,7 +288,7 @@ TEST_F(WireArgumentTests, StructureOfValuesArgument) {
// Test that the wire is able to send structures that contain objects // Test that the wire is able to send structures that contain objects
TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) { TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) {
dawnBindGroupLayoutDescriptor bglDescriptor; dawnBindGroupLayoutDescriptor bglDescriptor;
bglDescriptor.numBindings = 0; bglDescriptor.bindingCount = 0;
bglDescriptor.bindings = nullptr; bglDescriptor.bindings = nullptr;
dawnBindGroupLayout bgl = dawnDeviceCreateBindGroupLayout(device, &bglDescriptor); dawnBindGroupLayout bgl = dawnDeviceCreateBindGroupLayout(device, &bglDescriptor);
@ -297,7 +297,7 @@ TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) {
dawnPipelineLayoutDescriptor descriptor; dawnPipelineLayoutDescriptor descriptor;
descriptor.nextInChain = nullptr; descriptor.nextInChain = nullptr;
descriptor.numBindGroupLayouts = 1; descriptor.bindGroupLayoutCount = 1;
descriptor.bindGroupLayouts = &bgl; descriptor.bindGroupLayouts = &bgl;
dawnDeviceCreatePipelineLayout(device, &descriptor); dawnDeviceCreatePipelineLayout(device, &descriptor);
@ -305,7 +305,7 @@ TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) {
apiDevice, apiDevice,
MatchesLambda([apiBgl](const dawnPipelineLayoutDescriptor* desc) -> bool { MatchesLambda([apiBgl](const dawnPipelineLayoutDescriptor* desc) -> bool {
return desc->nextInChain == nullptr && return desc->nextInChain == nullptr &&
desc->numBindGroupLayouts == 1 && desc->bindGroupLayoutCount == 1 &&
desc->bindGroupLayouts[0] == apiBgl; desc->bindGroupLayouts[0] == apiBgl;
}))) })))
.WillOnce(Return(nullptr)); .WillOnce(Return(nullptr));
@ -326,7 +326,7 @@ TEST_F(WireArgumentTests, StructureOfStructureArrayArgument) {
DAWN_BINDING_TYPE_UNIFORM_BUFFER}, DAWN_BINDING_TYPE_UNIFORM_BUFFER},
}; };
dawnBindGroupLayoutDescriptor bglDescriptor; dawnBindGroupLayoutDescriptor bglDescriptor;
bglDescriptor.numBindings = NUM_BINDINGS; bglDescriptor.bindingCount = NUM_BINDINGS;
bglDescriptor.bindings = bindings; bglDescriptor.bindings = bindings;
dawnDeviceCreateBindGroupLayout(device, &bglDescriptor); dawnDeviceCreateBindGroupLayout(device, &bglDescriptor);
@ -343,7 +343,7 @@ TEST_F(WireArgumentTests, StructureOfStructureArrayArgument) {
return false; return false;
} }
} }
return desc->nextInChain == nullptr && desc->numBindings == 3; return desc->nextInChain == nullptr && desc->bindingCount == 3;
}))) })))
.WillOnce(Return(apiBgl)); .WillOnce(Return(apiBgl));
@ -357,14 +357,14 @@ TEST_F(WireArgumentTests, DISABLED_NullptrInArray) {
dawnPipelineLayoutDescriptor descriptor; dawnPipelineLayoutDescriptor descriptor;
descriptor.nextInChain = nullptr; descriptor.nextInChain = nullptr;
descriptor.numBindGroupLayouts = 1; descriptor.bindGroupLayoutCount = 1;
descriptor.bindGroupLayouts = &nullBGL; descriptor.bindGroupLayouts = &nullBGL;
dawnDeviceCreatePipelineLayout(device, &descriptor); dawnDeviceCreatePipelineLayout(device, &descriptor);
EXPECT_CALL(api, EXPECT_CALL(api,
DeviceCreatePipelineLayout( DeviceCreatePipelineLayout(
apiDevice, MatchesLambda([](const dawnPipelineLayoutDescriptor* desc) -> bool { apiDevice, MatchesLambda([](const dawnPipelineLayoutDescriptor* desc) -> bool {
return desc->nextInChain == nullptr && desc->numBindGroupLayouts == 1 && return desc->nextInChain == nullptr && desc->bindGroupLayoutCount == 1 &&
desc->bindGroupLayouts[0] == nullptr; desc->bindGroupLayouts[0] == nullptr;
}))) })))
.WillOnce(Return(nullptr)); .WillOnce(Return(nullptr));

View File

@ -28,7 +28,7 @@ class WireOptionalTests : public WireTest {
TEST_F(WireOptionalTests, OptionalObjectValue) { TEST_F(WireOptionalTests, OptionalObjectValue) {
dawnBindGroupLayoutDescriptor bglDesc; dawnBindGroupLayoutDescriptor bglDesc;
bglDesc.nextInChain = nullptr; bglDesc.nextInChain = nullptr;
bglDesc.numBindings = 0; bglDesc.bindingCount = 0;
dawnBindGroupLayout bgl = dawnDeviceCreateBindGroupLayout(device, &bglDesc); dawnBindGroupLayout bgl = dawnDeviceCreateBindGroupLayout(device, &bglDesc);
dawnBindGroupLayout apiBindGroupLayout = api.GetNewBindGroupLayout(); dawnBindGroupLayout apiBindGroupLayout = api.GetNewBindGroupLayout();
@ -45,13 +45,13 @@ TEST_F(WireOptionalTests, OptionalObjectValue) {
dawnBindGroupDescriptor bgDesc; dawnBindGroupDescriptor bgDesc;
bgDesc.nextInChain = nullptr; bgDesc.nextInChain = nullptr;
bgDesc.layout = bgl; bgDesc.layout = bgl;
bgDesc.numBindings = 1; bgDesc.bindingCount = 1;
bgDesc.bindings = &binding; bgDesc.bindings = &binding;
dawnDeviceCreateBindGroup(device, &bgDesc); dawnDeviceCreateBindGroup(device, &bgDesc);
EXPECT_CALL(api, DeviceCreateBindGroup( EXPECT_CALL(api, DeviceCreateBindGroup(
apiDevice, MatchesLambda([](const dawnBindGroupDescriptor* desc) -> bool { 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].binding == 0 &&
desc->bindings[0].sampler == nullptr && desc->bindings[0].sampler == nullptr &&
desc->bindings[0].buffer == nullptr && desc->bindings[0].buffer == nullptr &&
@ -116,7 +116,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
// Create the pipeline layout // Create the pipeline layout
dawnPipelineLayoutDescriptor layoutDescriptor; dawnPipelineLayoutDescriptor layoutDescriptor;
layoutDescriptor.nextInChain = nullptr; layoutDescriptor.nextInChain = nullptr;
layoutDescriptor.numBindGroupLayouts = 0; layoutDescriptor.bindGroupLayoutCount = 0;
layoutDescriptor.bindGroupLayouts = nullptr; layoutDescriptor.bindGroupLayouts = nullptr;
dawnPipelineLayout layout = dawnDeviceCreatePipelineLayout(device, &layoutDescriptor); dawnPipelineLayout layout = dawnDeviceCreatePipelineLayout(device, &layoutDescriptor);
dawnPipelineLayout apiLayout = api.GetNewPipelineLayout(); dawnPipelineLayout apiLayout = api.GetNewPipelineLayout();
@ -138,7 +138,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
fragmentStage.entryPoint = "main"; fragmentStage.entryPoint = "main";
pipelineDescriptor.fragmentStage = &fragmentStage; pipelineDescriptor.fragmentStage = &fragmentStage;
pipelineDescriptor.numColorStates = 1; pipelineDescriptor.colorStateCount = 1;
dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor}; dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
pipelineDescriptor.colorStates = colorStatesPtr; pipelineDescriptor.colorStates = colorStatesPtr;

View File

@ -39,7 +39,7 @@ namespace utils {
// Set defaults for the color state descriptors. // Set defaults for the color state descriptors.
{ {
descriptor->numColorStates = 1; descriptor->colorStateCount = 1;
descriptor->colorStates = &cColorStates[0]; descriptor->colorStates = &cColorStates[0];
dawn::BlendDescriptor blend; dawn::BlendDescriptor blend;

View File

@ -139,10 +139,10 @@ namespace utils {
descriptor.size.width = width; descriptor.size.width = width;
descriptor.size.height = height; descriptor.size.height = height;
descriptor.size.depth = 1; descriptor.size.depth = 1;
descriptor.arraySize = 1; descriptor.arrayLayerCount = 1;
descriptor.sampleCount = 1; descriptor.sampleCount = 1;
descriptor.format = result.colorFormat; descriptor.format = result.colorFormat;
descriptor.levelCount = 1; descriptor.mipLevelCount = 1;
descriptor.usage = descriptor.usage =
dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
result.color = device.CreateTexture(&descriptor); result.color = device.CreateTexture(&descriptor);
@ -208,10 +208,10 @@ namespace utils {
const dawn::BindGroupLayout* bindGroupLayout) { const dawn::BindGroupLayout* bindGroupLayout) {
dawn::PipelineLayoutDescriptor descriptor; dawn::PipelineLayoutDescriptor descriptor;
if (bindGroupLayout) { if (bindGroupLayout) {
descriptor.numBindGroupLayouts = 1; descriptor.bindGroupLayoutCount = 1;
descriptor.bindGroupLayouts = bindGroupLayout; descriptor.bindGroupLayouts = bindGroupLayout;
} else { } else {
descriptor.numBindGroupLayouts = 0; descriptor.bindGroupLayoutCount = 0;
descriptor.bindGroupLayouts = nullptr; descriptor.bindGroupLayouts = nullptr;
} }
return device.CreatePipelineLayout(&descriptor); return device.CreatePipelineLayout(&descriptor);
@ -230,7 +230,7 @@ namespace utils {
} }
dawn::BindGroupLayoutDescriptor descriptor; dawn::BindGroupLayoutDescriptor descriptor;
descriptor.numBindings = static_cast<uint32_t>(bindings.size()); descriptor.bindingCount = static_cast<uint32_t>(bindings.size());
descriptor.bindings = bindings.data(); descriptor.bindings = bindings.data();
return device.CreateBindGroupLayout(&descriptor); return device.CreateBindGroupLayout(&descriptor);
} }
@ -276,7 +276,7 @@ namespace utils {
dawn::BindGroupDescriptor descriptor; dawn::BindGroupDescriptor descriptor;
descriptor.layout = layout; descriptor.layout = layout;
descriptor.numBindings = bindings.size(); descriptor.bindingCount = bindings.size();
descriptor.bindings = bindings.data(); descriptor.bindings = bindings.data();
return device.CreateBindGroup(&descriptor); return device.CreateBindGroup(&descriptor);