Rename BG[L]Binding to BG[L]Entry

This is to match the WebGPU API change.

The only manual changes are in dawn.json and templates. The rest was
created with the following commands:

  git grep -l BindGroupLayoutBinding | xargs sed -i "" -e "s/BindGroupLayoutBinding/BindGroupLayoutEntry/g"
  git grep -l BindGroupBinding | xargs sed -i "" -e "s/BindGroupBinding/BindGroupEntry/g"
  git cl format

Bug: dawn:22
Change-Id: I1377eef9ea9816578441c91d167909dedc7f8e96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18863
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-04-07 07:11:12 +00:00 committed by Commit Bot service account
parent f526d777e0
commit c3c6694d8f
16 changed files with 106 additions and 99 deletions

View File

@ -59,7 +59,7 @@
"bind group": { "bind group": {
"category": "object" "category": "object"
}, },
"bind group binding": { "bind group entry": {
"category": "structure", "category": "structure",
"extensible": false, "extensible": false,
"members": [ "members": [
@ -78,13 +78,13 @@
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "layout", "type": "bind group layout"}, {"name": "layout", "type": "bind group layout"},
{"name": "binding count", "type": "uint32_t"}, {"name": "binding count", "type": "uint32_t"},
{"name": "bindings", "type": "bind group binding", "annotation": "const*", "length": "binding count"} {"name": "bindings", "type": "bind group entry", "annotation": "const*", "length": "binding count"}
] ]
}, },
"bind group layout": { "bind group layout": {
"category": "object" "category": "object"
}, },
"bind group layout binding": { "bind group layout entry": {
"category": "structure", "category": "structure",
"extensible": false, "extensible": false,
"members": [ "members": [
@ -104,7 +104,7 @@
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "binding count", "type": "uint32_t"}, {"name": "binding count", "type": "uint32_t"},
{"name": "bindings", "type": "bind group layout binding", "annotation": "const*", "length": "binding count"} {"name": "bindings", "type": "bind group layout entry", "annotation": "const*", "length": "binding count"}
] ]
}, },
"binding type": { "binding type": {

View File

@ -114,6 +114,10 @@ typedef struct WGPUChainedStruct {
{% endfor %} {% endfor %}
// TODO(dawn:22): Remove this once users use the "Entry" version.
typedef WGPUBindGroupEntry WGPUBindGroupBinding;
typedef WGPUBindGroupLayoutEntry WGPUBindGroupLayoutBinding;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -216,6 +216,10 @@ namespace wgpu {
{% endfor %} {% endfor %}
// TODO(dawn:22): Remove this once users use the "Entry" version.
using BindGroupBinding = BindGroupEntry;
using BindGroupLayoutBinding = BindGroupLayoutEntry;
} // namespace wgpu } // namespace wgpu
#endif // WEBGPU_CPP_H_ #endif // WEBGPU_CPP_H_

View File

@ -29,7 +29,7 @@ namespace dawn_native {
// Helper functions to perform binding-type specific validation // Helper functions to perform binding-type specific validation
MaybeError ValidateBufferBinding(const DeviceBase* device, MaybeError ValidateBufferBinding(const DeviceBase* device,
const BindGroupBinding& binding, const BindGroupEntry& binding,
wgpu::BufferUsage requiredUsage) { wgpu::BufferUsage requiredUsage) {
if (binding.buffer == nullptr || binding.sampler != nullptr || if (binding.buffer == nullptr || binding.sampler != nullptr ||
binding.textureView != nullptr) { binding.textureView != nullptr) {
@ -66,7 +66,7 @@ namespace dawn_native {
} }
MaybeError ValidateTextureBinding(const DeviceBase* device, MaybeError ValidateTextureBinding(const DeviceBase* device,
const BindGroupBinding& binding, const BindGroupEntry& binding,
wgpu::TextureUsage requiredUsage, wgpu::TextureUsage requiredUsage,
const BindingInfo& bindingInfo) { const BindingInfo& bindingInfo) {
if (binding.textureView == nullptr || binding.sampler != nullptr || if (binding.textureView == nullptr || binding.sampler != nullptr ||
@ -110,8 +110,7 @@ namespace dawn_native {
return {}; return {};
} }
MaybeError ValidateSamplerBinding(const DeviceBase* device, MaybeError ValidateSamplerBinding(const DeviceBase* device, const BindGroupEntry& binding) {
const BindGroupBinding& binding) {
if (binding.sampler == nullptr || binding.textureView != nullptr || if (binding.sampler == nullptr || binding.textureView != nullptr ||
binding.buffer != nullptr) { binding.buffer != nullptr) {
return DAWN_VALIDATION_ERROR("expected sampler binding"); return DAWN_VALIDATION_ERROR("expected sampler binding");
@ -138,7 +137,7 @@ namespace dawn_native {
std::bitset<kMaxBindingsPerGroup> bindingsSet; std::bitset<kMaxBindingsPerGroup> bindingsSet;
for (uint32_t i = 0; i < descriptor->bindingCount; ++i) { for (uint32_t i = 0; i < descriptor->bindingCount; ++i) {
const BindGroupBinding& binding = descriptor->bindings[i]; const BindGroupEntry& binding = descriptor->bindings[i];
const auto& it = bindingMap.find(BindingNumber(binding.binding)); const auto& it = bindingMap.find(BindingNumber(binding.binding));
if (it == bindingMap.end()) { if (it == bindingMap.end()) {
@ -208,7 +207,7 @@ namespace dawn_native {
} }
for (uint32_t i = 0; i < descriptor->bindingCount; ++i) { for (uint32_t i = 0; i < descriptor->bindingCount; ++i) {
const BindGroupBinding& binding = descriptor->bindings[i]; const BindGroupEntry& binding = descriptor->bindings[i];
BindingIndex bindingIndex = BindingIndex bindingIndex =
descriptor->layout->GetBindingIndex(BindingNumber(binding.binding)); descriptor->layout->GetBindingIndex(BindingNumber(binding.binding));

View File

@ -102,7 +102,7 @@ namespace dawn_native {
uint32_t dynamicUniformBufferCount = 0; uint32_t dynamicUniformBufferCount = 0;
uint32_t dynamicStorageBufferCount = 0; uint32_t dynamicStorageBufferCount = 0;
for (BindingIndex i = 0; i < descriptor->bindingCount; ++i) { for (BindingIndex i = 0; i < descriptor->bindingCount; ++i) {
const BindGroupLayoutBinding& binding = descriptor->bindings[i]; const BindGroupLayoutEntry& binding = descriptor->bindings[i];
BindingNumber bindingNumber = BindingNumber(binding.binding); BindingNumber bindingNumber = BindingNumber(binding.binding);
DAWN_TRY(ValidateShaderStage(binding.visibility)); DAWN_TRY(ValidateShaderStage(binding.visibility));
@ -149,7 +149,7 @@ namespace dawn_native {
if (binding.multisampled) { if (binding.multisampled) {
return DAWN_VALIDATION_ERROR( return DAWN_VALIDATION_ERROR(
"BindGroupLayoutBinding::multisampled must be false (for now)"); "BindGroupLayoutEntry::multisampled must be false (for now)");
} }
bindingsSet.insert(bindingNumber); bindingsSet.insert(bindingNumber);
@ -190,7 +190,7 @@ namespace dawn_native {
a.storageTextureFormat != b.storageTextureFormat; a.storageTextureFormat != b.storageTextureFormat;
} }
bool SortBindingsCompare(const BindGroupLayoutBinding& a, const BindGroupLayoutBinding& b) { bool SortBindingsCompare(const BindGroupLayoutEntry& a, const BindGroupLayoutEntry& b) {
if (a.hasDynamicOffset != b.hasDynamicOffset) { if (a.hasDynamicOffset != b.hasDynamicOffset) {
// Buffers with dynamic offsets should come before those without. // Buffers with dynamic offsets should come before those without.
// This makes it easy to iterate over the dynamic buffer bindings // This makes it easy to iterate over the dynamic buffer bindings
@ -258,13 +258,13 @@ namespace dawn_native {
BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device, BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device,
const BindGroupLayoutDescriptor* descriptor) const BindGroupLayoutDescriptor* descriptor)
: CachedObject(device), mBindingCount(descriptor->bindingCount) { : CachedObject(device), mBindingCount(descriptor->bindingCount) {
std::vector<BindGroupLayoutBinding> sortedBindings( std::vector<BindGroupLayoutEntry> sortedBindings(
descriptor->bindings, descriptor->bindings + descriptor->bindingCount); descriptor->bindings, descriptor->bindings + descriptor->bindingCount);
std::sort(sortedBindings.begin(), sortedBindings.end(), SortBindingsCompare); std::sort(sortedBindings.begin(), sortedBindings.end(), SortBindingsCompare);
for (BindingIndex i = 0; i < mBindingCount; ++i) { for (BindingIndex i = 0; i < mBindingCount; ++i) {
const BindGroupLayoutBinding& binding = sortedBindings[i]; const BindGroupLayoutEntry& binding = sortedBindings[i];
mBindingInfo[i].type = binding.type; mBindingInfo[i].type = binding.type;
mBindingInfo[i].visibility = binding.visibility; mBindingInfo[i].visibility = binding.visibility;
mBindingInfo[i].textureComponentType = mBindingInfo[i].textureComponentType =

View File

@ -25,7 +25,7 @@ namespace dawn_native {
namespace { namespace {
bool operator==(const BindGroupLayoutBinding& lhs, const BindGroupLayoutBinding& rhs) { bool operator==(const BindGroupLayoutEntry& lhs, const BindGroupLayoutEntry& rhs) {
return lhs.binding == rhs.binding && lhs.visibility == rhs.visibility && return lhs.binding == rhs.binding && lhs.visibility == rhs.visibility &&
lhs.type == rhs.type && lhs.hasDynamicOffset == rhs.hasDynamicOffset && lhs.type == rhs.type && lhs.hasDynamicOffset == rhs.hasDynamicOffset &&
lhs.multisampled == rhs.multisampled && lhs.multisampled == rhs.multisampled &&
@ -127,7 +127,7 @@ namespace dawn_native {
ASSERT(count > 0); ASSERT(count > 0);
// Data which BindGroupLayoutDescriptor will point to for creation // Data which BindGroupLayoutDescriptor will point to for creation
std::array<std::array<BindGroupLayoutBinding, kMaxBindingsPerGroup>, kMaxBindGroups> std::array<std::array<BindGroupLayoutEntry, kMaxBindingsPerGroup>, kMaxBindGroups>
bindingData = {}; bindingData = {};
// A map of bindings to the index in |bindingData| // A map of bindings to the index in |bindingData|
@ -150,7 +150,7 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR("Multisampled textures not supported (yet)"); return DAWN_VALIDATION_ERROR("Multisampled textures not supported (yet)");
} }
BindGroupLayoutBinding bindingSlot; BindGroupLayoutEntry bindingSlot;
bindingSlot.binding = bindingNumber; bindingSlot.binding = bindingNumber;
DAWN_TRY(ValidateBindingTypeWithShaderStageVisibility( DAWN_TRY(ValidateBindingTypeWithShaderStageVisibility(

View File

@ -754,7 +754,7 @@ TEST_P(BindGroupTests, DrawThenChangePipelineAndBindGroup) {
TEST_P(BindGroupTests, BindGroupLayoutVisibilityCanBeNone) { TEST_P(BindGroupTests, BindGroupLayoutVisibilityCanBeNone) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
wgpu::BindGroupLayoutBinding binding = {0, wgpu::ShaderStage::None, wgpu::BindGroupLayoutEntry binding = {0, wgpu::ShaderStage::None,
wgpu::BindingType::UniformBuffer}; wgpu::BindingType::UniformBuffer};
wgpu::BindGroupLayoutDescriptor descriptor; wgpu::BindGroupLayoutDescriptor descriptor;
descriptor.bindingCount = 1; descriptor.bindingCount = 1;

View File

@ -105,7 +105,7 @@ TEST_P(DeviceLostTest, SubmitFails) {
TEST_P(DeviceLostTest, CreateBindGroupLayoutFails) { TEST_P(DeviceLostTest, CreateBindGroupLayoutFails) {
SetCallbackAndLoseForTesting(); SetCallbackAndLoseForTesting();
wgpu::BindGroupLayoutBinding binding = {0, wgpu::ShaderStage::None, wgpu::BindGroupLayoutEntry binding = {0, wgpu::ShaderStage::None,
wgpu::BindingType::UniformBuffer}; wgpu::BindingType::UniformBuffer};
wgpu::BindGroupLayoutDescriptor descriptor; wgpu::BindGroupLayoutDescriptor descriptor;
descriptor.bindingCount = 1; descriptor.bindingCount = 1;
@ -139,7 +139,7 @@ TEST_P(DeviceLostTest, GetBindGroupLayoutFails) {
TEST_P(DeviceLostTest, CreateBindGroupFails) { TEST_P(DeviceLostTest, CreateBindGroupFails) {
SetCallbackAndLoseForTesting(); SetCallbackAndLoseForTesting();
wgpu::BindGroupBinding binding; wgpu::BindGroupEntry binding;
binding.binding = 0; binding.binding = 0;
binding.sampler = nullptr; binding.sampler = nullptr;
binding.textureView = nullptr; binding.textureView = nullptr;

View File

@ -23,7 +23,7 @@ TEST_P(StorageTextureTests, BindGroupLayoutWithStorageTextureBindingType) {
// wgpu::BindingType::ReadonlyStorageTexture is a valid binding type to create a bind group // wgpu::BindingType::ReadonlyStorageTexture is a valid binding type to create a bind group
// layout. // layout.
{ {
wgpu::BindGroupLayoutBinding binding = {0, wgpu::ShaderStage::Compute, wgpu::BindGroupLayoutEntry binding = {0, wgpu::ShaderStage::Compute,
wgpu::BindingType::ReadonlyStorageTexture}; wgpu::BindingType::ReadonlyStorageTexture};
binding.storageTextureFormat = wgpu::TextureFormat::R32Float; binding.storageTextureFormat = wgpu::TextureFormat::R32Float;
wgpu::BindGroupLayoutDescriptor descriptor; wgpu::BindGroupLayoutDescriptor descriptor;
@ -35,7 +35,7 @@ TEST_P(StorageTextureTests, BindGroupLayoutWithStorageTextureBindingType) {
// wgpu::BindingType::WriteonlyStorageTexture is a valid binding type to create a bind group // wgpu::BindingType::WriteonlyStorageTexture is a valid binding type to create a bind group
// layout. // layout.
{ {
wgpu::BindGroupLayoutBinding binding = {0, wgpu::ShaderStage::Compute, wgpu::BindGroupLayoutEntry binding = {0, wgpu::ShaderStage::Compute,
wgpu::BindingType::WriteonlyStorageTexture}; wgpu::BindingType::WriteonlyStorageTexture};
binding.storageTextureFormat = wgpu::TextureFormat::R32Float; binding.storageTextureFormat = wgpu::TextureFormat::R32Float;
wgpu::BindGroupLayoutDescriptor descriptor; wgpu::BindGroupLayoutDescriptor descriptor;

View File

@ -92,7 +92,7 @@ TEST_F(BindGroupValidationTest, bindingCountMismatch) {
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {})); ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {}));
} }
// Check constraints on BindGroupBinding::binding // Check constraints on BindGroupEntry::binding
TEST_F(BindGroupValidationTest, WrongBindings) { TEST_F(BindGroupValidationTest, WrongBindings) {
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout( wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}}); device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}});
@ -131,7 +131,7 @@ TEST_F(BindGroupValidationTest, SamplerBindingType) {
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout( wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}}); device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}});
wgpu::BindGroupBinding binding; wgpu::BindGroupEntry binding;
binding.binding = 0; binding.binding = 0;
binding.sampler = nullptr; binding.sampler = nullptr;
binding.textureView = nullptr; binding.textureView = nullptr;
@ -180,7 +180,7 @@ TEST_F(BindGroupValidationTest, TextureBindingType) {
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout( wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture}}); device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture}});
wgpu::BindGroupBinding binding; wgpu::BindGroupEntry binding;
binding.binding = 0; binding.binding = 0;
binding.sampler = nullptr; binding.sampler = nullptr;
binding.textureView = nullptr; binding.textureView = nullptr;
@ -234,7 +234,7 @@ TEST_F(BindGroupValidationTest, BufferBindingType) {
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout( wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::UniformBuffer}}); device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::UniformBuffer}});
wgpu::BindGroupBinding binding; wgpu::BindGroupEntry binding;
binding.binding = 0; binding.binding = 0;
binding.sampler = nullptr; binding.sampler = nullptr;
binding.textureView = nullptr; binding.textureView = nullptr;
@ -467,7 +467,7 @@ TEST_F(BindGroupValidationTest, ErrorLayout) {
class BindGroupLayoutValidationTest : public ValidationTest { class BindGroupLayoutValidationTest : public ValidationTest {
public: public:
void TestCreateBindGroupLayout(wgpu::BindGroupLayoutBinding* binding, void TestCreateBindGroupLayout(wgpu::BindGroupLayoutEntry* binding,
uint32_t count, uint32_t count,
bool expected) { bool expected) {
wgpu::BindGroupLayoutDescriptor descriptor; wgpu::BindGroupLayoutDescriptor descriptor;
@ -513,7 +513,7 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutStorageBindingsInVertexShad
} }
// Tests setting that bind group layout bindings numbers may be >= kMaxBindingsPerGroup. // Tests setting that bind group layout bindings numbers may be >= kMaxBindingsPerGroup.
TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutBindingUnbounded) { TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutEntryUnbounded) {
// Checks that kMaxBindingsPerGroup is valid. // Checks that kMaxBindingsPerGroup is valid.
utils::MakeBindGroupLayout(device, {{kMaxBindingsPerGroup, wgpu::ShaderStage::Vertex, utils::MakeBindGroupLayout(device, {{kMaxBindingsPerGroup, wgpu::ShaderStage::Vertex,
wgpu::BindingType::UniformBuffer}}); wgpu::BindingType::UniformBuffer}});
@ -525,7 +525,7 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutBindingUnbounded) {
// Test that there can't be more than kMaxBindingPerGroup bindings per group // Test that there can't be more than kMaxBindingPerGroup bindings per group
TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutMaxBindings) { TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutMaxBindings) {
wgpu::BindGroupLayoutBinding bindings[kMaxBindingsPerGroup + 1]; wgpu::BindGroupLayoutEntry bindings[kMaxBindingsPerGroup + 1];
for (uint32_t i = 0; i < kMaxBindingsPerGroup + 1; i++) { for (uint32_t i = 0; i < kMaxBindingsPerGroup + 1; i++) {
bindings[i].type = wgpu::BindingType::UniformBuffer; bindings[i].type = wgpu::BindingType::UniformBuffer;
@ -547,7 +547,7 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutMaxBindings) {
// This test verifies that the BindGroupLayout bindings are correctly validated, even if the // This test verifies that the BindGroupLayout bindings are correctly validated, even if the
// binding ids are out-of-order. // binding ids are out-of-order.
TEST_F(BindGroupLayoutValidationTest, BindGroupBinding) { TEST_F(BindGroupLayoutValidationTest, BindGroupEntry) {
utils::MakeBindGroupLayout(device, utils::MakeBindGroupLayout(device,
{ {
{1, wgpu::ShaderStage::Vertex, wgpu::BindingType::UniformBuffer}, {1, wgpu::ShaderStage::Vertex, wgpu::BindingType::UniformBuffer},
@ -590,7 +590,7 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutVisibilityNone) {
{0, wgpu::ShaderStage::Vertex, wgpu::BindingType::UniformBuffer}, {0, wgpu::ShaderStage::Vertex, wgpu::BindingType::UniformBuffer},
}); });
wgpu::BindGroupLayoutBinding binding = {0, wgpu::ShaderStage::None, wgpu::BindGroupLayoutEntry binding = {0, wgpu::ShaderStage::None,
wgpu::BindingType::UniformBuffer}; wgpu::BindingType::UniformBuffer};
wgpu::BindGroupLayoutDescriptor descriptor; wgpu::BindGroupLayoutDescriptor descriptor;
descriptor.bindingCount = 1; descriptor.bindingCount = 1;
@ -601,9 +601,9 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutVisibilityNone) {
// Check that dynamic buffer numbers exceed maximum value in one bind group layout. // Check that dynamic buffer numbers exceed maximum value in one bind group layout.
TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) { TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
wgpu::BindGroupLayout bgl[2]; wgpu::BindGroupLayout bgl[2];
std::vector<wgpu::BindGroupLayoutBinding> maxUniformDB; std::vector<wgpu::BindGroupLayoutEntry> maxUniformDB;
std::vector<wgpu::BindGroupLayoutBinding> maxStorageDB; std::vector<wgpu::BindGroupLayoutEntry> maxStorageDB;
std::vector<wgpu::BindGroupLayoutBinding> maxReadonlyStorageDB; std::vector<wgpu::BindGroupLayoutEntry> maxReadonlyStorageDB;
for (uint32_t i = 0; i < kMaxDynamicUniformBufferCount; ++i) { for (uint32_t i = 0; i < kMaxDynamicUniformBufferCount; ++i) {
maxUniformDB.push_back( maxUniformDB.push_back(
@ -620,7 +620,7 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
{i, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageBuffer, true}); {i, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageBuffer, true});
} }
auto MakeBindGroupLayout = [&](wgpu::BindGroupLayoutBinding* binding, auto MakeBindGroupLayout = [&](wgpu::BindGroupLayoutEntry* binding,
uint32_t count) -> wgpu::BindGroupLayout { uint32_t count) -> wgpu::BindGroupLayout {
wgpu::BindGroupLayoutDescriptor descriptor; wgpu::BindGroupLayoutDescriptor descriptor;
descriptor.bindingCount = count; descriptor.bindingCount = count;
@ -1027,9 +1027,9 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
// Iterate through the desired bind group layouts. // Iterate through the desired bind group layouts.
for (uint32_t l = 0; l < layouts.size(); ++l) { for (uint32_t l = 0; l < layouts.size(); ++l) {
const auto& layout = layouts[l]; const auto& layout = layouts[l];
std::vector<wgpu::BindGroupLayoutBinding> bindings(layout.size()); std::vector<wgpu::BindGroupLayoutEntry> bindings(layout.size());
// Iterate through binding types and populate a list of BindGroupLayoutBindings. // Iterate through binding types and populate a list of BindGroupLayoutEntrys.
for (uint32_t b = 0; b < layout.size(); ++b) { for (uint32_t b = 0; b < layout.size(); ++b) {
bindings[b] = {b, wgpu::ShaderStage::Fragment, layout[b], false}; bindings[b] = {b, wgpu::ShaderStage::Fragment, layout[b], false};
} }

View File

@ -102,7 +102,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) {
void main() { void main() {
})"); })");
wgpu::BindGroupLayoutBinding binding = {}; wgpu::BindGroupLayoutEntry binding = {};
binding.binding = 0; binding.binding = 0;
binding.type = wgpu::BindingType::UniformBuffer; binding.type = wgpu::BindingType::UniformBuffer;
binding.multisampled = false; binding.multisampled = false;
@ -150,7 +150,7 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&descriptor); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&descriptor);
wgpu::BindGroupLayoutBinding binding = {}; wgpu::BindGroupLayoutEntry binding = {};
binding.binding = 0; binding.binding = 0;
binding.type = wgpu::BindingType::UniformBuffer; binding.type = wgpu::BindingType::UniformBuffer;
binding.visibility = kVisibilityAll; binding.visibility = kVisibilityAll;
@ -165,7 +165,7 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
// Test that the binding type matches the shader. // Test that the binding type matches the shader.
TEST_F(GetBindGroupLayoutTests, BindingType) { TEST_F(GetBindGroupLayoutTests, BindingType) {
wgpu::BindGroupLayoutBinding binding = {}; wgpu::BindGroupLayoutEntry binding = {};
binding.binding = 0; binding.binding = 0;
binding.hasDynamicOffset = false; binding.hasDynamicOffset = false;
binding.multisampled = false; binding.multisampled = false;
@ -236,7 +236,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
// Test that multisampling matches the shader. // Test that multisampling matches the shader.
TEST_F(GetBindGroupLayoutTests, Multisampled) { TEST_F(GetBindGroupLayoutTests, Multisampled) {
wgpu::BindGroupLayoutBinding binding = {}; wgpu::BindGroupLayoutEntry binding = {};
binding.binding = 0; binding.binding = 0;
binding.type = wgpu::BindingType::SampledTexture; binding.type = wgpu::BindingType::SampledTexture;
binding.visibility = kVisibilityAll; binding.visibility = kVisibilityAll;
@ -273,7 +273,7 @@ TEST_F(GetBindGroupLayoutTests, Multisampled) {
// Test that texture view dimension matches the shader. // Test that texture view dimension matches the shader.
TEST_F(GetBindGroupLayoutTests, TextureDimension) { TEST_F(GetBindGroupLayoutTests, TextureDimension) {
wgpu::BindGroupLayoutBinding binding = {}; wgpu::BindGroupLayoutEntry binding = {};
binding.binding = 0; binding.binding = 0;
binding.type = wgpu::BindingType::SampledTexture; binding.type = wgpu::BindingType::SampledTexture;
binding.visibility = kVisibilityAll; binding.visibility = kVisibilityAll;
@ -347,7 +347,7 @@ TEST_F(GetBindGroupLayoutTests, TextureDimension) {
// Test that texture component type matches the shader. // Test that texture component type matches the shader.
TEST_F(GetBindGroupLayoutTests, TextureComponentType) { TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
wgpu::BindGroupLayoutBinding binding = {}; wgpu::BindGroupLayoutEntry binding = {};
binding.binding = 0; binding.binding = 0;
binding.type = wgpu::BindingType::SampledTexture; binding.type = wgpu::BindingType::SampledTexture;
binding.visibility = kVisibilityAll; binding.visibility = kVisibilityAll;
@ -391,7 +391,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
// Test that binding= indices match. // Test that binding= indices match.
TEST_F(GetBindGroupLayoutTests, BindingIndices) { TEST_F(GetBindGroupLayoutTests, BindingIndices) {
wgpu::BindGroupLayoutBinding binding = {}; wgpu::BindGroupLayoutEntry binding = {};
binding.type = wgpu::BindingType::UniformBuffer; binding.type = wgpu::BindingType::UniformBuffer;
binding.visibility = kVisibilityAll; binding.visibility = kVisibilityAll;
binding.hasDynamicOffset = false; binding.hasDynamicOffset = false;
@ -619,7 +619,7 @@ TEST_F(GetBindGroupLayoutTests, UnusedIndex) {
// Test that after explicitly creating a pipeline with a pipeline layout, calling // Test that after explicitly creating a pipeline with a pipeline layout, calling
// GetBindGroupLayout reflects the same bind group layouts. // GetBindGroupLayout reflects the same bind group layouts.
TEST_F(GetBindGroupLayoutTests, Reflection) { TEST_F(GetBindGroupLayoutTests, Reflection) {
wgpu::BindGroupLayoutBinding binding = {}; wgpu::BindGroupLayoutEntry binding = {};
binding.binding = 0; binding.binding = 0;
binding.type = wgpu::BindingType::UniformBuffer; binding.type = wgpu::BindingType::UniformBuffer;
binding.visibility = wgpu::ShaderStage::Vertex; binding.visibility = wgpu::ShaderStage::Vertex;

View File

@ -381,7 +381,7 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutWithStorageTextureBindingTy
{wgpu::ShaderStage::Compute, wgpu::BindingType::StorageTexture, false}}}; {wgpu::ShaderStage::Compute, wgpu::BindingType::StorageTexture, false}}};
for (const auto& testSpec : kTestSpecs) { for (const auto& testSpec : kTestSpecs) {
wgpu::BindGroupLayoutBinding binding = {0, testSpec.stage, testSpec.type}; wgpu::BindGroupLayoutEntry binding = {0, testSpec.stage, testSpec.type};
binding.storageTextureFormat = wgpu::TextureFormat::R32Uint; binding.storageTextureFormat = wgpu::TextureFormat::R32Uint;
wgpu::BindGroupLayoutDescriptor descriptor; wgpu::BindGroupLayoutDescriptor descriptor;
descriptor.bindingCount = 1; descriptor.bindingCount = 1;
@ -462,7 +462,7 @@ TEST_F(StorageTextureValidationTests, UnsupportedSPIRVStorageTextureFormat) {
// Verify when we create and use a bind group layout with storage textures in the creation of // Verify when we create and use a bind group layout with storage textures in the creation of
// render and compute pipeline, the binding type in the bind group layout must match the // render and compute pipeline, the binding type in the bind group layout must match the
// declaration in the shader. // declaration in the shader.
TEST_F(StorageTextureValidationTests, BindGroupLayoutBindingTypeMatchesShaderDeclaration) { TEST_F(StorageTextureValidationTests, BindGroupLayoutEntryTypeMatchesShaderDeclaration) {
constexpr std::array<wgpu::BindingType, 7> kSupportedBindingTypes = { constexpr std::array<wgpu::BindingType, 7> kSupportedBindingTypes = {
wgpu::BindingType::UniformBuffer, wgpu::BindingType::StorageBuffer, wgpu::BindingType::UniformBuffer, wgpu::BindingType::StorageBuffer,
wgpu::BindingType::ReadonlyStorageBuffer, wgpu::BindingType::Sampler, wgpu::BindingType::ReadonlyStorageBuffer, wgpu::BindingType::Sampler,
@ -483,17 +483,17 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutBindingTypeMatchesShaderDec
defaultComputePipelineDescriptor.computeStage.entryPoint = "main"; defaultComputePipelineDescriptor.computeStage.entryPoint = "main";
// Set common fileds of bind group layout binding. // Set common fileds of bind group layout binding.
wgpu::BindGroupLayoutBinding defaultBindGroupLayoutBinding; wgpu::BindGroupLayoutEntry defaultBindGroupLayoutEntry;
defaultBindGroupLayoutBinding.binding = 0; defaultBindGroupLayoutEntry.binding = 0;
defaultBindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute; defaultBindGroupLayoutEntry.visibility = wgpu::ShaderStage::Compute;
defaultBindGroupLayoutBinding.storageTextureFormat = kStorageTextureFormat; defaultBindGroupLayoutEntry.storageTextureFormat = kStorageTextureFormat;
for (wgpu::BindingType bindingTypeInBindgroupLayout : kSupportedBindingTypes) { for (wgpu::BindingType bindingTypeInBindgroupLayout : kSupportedBindingTypes) {
wgpu::ComputePipelineDescriptor computePipelineDescriptor = wgpu::ComputePipelineDescriptor computePipelineDescriptor =
defaultComputePipelineDescriptor; defaultComputePipelineDescriptor;
// Create bind group layout with different binding types. // Create bind group layout with different binding types.
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding = defaultBindGroupLayoutBinding; wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
bindGroupLayoutBinding.type = bindingTypeInBindgroupLayout; bindGroupLayoutBinding.type = bindingTypeInBindgroupLayout;
wgpu::BindGroupLayout bindGroupLayout = wgpu::BindGroupLayout bindGroupLayout =
utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}); utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
@ -514,27 +514,27 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutBindingTypeMatchesShaderDec
// Verify it is invalid not to set a valid texture format in a bind group layout when the binding // Verify it is invalid not to set a valid texture format in a bind group layout when the binding
// type is read-only or write-only storage texture. // type is read-only or write-only storage texture.
TEST_F(StorageTextureValidationTests, UndefinedStorageTextureFormatInBindGroupLayout) { TEST_F(StorageTextureValidationTests, UndefinedStorageTextureFormatInBindGroupLayout) {
wgpu::BindGroupLayoutBinding errorBindGroupLayoutBinding; wgpu::BindGroupLayoutEntry errorBindGroupLayoutEntry;
errorBindGroupLayoutBinding.binding = 0; errorBindGroupLayoutEntry.binding = 0;
errorBindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute; errorBindGroupLayoutEntry.visibility = wgpu::ShaderStage::Compute;
errorBindGroupLayoutBinding.storageTextureFormat = wgpu::TextureFormat::Undefined; errorBindGroupLayoutEntry.storageTextureFormat = wgpu::TextureFormat::Undefined;
for (wgpu::BindingType bindingType : kSupportedStorageTextureBindingTypes) { for (wgpu::BindingType bindingType : kSupportedStorageTextureBindingTypes) {
errorBindGroupLayoutBinding.type = bindingType; errorBindGroupLayoutEntry.type = bindingType;
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(device, {errorBindGroupLayoutBinding})); ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(device, {errorBindGroupLayoutEntry}));
} }
} }
// Verify it is invalid to create a bind group layout with storage textures and an unsupported // Verify it is invalid to create a bind group layout with storage textures and an unsupported
// storage texture format. // storage texture format.
TEST_F(StorageTextureValidationTests, StorageTextureFormatInBindGroupLayout) { TEST_F(StorageTextureValidationTests, StorageTextureFormatInBindGroupLayout) {
wgpu::BindGroupLayoutBinding defaultBindGroupLayoutBinding; wgpu::BindGroupLayoutEntry defaultBindGroupLayoutEntry;
defaultBindGroupLayoutBinding.binding = 0; defaultBindGroupLayoutEntry.binding = 0;
defaultBindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute; defaultBindGroupLayoutEntry.visibility = wgpu::ShaderStage::Compute;
for (wgpu::BindingType bindingType : kSupportedStorageTextureBindingTypes) { for (wgpu::BindingType bindingType : kSupportedStorageTextureBindingTypes) {
for (wgpu::TextureFormat textureFormat : utils::kAllTextureFormats) { for (wgpu::TextureFormat textureFormat : utils::kAllTextureFormats) {
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding = defaultBindGroupLayoutBinding; wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
bindGroupLayoutBinding.type = bindingType; bindGroupLayoutBinding.type = bindingType;
bindGroupLayoutBinding.storageTextureFormat = textureFormat; bindGroupLayoutBinding.storageTextureFormat = textureFormat;
if (utils::TextureFormatSupportsStorageTexture(textureFormat)) { if (utils::TextureFormatSupportsStorageTexture(textureFormat)) {
@ -567,8 +567,8 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutStorageTextureFormatMatches
defaultComputePipelineDescriptor.computeStage.entryPoint = "main"; defaultComputePipelineDescriptor.computeStage.entryPoint = "main";
// Set common fileds of bind group layout binding. // Set common fileds of bind group layout binding.
wgpu::BindGroupLayoutBinding defaultBindGroupLayoutBinding = { wgpu::BindGroupLayoutEntry defaultBindGroupLayoutEntry = {0, wgpu::ShaderStage::Compute,
0, wgpu::ShaderStage::Compute, bindingType}; bindingType};
for (wgpu::TextureFormat storageTextureFormatInBindGroupLayout : for (wgpu::TextureFormat storageTextureFormatInBindGroupLayout :
utils::kAllTextureFormats) { utils::kAllTextureFormats) {
@ -578,7 +578,7 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutStorageTextureFormatMatches
} }
// Create the bind group layout with the given storage texture format. // Create the bind group layout with the given storage texture format.
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding = defaultBindGroupLayoutBinding; wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
bindGroupLayoutBinding.storageTextureFormat = storageTextureFormatInBindGroupLayout; bindGroupLayoutBinding.storageTextureFormat = storageTextureFormatInBindGroupLayout;
wgpu::BindGroupLayout bindGroupLayout = wgpu::BindGroupLayout bindGroupLayout =
utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}); utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
@ -624,13 +624,13 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutTextureDimensionMatchesShad
defaultComputePipelineDescriptor.computeStage.entryPoint = "main"; defaultComputePipelineDescriptor.computeStage.entryPoint = "main";
// Set common fileds of bind group layout binding. // Set common fileds of bind group layout binding.
wgpu::BindGroupLayoutBinding defaultBindGroupLayoutBinding = { wgpu::BindGroupLayoutEntry defaultBindGroupLayoutEntry = {0, wgpu::ShaderStage::Compute,
0, wgpu::ShaderStage::Compute, bindingType}; bindingType};
defaultBindGroupLayoutBinding.storageTextureFormat = kStorageTextureFormat; defaultBindGroupLayoutEntry.storageTextureFormat = kStorageTextureFormat;
for (wgpu::TextureViewDimension dimensionInBindGroupLayout : kAllDimensions) { for (wgpu::TextureViewDimension dimensionInBindGroupLayout : kAllDimensions) {
// Create the bind group layout with the given texture view dimension. // Create the bind group layout with the given texture view dimension.
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding = defaultBindGroupLayoutBinding; wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
bindGroupLayoutBinding.textureDimension = dimensionInBindGroupLayout; bindGroupLayoutBinding.textureDimension = dimensionInBindGroupLayout;
wgpu::BindGroupLayout bindGroupLayout = wgpu::BindGroupLayout bindGroupLayout =
utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}); utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
@ -657,7 +657,7 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutTextureDimensionMatchesShad
// are allowed to have dynamic offsets. // are allowed to have dynamic offsets.
TEST_F(StorageTextureValidationTests, StorageTextureCannotHaveDynamicOffsets) { TEST_F(StorageTextureValidationTests, StorageTextureCannotHaveDynamicOffsets) {
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) { for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding; wgpu::BindGroupLayoutEntry bindGroupLayoutBinding;
bindGroupLayoutBinding.binding = 0; bindGroupLayoutBinding.binding = 0;
bindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute; bindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
bindGroupLayoutBinding.type = storageBindingType; bindGroupLayoutBinding.type = storageBindingType;
@ -674,7 +674,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureBindingTypeInBindGroup) {
constexpr wgpu::TextureFormat kStorageTextureFormat = wgpu::TextureFormat::R32Float; constexpr wgpu::TextureFormat kStorageTextureFormat = wgpu::TextureFormat::R32Float;
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) { for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
// Create a bind group layout. // Create a bind group layout.
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding; wgpu::BindGroupLayoutEntry bindGroupLayoutBinding;
bindGroupLayoutBinding.binding = 0; bindGroupLayoutBinding.binding = 0;
bindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute; bindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
bindGroupLayoutBinding.type = storageBindingType; bindGroupLayoutBinding.type = storageBindingType;
@ -718,7 +718,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureUsageInBindGroup) {
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) { for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
// Create a bind group layout. // Create a bind group layout.
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding; wgpu::BindGroupLayoutEntry bindGroupLayoutBinding;
bindGroupLayoutBinding.binding = 0; bindGroupLayoutBinding.binding = 0;
bindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute; bindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
bindGroupLayoutBinding.type = storageBindingType; bindGroupLayoutBinding.type = storageBindingType;
@ -747,10 +747,10 @@ TEST_F(StorageTextureValidationTests, StorageTextureUsageInBindGroup) {
// group must match the corresponding bind group binding. // group must match the corresponding bind group binding.
TEST_F(StorageTextureValidationTests, StorageTextureFormatInBindGroup) { TEST_F(StorageTextureValidationTests, StorageTextureFormatInBindGroup) {
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) { for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
wgpu::BindGroupLayoutBinding defaultBindGroupLayoutBinding; wgpu::BindGroupLayoutEntry defaultBindGroupLayoutEntry;
defaultBindGroupLayoutBinding.binding = 0; defaultBindGroupLayoutEntry.binding = 0;
defaultBindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute; defaultBindGroupLayoutEntry.visibility = wgpu::ShaderStage::Compute;
defaultBindGroupLayoutBinding.type = storageBindingType; defaultBindGroupLayoutEntry.type = storageBindingType;
for (wgpu::TextureFormat formatInBindGroupLayout : utils::kAllTextureFormats) { for (wgpu::TextureFormat formatInBindGroupLayout : utils::kAllTextureFormats) {
if (!utils::TextureFormatSupportsStorageTexture(formatInBindGroupLayout)) { if (!utils::TextureFormatSupportsStorageTexture(formatInBindGroupLayout)) {
@ -758,7 +758,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureFormatInBindGroup) {
} }
// Create a bind group layout with given storage texture format. // Create a bind group layout with given storage texture format.
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding = defaultBindGroupLayoutBinding; wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
bindGroupLayoutBinding.storageTextureFormat = formatInBindGroupLayout; bindGroupLayoutBinding.storageTextureFormat = formatInBindGroupLayout;
wgpu::BindGroupLayout bindGroupLayout = wgpu::BindGroupLayout bindGroupLayout =
utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}); utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
@ -808,15 +808,15 @@ TEST_F(StorageTextureValidationTests, StorageTextureViewDimensionInBindGroup) {
kDefaultTextureViewDescriptor.baseArrayLayer = 0; kDefaultTextureViewDescriptor.baseArrayLayer = 0;
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) { for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
wgpu::BindGroupLayoutBinding defaultBindGroupLayoutBinding; wgpu::BindGroupLayoutEntry defaultBindGroupLayoutEntry;
defaultBindGroupLayoutBinding.binding = 0; defaultBindGroupLayoutEntry.binding = 0;
defaultBindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute; defaultBindGroupLayoutEntry.visibility = wgpu::ShaderStage::Compute;
defaultBindGroupLayoutBinding.type = storageBindingType; defaultBindGroupLayoutEntry.type = storageBindingType;
defaultBindGroupLayoutBinding.storageTextureFormat = kStorageTextureFormat; defaultBindGroupLayoutEntry.storageTextureFormat = kStorageTextureFormat;
for (wgpu::TextureViewDimension dimensionInBindGroupLayout : kSupportedDimensions) { for (wgpu::TextureViewDimension dimensionInBindGroupLayout : kSupportedDimensions) {
// Create a bind group layout with given texture view dimension. // Create a bind group layout with given texture view dimension.
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding = defaultBindGroupLayoutBinding; wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
bindGroupLayoutBinding.textureDimension = dimensionInBindGroupLayout; bindGroupLayoutBinding.textureDimension = dimensionInBindGroupLayout;
wgpu::BindGroupLayout bindGroupLayout = wgpu::BindGroupLayout bindGroupLayout =
utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}); utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});

View File

@ -313,7 +313,7 @@ TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) {
// 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, StructureOfStructureArrayArgument) { TEST_F(WireArgumentTests, StructureOfStructureArrayArgument) {
static constexpr int NUM_BINDINGS = 3; static constexpr int NUM_BINDINGS = 3;
WGPUBindGroupLayoutBinding bindings[NUM_BINDINGS]{ WGPUBindGroupLayoutEntry bindings[NUM_BINDINGS]{
{0, WGPUShaderStage_Vertex, WGPUBindingType_Sampler, false, false, {0, WGPUShaderStage_Vertex, WGPUBindingType_Sampler, false, false,
WGPUTextureViewDimension_2D, WGPUTextureComponentType_Float}, WGPUTextureViewDimension_2D, WGPUTextureComponentType_Float},
{1, WGPUShaderStage_Vertex, WGPUBindingType_SampledTexture, false, false, {1, WGPUShaderStage_Vertex, WGPUBindingType_SampledTexture, false, false,

View File

@ -35,7 +35,7 @@ TEST_F(WireOptionalTests, OptionalObjectValue) {
.WillOnce(Return(apiBindGroupLayout)); .WillOnce(Return(apiBindGroupLayout));
// The `sampler`, `textureView` and `buffer` members of a binding are optional. // The `sampler`, `textureView` and `buffer` members of a binding are optional.
WGPUBindGroupBinding binding; WGPUBindGroupEntry binding;
binding.binding = 0; binding.binding = 0;
binding.sampler = nullptr; binding.sampler = nullptr;
binding.textureView = nullptr; binding.textureView = nullptr;

View File

@ -274,11 +274,11 @@ namespace utils {
wgpu::BindGroupLayout MakeBindGroupLayout( wgpu::BindGroupLayout MakeBindGroupLayout(
const wgpu::Device& device, const wgpu::Device& device,
std::initializer_list<wgpu::BindGroupLayoutBinding> bindingsInitializer) { std::initializer_list<wgpu::BindGroupLayoutEntry> bindingsInitializer) {
constexpr wgpu::ShaderStage kNoStages{}; constexpr wgpu::ShaderStage kNoStages{};
std::vector<wgpu::BindGroupLayoutBinding> bindings; std::vector<wgpu::BindGroupLayoutEntry> bindings;
for (const wgpu::BindGroupLayoutBinding& binding : bindingsInitializer) { for (const wgpu::BindGroupLayoutEntry& binding : bindingsInitializer) {
if (binding.visibility != kNoStages) { if (binding.visibility != kNoStages) {
bindings.push_back(binding); bindings.push_back(binding);
} }
@ -307,8 +307,8 @@ namespace utils {
: binding(binding), buffer(buffer), offset(offset), size(size) { : binding(binding), buffer(buffer), offset(offset), size(size) {
} }
wgpu::BindGroupBinding BindingInitializationHelper::GetAsBinding() const { wgpu::BindGroupEntry BindingInitializationHelper::GetAsBinding() const {
wgpu::BindGroupBinding result; wgpu::BindGroupEntry result;
result.binding = binding; result.binding = binding;
result.sampler = sampler; result.sampler = sampler;
@ -324,7 +324,7 @@ namespace utils {
const wgpu::Device& device, const wgpu::Device& device,
const wgpu::BindGroupLayout& layout, const wgpu::BindGroupLayout& layout,
std::initializer_list<BindingInitializationHelper> bindingsInitializer) { std::initializer_list<BindingInitializationHelper> bindingsInitializer) {
std::vector<wgpu::BindGroupBinding> bindings; std::vector<wgpu::BindGroupEntry> bindings;
for (const BindingInitializationHelper& helper : bindingsInitializer) { for (const BindingInitializationHelper& helper : bindingsInitializer) {
bindings.push_back(helper.GetAsBinding()); bindings.push_back(helper.GetAsBinding());
} }

View File

@ -91,7 +91,7 @@ namespace utils {
const wgpu::BindGroupLayout* bindGroupLayout); const wgpu::BindGroupLayout* bindGroupLayout);
wgpu::BindGroupLayout MakeBindGroupLayout( wgpu::BindGroupLayout MakeBindGroupLayout(
const wgpu::Device& device, const wgpu::Device& device,
std::initializer_list<wgpu::BindGroupLayoutBinding> bindingsInitializer); std::initializer_list<wgpu::BindGroupLayoutEntry> bindingsInitializer);
// Helpers to make creating bind groups look nicer: // Helpers to make creating bind groups look nicer:
// //
@ -111,7 +111,7 @@ namespace utils {
uint64_t offset = 0, uint64_t offset = 0,
uint64_t size = wgpu::kWholeSize); uint64_t size = wgpu::kWholeSize);
wgpu::BindGroupBinding GetAsBinding() const; wgpu::BindGroupEntry GetAsBinding() const;
uint32_t binding; uint32_t binding;
wgpu::Sampler sampler; wgpu::Sampler sampler;