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:
parent
f526d777e0
commit
c3c6694d8f
|
@ -59,7 +59,7 @@
|
|||
"bind group": {
|
||||
"category": "object"
|
||||
},
|
||||
"bind group binding": {
|
||||
"bind group entry": {
|
||||
"category": "structure",
|
||||
"extensible": false,
|
||||
"members": [
|
||||
|
@ -78,13 +78,13 @@
|
|||
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
|
||||
{"name": "layout", "type": "bind group layout"},
|
||||
{"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": {
|
||||
"category": "object"
|
||||
},
|
||||
"bind group layout binding": {
|
||||
"bind group layout entry": {
|
||||
"category": "structure",
|
||||
"extensible": false,
|
||||
"members": [
|
||||
|
@ -104,7 +104,7 @@
|
|||
"members": [
|
||||
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
|
||||
{"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": {
|
||||
|
|
|
@ -114,6 +114,10 @@ typedef struct WGPUChainedStruct {
|
|||
|
||||
{% endfor %}
|
||||
|
||||
// TODO(dawn:22): Remove this once users use the "Entry" version.
|
||||
typedef WGPUBindGroupEntry WGPUBindGroupBinding;
|
||||
typedef WGPUBindGroupLayoutEntry WGPUBindGroupLayoutBinding;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -216,6 +216,10 @@ namespace wgpu {
|
|||
|
||||
{% endfor %}
|
||||
|
||||
// TODO(dawn:22): Remove this once users use the "Entry" version.
|
||||
using BindGroupBinding = BindGroupEntry;
|
||||
using BindGroupLayoutBinding = BindGroupLayoutEntry;
|
||||
|
||||
} // namespace wgpu
|
||||
|
||||
#endif // WEBGPU_CPP_H_
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace dawn_native {
|
|||
// Helper functions to perform binding-type specific validation
|
||||
|
||||
MaybeError ValidateBufferBinding(const DeviceBase* device,
|
||||
const BindGroupBinding& binding,
|
||||
const BindGroupEntry& binding,
|
||||
wgpu::BufferUsage requiredUsage) {
|
||||
if (binding.buffer == nullptr || binding.sampler != nullptr ||
|
||||
binding.textureView != nullptr) {
|
||||
|
@ -66,7 +66,7 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
MaybeError ValidateTextureBinding(const DeviceBase* device,
|
||||
const BindGroupBinding& binding,
|
||||
const BindGroupEntry& binding,
|
||||
wgpu::TextureUsage requiredUsage,
|
||||
const BindingInfo& bindingInfo) {
|
||||
if (binding.textureView == nullptr || binding.sampler != nullptr ||
|
||||
|
@ -110,8 +110,7 @@ namespace dawn_native {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError ValidateSamplerBinding(const DeviceBase* device,
|
||||
const BindGroupBinding& binding) {
|
||||
MaybeError ValidateSamplerBinding(const DeviceBase* device, const BindGroupEntry& binding) {
|
||||
if (binding.sampler == nullptr || binding.textureView != nullptr ||
|
||||
binding.buffer != nullptr) {
|
||||
return DAWN_VALIDATION_ERROR("expected sampler binding");
|
||||
|
@ -138,7 +137,7 @@ namespace dawn_native {
|
|||
|
||||
std::bitset<kMaxBindingsPerGroup> bindingsSet;
|
||||
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));
|
||||
if (it == bindingMap.end()) {
|
||||
|
@ -208,7 +207,7 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
for (uint32_t i = 0; i < descriptor->bindingCount; ++i) {
|
||||
const BindGroupBinding& binding = descriptor->bindings[i];
|
||||
const BindGroupEntry& binding = descriptor->bindings[i];
|
||||
|
||||
BindingIndex bindingIndex =
|
||||
descriptor->layout->GetBindingIndex(BindingNumber(binding.binding));
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace dawn_native {
|
|||
uint32_t dynamicUniformBufferCount = 0;
|
||||
uint32_t dynamicStorageBufferCount = 0;
|
||||
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);
|
||||
|
||||
DAWN_TRY(ValidateShaderStage(binding.visibility));
|
||||
|
@ -149,7 +149,7 @@ namespace dawn_native {
|
|||
|
||||
if (binding.multisampled) {
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"BindGroupLayoutBinding::multisampled must be false (for now)");
|
||||
"BindGroupLayoutEntry::multisampled must be false (for now)");
|
||||
}
|
||||
|
||||
bindingsSet.insert(bindingNumber);
|
||||
|
@ -190,7 +190,7 @@ namespace dawn_native {
|
|||
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) {
|
||||
// Buffers with dynamic offsets should come before those without.
|
||||
// This makes it easy to iterate over the dynamic buffer bindings
|
||||
|
@ -258,13 +258,13 @@ namespace dawn_native {
|
|||
BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device,
|
||||
const BindGroupLayoutDescriptor* descriptor)
|
||||
: CachedObject(device), mBindingCount(descriptor->bindingCount) {
|
||||
std::vector<BindGroupLayoutBinding> sortedBindings(
|
||||
std::vector<BindGroupLayoutEntry> sortedBindings(
|
||||
descriptor->bindings, descriptor->bindings + descriptor->bindingCount);
|
||||
|
||||
std::sort(sortedBindings.begin(), sortedBindings.end(), SortBindingsCompare);
|
||||
|
||||
for (BindingIndex i = 0; i < mBindingCount; ++i) {
|
||||
const BindGroupLayoutBinding& binding = sortedBindings[i];
|
||||
const BindGroupLayoutEntry& binding = sortedBindings[i];
|
||||
mBindingInfo[i].type = binding.type;
|
||||
mBindingInfo[i].visibility = binding.visibility;
|
||||
mBindingInfo[i].textureComponentType =
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace dawn_native {
|
|||
|
||||
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 &&
|
||||
lhs.type == rhs.type && lhs.hasDynamicOffset == rhs.hasDynamicOffset &&
|
||||
lhs.multisampled == rhs.multisampled &&
|
||||
|
@ -127,7 +127,7 @@ namespace dawn_native {
|
|||
ASSERT(count > 0);
|
||||
|
||||
// Data which BindGroupLayoutDescriptor will point to for creation
|
||||
std::array<std::array<BindGroupLayoutBinding, kMaxBindingsPerGroup>, kMaxBindGroups>
|
||||
std::array<std::array<BindGroupLayoutEntry, kMaxBindingsPerGroup>, kMaxBindGroups>
|
||||
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)");
|
||||
}
|
||||
|
||||
BindGroupLayoutBinding bindingSlot;
|
||||
BindGroupLayoutEntry bindingSlot;
|
||||
bindingSlot.binding = bindingNumber;
|
||||
|
||||
DAWN_TRY(ValidateBindingTypeWithShaderStageVisibility(
|
||||
|
|
|
@ -754,7 +754,7 @@ TEST_P(BindGroupTests, DrawThenChangePipelineAndBindGroup) {
|
|||
TEST_P(BindGroupTests, BindGroupLayoutVisibilityCanBeNone) {
|
||||
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::BindGroupLayoutDescriptor descriptor;
|
||||
descriptor.bindingCount = 1;
|
||||
|
|
|
@ -105,7 +105,7 @@ TEST_P(DeviceLostTest, SubmitFails) {
|
|||
TEST_P(DeviceLostTest, CreateBindGroupLayoutFails) {
|
||||
SetCallbackAndLoseForTesting();
|
||||
|
||||
wgpu::BindGroupLayoutBinding binding = {0, wgpu::ShaderStage::None,
|
||||
wgpu::BindGroupLayoutEntry binding = {0, wgpu::ShaderStage::None,
|
||||
wgpu::BindingType::UniformBuffer};
|
||||
wgpu::BindGroupLayoutDescriptor descriptor;
|
||||
descriptor.bindingCount = 1;
|
||||
|
@ -139,7 +139,7 @@ TEST_P(DeviceLostTest, GetBindGroupLayoutFails) {
|
|||
TEST_P(DeviceLostTest, CreateBindGroupFails) {
|
||||
SetCallbackAndLoseForTesting();
|
||||
|
||||
wgpu::BindGroupBinding binding;
|
||||
wgpu::BindGroupEntry binding;
|
||||
binding.binding = 0;
|
||||
binding.sampler = nullptr;
|
||||
binding.textureView = nullptr;
|
||||
|
|
|
@ -23,7 +23,7 @@ TEST_P(StorageTextureTests, BindGroupLayoutWithStorageTextureBindingType) {
|
|||
// wgpu::BindingType::ReadonlyStorageTexture is a valid binding type to create a bind group
|
||||
// layout.
|
||||
{
|
||||
wgpu::BindGroupLayoutBinding binding = {0, wgpu::ShaderStage::Compute,
|
||||
wgpu::BindGroupLayoutEntry binding = {0, wgpu::ShaderStage::Compute,
|
||||
wgpu::BindingType::ReadonlyStorageTexture};
|
||||
binding.storageTextureFormat = wgpu::TextureFormat::R32Float;
|
||||
wgpu::BindGroupLayoutDescriptor descriptor;
|
||||
|
@ -35,7 +35,7 @@ TEST_P(StorageTextureTests, BindGroupLayoutWithStorageTextureBindingType) {
|
|||
// wgpu::BindingType::WriteonlyStorageTexture is a valid binding type to create a bind group
|
||||
// layout.
|
||||
{
|
||||
wgpu::BindGroupLayoutBinding binding = {0, wgpu::ShaderStage::Compute,
|
||||
wgpu::BindGroupLayoutEntry binding = {0, wgpu::ShaderStage::Compute,
|
||||
wgpu::BindingType::WriteonlyStorageTexture};
|
||||
binding.storageTextureFormat = wgpu::TextureFormat::R32Float;
|
||||
wgpu::BindGroupLayoutDescriptor descriptor;
|
||||
|
|
|
@ -92,7 +92,7 @@ TEST_F(BindGroupValidationTest, bindingCountMismatch) {
|
|||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {}));
|
||||
}
|
||||
|
||||
// Check constraints on BindGroupBinding::binding
|
||||
// Check constraints on BindGroupEntry::binding
|
||||
TEST_F(BindGroupValidationTest, WrongBindings) {
|
||||
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}});
|
||||
|
@ -131,7 +131,7 @@ TEST_F(BindGroupValidationTest, SamplerBindingType) {
|
|||
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}});
|
||||
|
||||
wgpu::BindGroupBinding binding;
|
||||
wgpu::BindGroupEntry binding;
|
||||
binding.binding = 0;
|
||||
binding.sampler = nullptr;
|
||||
binding.textureView = nullptr;
|
||||
|
@ -180,7 +180,7 @@ TEST_F(BindGroupValidationTest, TextureBindingType) {
|
|||
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture}});
|
||||
|
||||
wgpu::BindGroupBinding binding;
|
||||
wgpu::BindGroupEntry binding;
|
||||
binding.binding = 0;
|
||||
binding.sampler = nullptr;
|
||||
binding.textureView = nullptr;
|
||||
|
@ -234,7 +234,7 @@ TEST_F(BindGroupValidationTest, BufferBindingType) {
|
|||
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::UniformBuffer}});
|
||||
|
||||
wgpu::BindGroupBinding binding;
|
||||
wgpu::BindGroupEntry binding;
|
||||
binding.binding = 0;
|
||||
binding.sampler = nullptr;
|
||||
binding.textureView = nullptr;
|
||||
|
@ -467,7 +467,7 @@ TEST_F(BindGroupValidationTest, ErrorLayout) {
|
|||
|
||||
class BindGroupLayoutValidationTest : public ValidationTest {
|
||||
public:
|
||||
void TestCreateBindGroupLayout(wgpu::BindGroupLayoutBinding* binding,
|
||||
void TestCreateBindGroupLayout(wgpu::BindGroupLayoutEntry* binding,
|
||||
uint32_t count,
|
||||
bool expected) {
|
||||
wgpu::BindGroupLayoutDescriptor descriptor;
|
||||
|
@ -513,7 +513,7 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutStorageBindingsInVertexShad
|
|||
}
|
||||
|
||||
// Tests setting that bind group layout bindings numbers may be >= kMaxBindingsPerGroup.
|
||||
TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutBindingUnbounded) {
|
||||
TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutEntryUnbounded) {
|
||||
// Checks that kMaxBindingsPerGroup is valid.
|
||||
utils::MakeBindGroupLayout(device, {{kMaxBindingsPerGroup, wgpu::ShaderStage::Vertex,
|
||||
wgpu::BindingType::UniformBuffer}});
|
||||
|
@ -525,7 +525,7 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutBindingUnbounded) {
|
|||
|
||||
// Test that there can't be more than kMaxBindingPerGroup bindings per group
|
||||
TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutMaxBindings) {
|
||||
wgpu::BindGroupLayoutBinding bindings[kMaxBindingsPerGroup + 1];
|
||||
wgpu::BindGroupLayoutEntry bindings[kMaxBindingsPerGroup + 1];
|
||||
|
||||
for (uint32_t i = 0; i < kMaxBindingsPerGroup + 1; i++) {
|
||||
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
|
||||
// binding ids are out-of-order.
|
||||
TEST_F(BindGroupLayoutValidationTest, BindGroupBinding) {
|
||||
TEST_F(BindGroupLayoutValidationTest, BindGroupEntry) {
|
||||
utils::MakeBindGroupLayout(device,
|
||||
{
|
||||
{1, wgpu::ShaderStage::Vertex, wgpu::BindingType::UniformBuffer},
|
||||
|
@ -590,7 +590,7 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutVisibilityNone) {
|
|||
{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::BindGroupLayoutDescriptor descriptor;
|
||||
descriptor.bindingCount = 1;
|
||||
|
@ -601,9 +601,9 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutVisibilityNone) {
|
|||
// Check that dynamic buffer numbers exceed maximum value in one bind group layout.
|
||||
TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
|
||||
wgpu::BindGroupLayout bgl[2];
|
||||
std::vector<wgpu::BindGroupLayoutBinding> maxUniformDB;
|
||||
std::vector<wgpu::BindGroupLayoutBinding> maxStorageDB;
|
||||
std::vector<wgpu::BindGroupLayoutBinding> maxReadonlyStorageDB;
|
||||
std::vector<wgpu::BindGroupLayoutEntry> maxUniformDB;
|
||||
std::vector<wgpu::BindGroupLayoutEntry> maxStorageDB;
|
||||
std::vector<wgpu::BindGroupLayoutEntry> maxReadonlyStorageDB;
|
||||
|
||||
for (uint32_t i = 0; i < kMaxDynamicUniformBufferCount; ++i) {
|
||||
maxUniformDB.push_back(
|
||||
|
@ -620,7 +620,7 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
|
|||
{i, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageBuffer, true});
|
||||
}
|
||||
|
||||
auto MakeBindGroupLayout = [&](wgpu::BindGroupLayoutBinding* binding,
|
||||
auto MakeBindGroupLayout = [&](wgpu::BindGroupLayoutEntry* binding,
|
||||
uint32_t count) -> wgpu::BindGroupLayout {
|
||||
wgpu::BindGroupLayoutDescriptor descriptor;
|
||||
descriptor.bindingCount = count;
|
||||
|
@ -1027,9 +1027,9 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
|
|||
// Iterate through the desired bind group layouts.
|
||||
for (uint32_t l = 0; l < layouts.size(); ++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) {
|
||||
bindings[b] = {b, wgpu::ShaderStage::Fragment, layout[b], false};
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) {
|
|||
void main() {
|
||||
})");
|
||||
|
||||
wgpu::BindGroupLayoutBinding binding = {};
|
||||
wgpu::BindGroupLayoutEntry binding = {};
|
||||
binding.binding = 0;
|
||||
binding.type = wgpu::BindingType::UniformBuffer;
|
||||
binding.multisampled = false;
|
||||
|
@ -150,7 +150,7 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
|
|||
|
||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&descriptor);
|
||||
|
||||
wgpu::BindGroupLayoutBinding binding = {};
|
||||
wgpu::BindGroupLayoutEntry binding = {};
|
||||
binding.binding = 0;
|
||||
binding.type = wgpu::BindingType::UniformBuffer;
|
||||
binding.visibility = kVisibilityAll;
|
||||
|
@ -165,7 +165,7 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
|
|||
|
||||
// Test that the binding type matches the shader.
|
||||
TEST_F(GetBindGroupLayoutTests, BindingType) {
|
||||
wgpu::BindGroupLayoutBinding binding = {};
|
||||
wgpu::BindGroupLayoutEntry binding = {};
|
||||
binding.binding = 0;
|
||||
binding.hasDynamicOffset = false;
|
||||
binding.multisampled = false;
|
||||
|
@ -236,7 +236,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||
|
||||
// Test that multisampling matches the shader.
|
||||
TEST_F(GetBindGroupLayoutTests, Multisampled) {
|
||||
wgpu::BindGroupLayoutBinding binding = {};
|
||||
wgpu::BindGroupLayoutEntry binding = {};
|
||||
binding.binding = 0;
|
||||
binding.type = wgpu::BindingType::SampledTexture;
|
||||
binding.visibility = kVisibilityAll;
|
||||
|
@ -273,7 +273,7 @@ TEST_F(GetBindGroupLayoutTests, Multisampled) {
|
|||
|
||||
// Test that texture view dimension matches the shader.
|
||||
TEST_F(GetBindGroupLayoutTests, TextureDimension) {
|
||||
wgpu::BindGroupLayoutBinding binding = {};
|
||||
wgpu::BindGroupLayoutEntry binding = {};
|
||||
binding.binding = 0;
|
||||
binding.type = wgpu::BindingType::SampledTexture;
|
||||
binding.visibility = kVisibilityAll;
|
||||
|
@ -347,7 +347,7 @@ TEST_F(GetBindGroupLayoutTests, TextureDimension) {
|
|||
|
||||
// Test that texture component type matches the shader.
|
||||
TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
|
||||
wgpu::BindGroupLayoutBinding binding = {};
|
||||
wgpu::BindGroupLayoutEntry binding = {};
|
||||
binding.binding = 0;
|
||||
binding.type = wgpu::BindingType::SampledTexture;
|
||||
binding.visibility = kVisibilityAll;
|
||||
|
@ -391,7 +391,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
|
|||
|
||||
// Test that binding= indices match.
|
||||
TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
||||
wgpu::BindGroupLayoutBinding binding = {};
|
||||
wgpu::BindGroupLayoutEntry binding = {};
|
||||
binding.type = wgpu::BindingType::UniformBuffer;
|
||||
binding.visibility = kVisibilityAll;
|
||||
binding.hasDynamicOffset = false;
|
||||
|
@ -619,7 +619,7 @@ TEST_F(GetBindGroupLayoutTests, UnusedIndex) {
|
|||
// Test that after explicitly creating a pipeline with a pipeline layout, calling
|
||||
// GetBindGroupLayout reflects the same bind group layouts.
|
||||
TEST_F(GetBindGroupLayoutTests, Reflection) {
|
||||
wgpu::BindGroupLayoutBinding binding = {};
|
||||
wgpu::BindGroupLayoutEntry binding = {};
|
||||
binding.binding = 0;
|
||||
binding.type = wgpu::BindingType::UniformBuffer;
|
||||
binding.visibility = wgpu::ShaderStage::Vertex;
|
||||
|
|
|
@ -381,7 +381,7 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutWithStorageTextureBindingTy
|
|||
{wgpu::ShaderStage::Compute, wgpu::BindingType::StorageTexture, false}}};
|
||||
|
||||
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;
|
||||
wgpu::BindGroupLayoutDescriptor descriptor;
|
||||
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
|
||||
// render and compute pipeline, the binding type in the bind group layout must match the
|
||||
// declaration in the shader.
|
||||
TEST_F(StorageTextureValidationTests, BindGroupLayoutBindingTypeMatchesShaderDeclaration) {
|
||||
TEST_F(StorageTextureValidationTests, BindGroupLayoutEntryTypeMatchesShaderDeclaration) {
|
||||
constexpr std::array<wgpu::BindingType, 7> kSupportedBindingTypes = {
|
||||
wgpu::BindingType::UniformBuffer, wgpu::BindingType::StorageBuffer,
|
||||
wgpu::BindingType::ReadonlyStorageBuffer, wgpu::BindingType::Sampler,
|
||||
|
@ -483,17 +483,17 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutBindingTypeMatchesShaderDec
|
|||
defaultComputePipelineDescriptor.computeStage.entryPoint = "main";
|
||||
|
||||
// Set common fileds of bind group layout binding.
|
||||
wgpu::BindGroupLayoutBinding defaultBindGroupLayoutBinding;
|
||||
defaultBindGroupLayoutBinding.binding = 0;
|
||||
defaultBindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
|
||||
defaultBindGroupLayoutBinding.storageTextureFormat = kStorageTextureFormat;
|
||||
wgpu::BindGroupLayoutEntry defaultBindGroupLayoutEntry;
|
||||
defaultBindGroupLayoutEntry.binding = 0;
|
||||
defaultBindGroupLayoutEntry.visibility = wgpu::ShaderStage::Compute;
|
||||
defaultBindGroupLayoutEntry.storageTextureFormat = kStorageTextureFormat;
|
||||
|
||||
for (wgpu::BindingType bindingTypeInBindgroupLayout : kSupportedBindingTypes) {
|
||||
wgpu::ComputePipelineDescriptor computePipelineDescriptor =
|
||||
defaultComputePipelineDescriptor;
|
||||
|
||||
// Create bind group layout with different binding types.
|
||||
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding = defaultBindGroupLayoutBinding;
|
||||
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
|
||||
bindGroupLayoutBinding.type = bindingTypeInBindgroupLayout;
|
||||
wgpu::BindGroupLayout bindGroupLayout =
|
||||
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
|
||||
// type is read-only or write-only storage texture.
|
||||
TEST_F(StorageTextureValidationTests, UndefinedStorageTextureFormatInBindGroupLayout) {
|
||||
wgpu::BindGroupLayoutBinding errorBindGroupLayoutBinding;
|
||||
errorBindGroupLayoutBinding.binding = 0;
|
||||
errorBindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
|
||||
errorBindGroupLayoutBinding.storageTextureFormat = wgpu::TextureFormat::Undefined;
|
||||
wgpu::BindGroupLayoutEntry errorBindGroupLayoutEntry;
|
||||
errorBindGroupLayoutEntry.binding = 0;
|
||||
errorBindGroupLayoutEntry.visibility = wgpu::ShaderStage::Compute;
|
||||
errorBindGroupLayoutEntry.storageTextureFormat = wgpu::TextureFormat::Undefined;
|
||||
|
||||
for (wgpu::BindingType bindingType : kSupportedStorageTextureBindingTypes) {
|
||||
errorBindGroupLayoutBinding.type = bindingType;
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(device, {errorBindGroupLayoutBinding}));
|
||||
errorBindGroupLayoutEntry.type = bindingType;
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(device, {errorBindGroupLayoutEntry}));
|
||||
}
|
||||
}
|
||||
|
||||
// Verify it is invalid to create a bind group layout with storage textures and an unsupported
|
||||
// storage texture format.
|
||||
TEST_F(StorageTextureValidationTests, StorageTextureFormatInBindGroupLayout) {
|
||||
wgpu::BindGroupLayoutBinding defaultBindGroupLayoutBinding;
|
||||
defaultBindGroupLayoutBinding.binding = 0;
|
||||
defaultBindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
|
||||
wgpu::BindGroupLayoutEntry defaultBindGroupLayoutEntry;
|
||||
defaultBindGroupLayoutEntry.binding = 0;
|
||||
defaultBindGroupLayoutEntry.visibility = wgpu::ShaderStage::Compute;
|
||||
|
||||
for (wgpu::BindingType bindingType : kSupportedStorageTextureBindingTypes) {
|
||||
for (wgpu::TextureFormat textureFormat : utils::kAllTextureFormats) {
|
||||
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding = defaultBindGroupLayoutBinding;
|
||||
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
|
||||
bindGroupLayoutBinding.type = bindingType;
|
||||
bindGroupLayoutBinding.storageTextureFormat = textureFormat;
|
||||
if (utils::TextureFormatSupportsStorageTexture(textureFormat)) {
|
||||
|
@ -567,8 +567,8 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutStorageTextureFormatMatches
|
|||
defaultComputePipelineDescriptor.computeStage.entryPoint = "main";
|
||||
|
||||
// Set common fileds of bind group layout binding.
|
||||
wgpu::BindGroupLayoutBinding defaultBindGroupLayoutBinding = {
|
||||
0, wgpu::ShaderStage::Compute, bindingType};
|
||||
wgpu::BindGroupLayoutEntry defaultBindGroupLayoutEntry = {0, wgpu::ShaderStage::Compute,
|
||||
bindingType};
|
||||
|
||||
for (wgpu::TextureFormat storageTextureFormatInBindGroupLayout :
|
||||
utils::kAllTextureFormats) {
|
||||
|
@ -578,7 +578,7 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutStorageTextureFormatMatches
|
|||
}
|
||||
|
||||
// Create the bind group layout with the given storage texture format.
|
||||
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding = defaultBindGroupLayoutBinding;
|
||||
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
|
||||
bindGroupLayoutBinding.storageTextureFormat = storageTextureFormatInBindGroupLayout;
|
||||
wgpu::BindGroupLayout bindGroupLayout =
|
||||
utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
|
||||
|
@ -624,13 +624,13 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutTextureDimensionMatchesShad
|
|||
defaultComputePipelineDescriptor.computeStage.entryPoint = "main";
|
||||
|
||||
// Set common fileds of bind group layout binding.
|
||||
wgpu::BindGroupLayoutBinding defaultBindGroupLayoutBinding = {
|
||||
0, wgpu::ShaderStage::Compute, bindingType};
|
||||
defaultBindGroupLayoutBinding.storageTextureFormat = kStorageTextureFormat;
|
||||
wgpu::BindGroupLayoutEntry defaultBindGroupLayoutEntry = {0, wgpu::ShaderStage::Compute,
|
||||
bindingType};
|
||||
defaultBindGroupLayoutEntry.storageTextureFormat = kStorageTextureFormat;
|
||||
|
||||
for (wgpu::TextureViewDimension dimensionInBindGroupLayout : kAllDimensions) {
|
||||
// Create the bind group layout with the given texture view dimension.
|
||||
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding = defaultBindGroupLayoutBinding;
|
||||
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
|
||||
bindGroupLayoutBinding.textureDimension = dimensionInBindGroupLayout;
|
||||
wgpu::BindGroupLayout bindGroupLayout =
|
||||
utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
|
||||
|
@ -657,7 +657,7 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutTextureDimensionMatchesShad
|
|||
// are allowed to have dynamic offsets.
|
||||
TEST_F(StorageTextureValidationTests, StorageTextureCannotHaveDynamicOffsets) {
|
||||
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
|
||||
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding;
|
||||
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding;
|
||||
bindGroupLayoutBinding.binding = 0;
|
||||
bindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
|
||||
bindGroupLayoutBinding.type = storageBindingType;
|
||||
|
@ -674,7 +674,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureBindingTypeInBindGroup) {
|
|||
constexpr wgpu::TextureFormat kStorageTextureFormat = wgpu::TextureFormat::R32Float;
|
||||
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
|
||||
// Create a bind group layout.
|
||||
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding;
|
||||
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding;
|
||||
bindGroupLayoutBinding.binding = 0;
|
||||
bindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
|
||||
bindGroupLayoutBinding.type = storageBindingType;
|
||||
|
@ -718,7 +718,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureUsageInBindGroup) {
|
|||
|
||||
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
|
||||
// Create a bind group layout.
|
||||
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding;
|
||||
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding;
|
||||
bindGroupLayoutBinding.binding = 0;
|
||||
bindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
|
||||
bindGroupLayoutBinding.type = storageBindingType;
|
||||
|
@ -747,10 +747,10 @@ TEST_F(StorageTextureValidationTests, StorageTextureUsageInBindGroup) {
|
|||
// group must match the corresponding bind group binding.
|
||||
TEST_F(StorageTextureValidationTests, StorageTextureFormatInBindGroup) {
|
||||
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
|
||||
wgpu::BindGroupLayoutBinding defaultBindGroupLayoutBinding;
|
||||
defaultBindGroupLayoutBinding.binding = 0;
|
||||
defaultBindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
|
||||
defaultBindGroupLayoutBinding.type = storageBindingType;
|
||||
wgpu::BindGroupLayoutEntry defaultBindGroupLayoutEntry;
|
||||
defaultBindGroupLayoutEntry.binding = 0;
|
||||
defaultBindGroupLayoutEntry.visibility = wgpu::ShaderStage::Compute;
|
||||
defaultBindGroupLayoutEntry.type = storageBindingType;
|
||||
|
||||
for (wgpu::TextureFormat formatInBindGroupLayout : utils::kAllTextureFormats) {
|
||||
if (!utils::TextureFormatSupportsStorageTexture(formatInBindGroupLayout)) {
|
||||
|
@ -758,7 +758,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureFormatInBindGroup) {
|
|||
}
|
||||
|
||||
// Create a bind group layout with given storage texture format.
|
||||
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding = defaultBindGroupLayoutBinding;
|
||||
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
|
||||
bindGroupLayoutBinding.storageTextureFormat = formatInBindGroupLayout;
|
||||
wgpu::BindGroupLayout bindGroupLayout =
|
||||
utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
|
||||
|
@ -808,15 +808,15 @@ TEST_F(StorageTextureValidationTests, StorageTextureViewDimensionInBindGroup) {
|
|||
kDefaultTextureViewDescriptor.baseArrayLayer = 0;
|
||||
|
||||
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
|
||||
wgpu::BindGroupLayoutBinding defaultBindGroupLayoutBinding;
|
||||
defaultBindGroupLayoutBinding.binding = 0;
|
||||
defaultBindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
|
||||
defaultBindGroupLayoutBinding.type = storageBindingType;
|
||||
defaultBindGroupLayoutBinding.storageTextureFormat = kStorageTextureFormat;
|
||||
wgpu::BindGroupLayoutEntry defaultBindGroupLayoutEntry;
|
||||
defaultBindGroupLayoutEntry.binding = 0;
|
||||
defaultBindGroupLayoutEntry.visibility = wgpu::ShaderStage::Compute;
|
||||
defaultBindGroupLayoutEntry.type = storageBindingType;
|
||||
defaultBindGroupLayoutEntry.storageTextureFormat = kStorageTextureFormat;
|
||||
|
||||
for (wgpu::TextureViewDimension dimensionInBindGroupLayout : kSupportedDimensions) {
|
||||
// Create a bind group layout with given texture view dimension.
|
||||
wgpu::BindGroupLayoutBinding bindGroupLayoutBinding = defaultBindGroupLayoutBinding;
|
||||
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
|
||||
bindGroupLayoutBinding.textureDimension = dimensionInBindGroupLayout;
|
||||
wgpu::BindGroupLayout bindGroupLayout =
|
||||
utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
|
||||
|
|
|
@ -313,7 +313,7 @@ TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) {
|
|||
// Test that the wire is able to send structures that contain objects
|
||||
TEST_F(WireArgumentTests, StructureOfStructureArrayArgument) {
|
||||
static constexpr int NUM_BINDINGS = 3;
|
||||
WGPUBindGroupLayoutBinding bindings[NUM_BINDINGS]{
|
||||
WGPUBindGroupLayoutEntry bindings[NUM_BINDINGS]{
|
||||
{0, WGPUShaderStage_Vertex, WGPUBindingType_Sampler, false, false,
|
||||
WGPUTextureViewDimension_2D, WGPUTextureComponentType_Float},
|
||||
{1, WGPUShaderStage_Vertex, WGPUBindingType_SampledTexture, false, false,
|
||||
|
|
|
@ -35,7 +35,7 @@ TEST_F(WireOptionalTests, OptionalObjectValue) {
|
|||
.WillOnce(Return(apiBindGroupLayout));
|
||||
|
||||
// The `sampler`, `textureView` and `buffer` members of a binding are optional.
|
||||
WGPUBindGroupBinding binding;
|
||||
WGPUBindGroupEntry binding;
|
||||
binding.binding = 0;
|
||||
binding.sampler = nullptr;
|
||||
binding.textureView = nullptr;
|
||||
|
|
|
@ -274,11 +274,11 @@ namespace utils {
|
|||
|
||||
wgpu::BindGroupLayout MakeBindGroupLayout(
|
||||
const wgpu::Device& device,
|
||||
std::initializer_list<wgpu::BindGroupLayoutBinding> bindingsInitializer) {
|
||||
std::initializer_list<wgpu::BindGroupLayoutEntry> bindingsInitializer) {
|
||||
constexpr wgpu::ShaderStage kNoStages{};
|
||||
|
||||
std::vector<wgpu::BindGroupLayoutBinding> bindings;
|
||||
for (const wgpu::BindGroupLayoutBinding& binding : bindingsInitializer) {
|
||||
std::vector<wgpu::BindGroupLayoutEntry> bindings;
|
||||
for (const wgpu::BindGroupLayoutEntry& binding : bindingsInitializer) {
|
||||
if (binding.visibility != kNoStages) {
|
||||
bindings.push_back(binding);
|
||||
}
|
||||
|
@ -307,8 +307,8 @@ namespace utils {
|
|||
: binding(binding), buffer(buffer), offset(offset), size(size) {
|
||||
}
|
||||
|
||||
wgpu::BindGroupBinding BindingInitializationHelper::GetAsBinding() const {
|
||||
wgpu::BindGroupBinding result;
|
||||
wgpu::BindGroupEntry BindingInitializationHelper::GetAsBinding() const {
|
||||
wgpu::BindGroupEntry result;
|
||||
|
||||
result.binding = binding;
|
||||
result.sampler = sampler;
|
||||
|
@ -324,7 +324,7 @@ namespace utils {
|
|||
const wgpu::Device& device,
|
||||
const wgpu::BindGroupLayout& layout,
|
||||
std::initializer_list<BindingInitializationHelper> bindingsInitializer) {
|
||||
std::vector<wgpu::BindGroupBinding> bindings;
|
||||
std::vector<wgpu::BindGroupEntry> bindings;
|
||||
for (const BindingInitializationHelper& helper : bindingsInitializer) {
|
||||
bindings.push_back(helper.GetAsBinding());
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace utils {
|
|||
const wgpu::BindGroupLayout* bindGroupLayout);
|
||||
wgpu::BindGroupLayout MakeBindGroupLayout(
|
||||
const wgpu::Device& device,
|
||||
std::initializer_list<wgpu::BindGroupLayoutBinding> bindingsInitializer);
|
||||
std::initializer_list<wgpu::BindGroupLayoutEntry> bindingsInitializer);
|
||||
|
||||
// Helpers to make creating bind groups look nicer:
|
||||
//
|
||||
|
@ -111,7 +111,7 @@ namespace utils {
|
|||
uint64_t offset = 0,
|
||||
uint64_t size = wgpu::kWholeSize);
|
||||
|
||||
wgpu::BindGroupBinding GetAsBinding() const;
|
||||
wgpu::BindGroupEntry GetAsBinding() const;
|
||||
|
||||
uint32_t binding;
|
||||
wgpu::Sampler sampler;
|
||||
|
|
Loading…
Reference in New Issue