Rename ShaderStageBit to ShaderStage.

This is to follow changes to WebGPU's IDL and header file where the Bit
suffix disappeared. This caused a conflict with
utils/dawn_native::ShaderStage that were both renamed to
SingleShaderStage.

BUG-dawn: 22
Change-Id: I7b085686775fa19e4b4a3b54979903d72f3ef660
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10462
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez 2019-08-27 08:42:29 +00:00 committed by Commit Bot service account
parent 9e9e29f7a6
commit b9b088f57e
76 changed files with 469 additions and 460 deletions

View File

@ -54,7 +54,7 @@
"extensible": false,
"members": [
{"name": "binding", "type": "uint32_t"},
{"name": "visibility", "type": "shader stage bit"},
{"name": "visibility", "type": "shader stage"},
{"name": "type", "type": "binding type"},
{"name": "dynamic", "type": "bool", "default": "false"},
{"name": "multisampled", "type": "bool", "default": "false"},
@ -1063,7 +1063,7 @@
{"name": "code", "type": "uint32_t", "annotation": "const*", "length": "code size"}
]
},
"shader stage bit": {
"shader stage": {
"category": "bitmask",
"values": [
{"value": 0, "name": "none"},

View File

@ -55,7 +55,8 @@ void init() {
swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment,
640, 480);
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(std140, set = 0, binding = 0) uniform Constants {
@ -103,7 +104,7 @@ void init() {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
layout(location = 0) in vec4 v_color;
@ -112,7 +113,7 @@ void init() {
})");
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer, true}});
device, {{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer, true}});
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);

View File

@ -45,7 +45,8 @@ void init() {
" gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n"
"}\n";
DawnShaderModule vsModule =
utils::CreateShaderModule(dawn::Device(device), utils::ShaderStage::Vertex, vs).Release();
utils::CreateShaderModule(dawn::Device(device), utils::SingleShaderStage::Vertex, vs)
.Release();
const char* fs =
"#version 450\n"
@ -54,7 +55,7 @@ void init() {
" fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
"}\n";
DawnShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fs).Release();
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs).Release();
{
DawnRenderPipelineDescriptor descriptor;

View File

@ -96,7 +96,8 @@ void initBuffers() {
}
void initRender() {
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(location = 0) in vec2 a_particlePos;
layout(location = 1) in vec2 a_particleVel;
@ -110,7 +111,7 @@ void initRender() {
)");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {
@ -146,7 +147,8 @@ void initRender() {
}
void initSim() {
dawn::ShaderModule module = utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
dawn::ShaderModule module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
#version 450
struct Particle {
@ -237,9 +239,9 @@ void initSim() {
auto bgl = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
{2, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
{0, dawn::ShaderStage::Compute, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
{2, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
});
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);

View File

@ -96,7 +96,8 @@ void init() {
initBuffers();
initTextures();
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(location = 0) in vec4 pos;
void main() {
@ -104,7 +105,7 @@ void init() {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(set = 0, binding = 0) uniform sampler mySampler;
layout(set = 0, binding = 1) uniform texture2D myTexture;
@ -116,8 +117,8 @@ void init() {
auto bgl = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture},
{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture},
});
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);

View File

@ -124,7 +124,8 @@ void init() {
initBuffers();
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(set = 0, binding = 0) uniform cameraData {
mat4 view;
@ -142,7 +143,7 @@ void init() {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 2) in vec3 f_col;
layout(location = 0) out vec4 fragColor;
@ -151,7 +152,7 @@ void init() {
})");
dawn::ShaderModule fsReflectionModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 2) in vec3 f_col;
layout(location = 0) out vec4 fragColor;
@ -171,8 +172,8 @@ void init() {
auto bgl = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
});
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);

View File

@ -34,7 +34,7 @@ namespace dawn_native {
uint32_t dynamicStorageBufferCount = 0;
for (uint32_t i = 0; i < descriptor->bindingCount; ++i) {
const BindGroupLayoutBinding& binding = descriptor->bindings[i];
DAWN_TRY(ValidateShaderStageBit(binding.visibility));
DAWN_TRY(ValidateShaderStage(binding.visibility));
DAWN_TRY(ValidateBindingType(binding.type));
DAWN_TRY(ValidateTextureComponentType(binding.textureComponentType));
@ -45,7 +45,7 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR("some binding index was specified more than once");
}
if (binding.visibility == dawn::ShaderStageBit::None) {
if (binding.visibility == dawn::ShaderStage::None) {
return DAWN_VALIDATION_ERROR("Visibility of bindings can't be None");
}

View File

@ -40,7 +40,7 @@ namespace dawn_native {
static BindGroupLayoutBase* MakeError(DeviceBase* device);
struct LayoutBindingInfo {
std::array<dawn::ShaderStageBit, kMaxBindingsPerGroup> visibilities;
std::array<dawn::ShaderStage, kMaxBindingsPerGroup> visibilities;
std::array<dawn::BindingType, kMaxBindingsPerGroup> types;
std::array<dawn::TextureComponentType, kMaxBindingsPerGroup> textureComponentTypes;
std::bitset<kMaxBindingsPerGroup> dynamic;

View File

@ -27,7 +27,7 @@ namespace dawn_native {
DAWN_TRY(device->ValidateObject(descriptor->layout));
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->computeStage,
descriptor->layout, ShaderStage::Compute));
descriptor->layout, SingleShaderStage::Compute));
return {};
}
@ -36,7 +36,7 @@ namespace dawn_native {
ComputePipelineBase::ComputePipelineBase(DeviceBase* device,
const ComputePipelineDescriptor* descriptor,
bool blueprint)
: PipelineBase(device, descriptor->layout, dawn::ShaderStageBit::Compute),
: PipelineBase(device, descriptor->layout, dawn::ShaderStage::Compute),
mModule(descriptor->computeStage->module),
mEntryPoint(descriptor->computeStage->entryPoint),
mIsBlueprint(blueprint) {

View File

@ -16,14 +16,14 @@
namespace dawn_native {
BitSetIterator<kNumStages, ShaderStage> IterateStages(dawn::ShaderStageBit stages) {
BitSetIterator<kNumStages, SingleShaderStage> IterateStages(dawn::ShaderStage stages) {
std::bitset<kNumStages> bits(static_cast<uint32_t>(stages));
return BitSetIterator<kNumStages, ShaderStage>(bits);
return BitSetIterator<kNumStages, SingleShaderStage>(bits);
}
dawn::ShaderStageBit StageBit(ShaderStage stage) {
dawn::ShaderStage StageBit(SingleShaderStage stage) {
ASSERT(static_cast<uint32_t>(stage) < kNumStages);
return static_cast<dawn::ShaderStageBit>(1 << static_cast<uint32_t>(stage));
return static_cast<dawn::ShaderStage>(1 << static_cast<uint32_t>(stage));
}
} // namespace dawn_native

View File

@ -25,27 +25,27 @@
namespace dawn_native {
enum class ShaderStage { Vertex, Fragment, Compute };
enum class SingleShaderStage { Vertex, Fragment, Compute };
static_assert(static_cast<uint32_t>(ShaderStage::Vertex) < kNumStages, "");
static_assert(static_cast<uint32_t>(ShaderStage::Fragment) < kNumStages, "");
static_assert(static_cast<uint32_t>(ShaderStage::Compute) < kNumStages, "");
static_assert(static_cast<uint32_t>(SingleShaderStage::Vertex) < kNumStages, "");
static_assert(static_cast<uint32_t>(SingleShaderStage::Fragment) < kNumStages, "");
static_assert(static_cast<uint32_t>(SingleShaderStage::Compute) < kNumStages, "");
static_assert(static_cast<uint32_t>(dawn::ShaderStageBit::Vertex) ==
(1 << static_cast<uint32_t>(ShaderStage::Vertex)),
static_assert(static_cast<uint32_t>(dawn::ShaderStage::Vertex) ==
(1 << static_cast<uint32_t>(SingleShaderStage::Vertex)),
"");
static_assert(static_cast<uint32_t>(dawn::ShaderStageBit::Fragment) ==
(1 << static_cast<uint32_t>(ShaderStage::Fragment)),
static_assert(static_cast<uint32_t>(dawn::ShaderStage::Fragment) ==
(1 << static_cast<uint32_t>(SingleShaderStage::Fragment)),
"");
static_assert(static_cast<uint32_t>(dawn::ShaderStageBit::Compute) ==
(1 << static_cast<uint32_t>(ShaderStage::Compute)),
static_assert(static_cast<uint32_t>(dawn::ShaderStage::Compute) ==
(1 << static_cast<uint32_t>(SingleShaderStage::Compute)),
"");
BitSetIterator<kNumStages, ShaderStage> IterateStages(dawn::ShaderStageBit stages);
dawn::ShaderStageBit StageBit(ShaderStage stage);
BitSetIterator<kNumStages, SingleShaderStage> IterateStages(dawn::ShaderStage stages);
dawn::ShaderStage StageBit(SingleShaderStage stage);
static constexpr dawn::ShaderStageBit kAllStages =
static_cast<dawn::ShaderStageBit>((1 << kNumStages) - 1);
static constexpr dawn::ShaderStage kAllStages =
static_cast<dawn::ShaderStage>((1 << kNumStages) - 1);
template <typename T>
class PerStage {
@ -55,21 +55,21 @@ namespace dawn_native {
mData.fill(initialValue);
}
T& operator[](ShaderStage stage) {
T& operator[](SingleShaderStage stage) {
DAWN_ASSERT(static_cast<uint32_t>(stage) < kNumStages);
return mData[static_cast<uint32_t>(stage)];
}
const T& operator[](ShaderStage stage) const {
const T& operator[](SingleShaderStage stage) const {
DAWN_ASSERT(static_cast<uint32_t>(stage) < kNumStages);
return mData[static_cast<uint32_t>(stage)];
}
T& operator[](dawn::ShaderStageBit stageBit) {
T& operator[](dawn::ShaderStage stageBit) {
uint32_t bit = static_cast<uint32_t>(stageBit);
DAWN_ASSERT(bit != 0 && IsPowerOfTwo(bit) && bit <= (1 << kNumStages));
return mData[Log2(bit)];
}
const T& operator[](dawn::ShaderStageBit stageBit) const {
const T& operator[](dawn::ShaderStage stageBit) const {
uint32_t bit = static_cast<uint32_t>(stageBit);
DAWN_ASSERT(bit != 0 && IsPowerOfTwo(bit) && bit <= (1 << kNumStages));
return mData[Log2(bit)];

View File

@ -23,7 +23,7 @@ namespace dawn_native {
MaybeError ValidatePipelineStageDescriptor(const DeviceBase* device,
const PipelineStageDescriptor* descriptor,
const PipelineLayoutBase* layout,
ShaderStage stage) {
SingleShaderStage stage) {
DAWN_TRY(device->ValidateObject(descriptor->module));
if (descriptor->entryPoint != std::string("main")) {
@ -42,7 +42,7 @@ namespace dawn_native {
PipelineBase::PipelineBase(DeviceBase* device,
PipelineLayoutBase* layout,
dawn::ShaderStageBit stages)
dawn::ShaderStage stages)
: ObjectBase(device), mStageMask(stages), mLayout(layout) {
}
@ -50,7 +50,7 @@ namespace dawn_native {
: ObjectBase(device, tag) {
}
dawn::ShaderStageBit PipelineBase::GetStageMask() const {
dawn::ShaderStage PipelineBase::GetStageMask() const {
ASSERT(!IsError());
return mStageMask;
}

View File

@ -31,20 +31,20 @@ namespace dawn_native {
MaybeError ValidatePipelineStageDescriptor(const DeviceBase* device,
const PipelineStageDescriptor* descriptor,
const PipelineLayoutBase* layout,
ShaderStage stage);
SingleShaderStage stage);
class PipelineBase : public ObjectBase {
public:
dawn::ShaderStageBit GetStageMask() const;
dawn::ShaderStage GetStageMask() const;
PipelineLayoutBase* GetLayout();
const PipelineLayoutBase* GetLayout() const;
protected:
PipelineBase(DeviceBase* device, PipelineLayoutBase* layout, dawn::ShaderStageBit stages);
PipelineBase(DeviceBase* device, PipelineLayoutBase* layout, dawn::ShaderStage stages);
PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag);
private:
dawn::ShaderStageBit mStageMask;
dawn::ShaderStage mStageMask;
Ref<PipelineLayoutBase> mLayout;
};

View File

@ -280,9 +280,9 @@ namespace dawn_native {
DAWN_TRY(ValidateVertexInputDescriptor(descriptor->vertexInput, &attributesSetMask));
DAWN_TRY(ValidatePrimitiveTopology(descriptor->primitiveTopology));
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->vertexStage,
descriptor->layout, ShaderStage::Vertex));
descriptor->layout, SingleShaderStage::Vertex));
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->fragmentStage,
descriptor->layout, ShaderStage::Fragment));
descriptor->layout, SingleShaderStage::Fragment));
if (descriptor->rasterizationState) {
DAWN_TRY(ValidateRasterizationStateDescriptor(descriptor->rasterizationState));
@ -352,7 +352,7 @@ namespace dawn_native {
bool blueprint)
: PipelineBase(device,
descriptor->layout,
dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment),
dawn::ShaderStage::Vertex | dawn::ShaderStage::Fragment),
mVertexInput(*descriptor->vertexInput),
mAttachmentState(device->GetOrCreateAttachmentState(descriptor)),
mPrimitiveTopology(descriptor->primitiveTopology),

View File

@ -102,13 +102,13 @@ namespace dawn_native {
switch (compiler.get_execution_model()) {
case spv::ExecutionModelVertex:
mExecutionModel = ShaderStage::Vertex;
mExecutionModel = SingleShaderStage::Vertex;
break;
case spv::ExecutionModelFragment:
mExecutionModel = ShaderStage::Fragment;
mExecutionModel = SingleShaderStage::Fragment;
break;
case spv::ExecutionModelGLCompute:
mExecutionModel = ShaderStage::Compute;
mExecutionModel = SingleShaderStage::Compute;
break;
default:
UNREACHABLE();
@ -153,7 +153,7 @@ namespace dawn_native {
dawn::BindingType::StorageBuffer);
// Extract the vertex attributes
if (mExecutionModel == ShaderStage::Vertex) {
if (mExecutionModel == SingleShaderStage::Vertex) {
for (const auto& attrib : resources.stage_inputs) {
ASSERT(compiler.get_decoration_bitset(attrib.id).get(spv::DecorationLocation));
uint32_t location = compiler.get_decoration(attrib.id, spv::DecorationLocation);
@ -176,7 +176,7 @@ namespace dawn_native {
}
}
if (mExecutionModel == ShaderStage::Fragment) {
if (mExecutionModel == SingleShaderStage::Fragment) {
// Without a location qualifier on vertex inputs, spirv_cross::CompilerMSL gives them
// all the location 0, causing a compile error.
for (const auto& attrib : resources.stage_inputs) {
@ -198,7 +198,7 @@ namespace dawn_native {
return mUsedVertexAttributes;
}
ShaderStage ShaderModuleBase::GetExecutionModel() const {
SingleShaderStage ShaderModuleBase::GetExecutionModel() const {
ASSERT(!IsError());
return mExecutionModel;
}

View File

@ -59,7 +59,7 @@ namespace dawn_native {
const ModuleBindingInfo& GetBindingInfo() const;
const std::bitset<kMaxVertexAttributes>& GetUsedVertexAttributes() const;
ShaderStage GetExecutionModel() const;
SingleShaderStage GetExecutionModel() const;
bool IsCompatibleWithPipelineLayout(const PipelineLayoutBase* layout);
@ -83,7 +83,7 @@ namespace dawn_native {
ModuleBindingInfo mBindingInfo;
std::bitset<kMaxVertexAttributes> mUsedVertexAttributes;
ShaderStage mExecutionModel;
SingleShaderStage mExecutionModel;
};
} // namespace dawn_native

View File

@ -24,14 +24,14 @@ using Microsoft::WRL::ComPtr;
namespace dawn_native { namespace d3d12 {
namespace {
D3D12_SHADER_VISIBILITY ShaderVisibilityType(dawn::ShaderStageBit visibility) {
ASSERT(visibility != dawn::ShaderStageBit::None);
D3D12_SHADER_VISIBILITY ShaderVisibilityType(dawn::ShaderStage visibility) {
ASSERT(visibility != dawn::ShaderStage::None);
if (visibility == dawn::ShaderStageBit::Vertex) {
if (visibility == dawn::ShaderStage::Vertex) {
return D3D12_SHADER_VISIBILITY_VERTEX;
}
if (visibility == dawn::ShaderStageBit::Fragment) {
if (visibility == dawn::ShaderStage::Fragment) {
return D3D12_SHADER_VISIBILITY_PIXEL;
}

View File

@ -304,21 +304,20 @@ namespace dawn_native { namespace d3d12 {
PerStage<ComPtr<ID3DBlob>> compiledShader;
ComPtr<ID3DBlob> errors;
dawn::ShaderStageBit renderStages =
dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment;
dawn::ShaderStage renderStages = dawn::ShaderStage::Vertex | dawn::ShaderStage::Fragment;
for (auto stage : IterateStages(renderStages)) {
const ShaderModule* module = nullptr;
const char* entryPoint = nullptr;
const char* compileTarget = nullptr;
D3D12_SHADER_BYTECODE* shader = nullptr;
switch (stage) {
case ShaderStage::Vertex:
case SingleShaderStage::Vertex:
module = ToBackend(descriptor->vertexStage->module);
entryPoint = descriptor->vertexStage->entryPoint;
shader = &descriptorD3D12.VS;
compileTarget = "vs_5_1";
break;
case ShaderStage::Fragment:
case SingleShaderStage::Fragment:
module = ToBackend(descriptor->fragmentStage->module);
entryPoint = descriptor->fragmentStage->entryPoint;
shader = &descriptorD3D12.PS;

View File

@ -200,32 +200,32 @@ namespace dawn_native { namespace metal {
// length of storage buffers and can apply them to the reserved "buffer length buffer" when
// needed for a draw or a dispatch.
struct StorageBufferLengthTracker {
dawn::ShaderStageBit dirtyStages = dawn::ShaderStageBit::None;
dawn::ShaderStage dirtyStages = dawn::ShaderStage::None;
// The lengths of buffers are stored as 32bit integers because that is the width the
// MSL code generated by SPIRV-Cross expects.
PerStage<std::array<uint32_t, kGenericMetalBufferSlots>> data;
void Apply(RenderPipeline* pipeline, id<MTLRenderCommandEncoder> render) {
dawn::ShaderStageBit stagesToApply =
dawn::ShaderStage stagesToApply =
dirtyStages & pipeline->GetStagesRequiringStorageBufferLength();
if (stagesToApply == dawn::ShaderStageBit::None) {
if (stagesToApply == dawn::ShaderStage::None) {
return;
}
if (stagesToApply & dawn::ShaderStageBit::Vertex) {
if (stagesToApply & dawn::ShaderStage::Vertex) {
uint32_t bufferCount = ToBackend(pipeline->GetLayout())
->GetBufferBindingCount(ShaderStage::Vertex);
[render setVertexBytes:data[ShaderStage::Vertex].data()
->GetBufferBindingCount(SingleShaderStage::Vertex);
[render setVertexBytes:data[SingleShaderStage::Vertex].data()
length:sizeof(uint32_t) * bufferCount
atIndex:kBufferLengthBufferSlot];
}
if (stagesToApply & dawn::ShaderStageBit::Fragment) {
if (stagesToApply & dawn::ShaderStage::Fragment) {
uint32_t bufferCount = ToBackend(pipeline->GetLayout())
->GetBufferBindingCount(ShaderStage::Fragment);
[render setFragmentBytes:data[ShaderStage::Fragment].data()
->GetBufferBindingCount(SingleShaderStage::Fragment);
[render setFragmentBytes:data[SingleShaderStage::Fragment].data()
length:sizeof(uint32_t) * bufferCount
atIndex:kBufferLengthBufferSlot];
}
@ -235,7 +235,7 @@ namespace dawn_native { namespace metal {
}
void Apply(ComputePipeline* pipeline, id<MTLComputeCommandEncoder> compute) {
if (!(dirtyStages & dawn::ShaderStageBit::Compute)) {
if (!(dirtyStages & dawn::ShaderStage::Compute)) {
return;
}
@ -243,13 +243,13 @@ namespace dawn_native { namespace metal {
return;
}
uint32_t bufferCount =
ToBackend(pipeline->GetLayout())->GetBufferBindingCount(ShaderStage::Compute);
[compute setBytes:data[ShaderStage::Compute].data()
uint32_t bufferCount = ToBackend(pipeline->GetLayout())
->GetBufferBindingCount(SingleShaderStage::Compute);
[compute setBytes:data[SingleShaderStage::Compute].data()
length:sizeof(uint32_t) * bufferCount
atIndex:kBufferLengthBufferSlot];
dirtyStages ^= dawn::ShaderStageBit::Compute;
dirtyStages ^= dawn::ShaderStage::Compute;
}
};
@ -273,9 +273,9 @@ namespace dawn_native { namespace metal {
// call here.
for (uint32_t bindingIndex : IterateBitSet(layout.mask)) {
auto stage = layout.visibilities[bindingIndex];
bool hasVertStage = stage & dawn::ShaderStageBit::Vertex && render != nil;
bool hasFragStage = stage & dawn::ShaderStageBit::Fragment && render != nil;
bool hasComputeStage = stage & dawn::ShaderStageBit::Compute && compute != nil;
bool hasVertStage = stage & dawn::ShaderStage::Vertex && render != nil;
bool hasFragStage = stage & dawn::ShaderStage::Fragment && render != nil;
bool hasComputeStage = stage & dawn::ShaderStage::Compute && compute != nil;
uint32_t vertIndex = 0;
uint32_t fragIndex = 0;
@ -283,15 +283,15 @@ namespace dawn_native { namespace metal {
if (hasVertStage) {
vertIndex = pipelineLayout->GetBindingIndexInfo(
ShaderStage::Vertex)[index][bindingIndex];
SingleShaderStage::Vertex)[index][bindingIndex];
}
if (hasFragStage) {
fragIndex = pipelineLayout->GetBindingIndexInfo(
ShaderStage::Fragment)[index][bindingIndex];
SingleShaderStage::Fragment)[index][bindingIndex];
}
if (hasComputeStage) {
computeIndex = pipelineLayout->GetBindingIndexInfo(
ShaderStage::Compute)[index][bindingIndex];
SingleShaderStage::Compute)[index][bindingIndex];
}
switch (layout.types[bindingIndex]) {
@ -310,22 +310,25 @@ namespace dawn_native { namespace metal {
}
if (hasVertStage) {
lengthTracker->data[ShaderStage::Vertex][vertIndex] = binding.size;
lengthTracker->dirtyStages |= dawn::ShaderStageBit::Vertex;
lengthTracker->data[SingleShaderStage::Vertex][vertIndex] =
binding.size;
lengthTracker->dirtyStages |= dawn::ShaderStage::Vertex;
[render setVertexBuffers:&buffer
offsets:&offset
withRange:NSMakeRange(vertIndex, 1)];
}
if (hasFragStage) {
lengthTracker->data[ShaderStage::Fragment][fragIndex] = binding.size;
lengthTracker->dirtyStages |= dawn::ShaderStageBit::Fragment;
lengthTracker->data[SingleShaderStage::Fragment][fragIndex] =
binding.size;
lengthTracker->dirtyStages |= dawn::ShaderStage::Fragment;
[render setFragmentBuffers:&buffer
offsets:&offset
withRange:NSMakeRange(fragIndex, 1)];
}
if (hasComputeStage) {
lengthTracker->data[ShaderStage::Compute][computeIndex] = binding.size;
lengthTracker->dirtyStages |= dawn::ShaderStageBit::Compute;
lengthTracker->data[SingleShaderStage::Compute][computeIndex] =
binding.size;
lengthTracker->dirtyStages |= dawn::ShaderStage::Compute;
[compute setBuffers:&buffer
offsets:&offset
withRange:NSMakeRange(computeIndex, 1)];

View File

@ -26,7 +26,7 @@ namespace dawn_native { namespace metal {
const ShaderModule* computeModule = ToBackend(descriptor->computeStage->module);
const char* computeEntryPoint = descriptor->computeStage->entryPoint;
ShaderModule::MetalFunctionData computeData = computeModule->GetFunction(
computeEntryPoint, ShaderStage::Compute, ToBackend(GetLayout()));
computeEntryPoint, SingleShaderStage::Compute, ToBackend(GetLayout()));
NSError* error = nil;
mMtlComputePipelineState =

View File

@ -42,10 +42,10 @@ namespace dawn_native { namespace metal {
using BindingIndexInfo =
std::array<std::array<uint32_t, kMaxBindingsPerGroup>, kMaxBindGroups>;
const BindingIndexInfo& GetBindingIndexInfo(ShaderStage stage) const;
const BindingIndexInfo& GetBindingIndexInfo(SingleShaderStage stage) const;
// The number of Metal vertex stage buffers used for the whole pipeline layout.
uint32_t GetBufferBindingCount(ShaderStage stage);
uint32_t GetBufferBindingCount(SingleShaderStage stage);
private:
PerStage<BindingIndexInfo> mIndexInfo;

View File

@ -66,11 +66,11 @@ namespace dawn_native { namespace metal {
}
const PipelineLayout::BindingIndexInfo& PipelineLayout::GetBindingIndexInfo(
ShaderStage stage) const {
SingleShaderStage stage) const {
return mIndexInfo[stage];
}
uint32_t PipelineLayout::GetBufferBindingCount(ShaderStage stage) {
uint32_t PipelineLayout::GetBufferBindingCount(SingleShaderStage stage) {
return mBufferBindingCount[stage];
}

View File

@ -41,7 +41,7 @@ namespace dawn_native { namespace metal {
// vertex buffer table.
uint32_t GetMtlVertexBufferIndex(uint32_t dawnIndex) const;
dawn::ShaderStageBit GetStagesRequiringStorageBufferLength() const;
dawn::ShaderStage GetStagesRequiringStorageBufferLength() const;
private:
MTLVertexDescriptor* MakeVertexDesc();
@ -54,7 +54,7 @@ namespace dawn_native { namespace metal {
id<MTLDepthStencilState> mMtlDepthStencilState = nil;
std::array<uint32_t, kMaxVertexBuffers> mMtlVertexBufferIndices;
dawn::ShaderStageBit mStagesRequiringStorageBufferLength = dawn::ShaderStageBit::None;
dawn::ShaderStage mStagesRequiringStorageBufferLength = dawn::ShaderStage::None;
};
}} // namespace dawn_native::metal

View File

@ -317,19 +317,19 @@ namespace dawn_native { namespace metal {
const ShaderModule* vertexModule = ToBackend(descriptor->vertexStage->module);
const char* vertexEntryPoint = descriptor->vertexStage->entryPoint;
ShaderModule::MetalFunctionData vertexData = vertexModule->GetFunction(
vertexEntryPoint, ShaderStage::Vertex, ToBackend(GetLayout()));
vertexEntryPoint, SingleShaderStage::Vertex, ToBackend(GetLayout()));
descriptorMTL.vertexFunction = vertexData.function;
if (vertexData.needsStorageBufferLength) {
mStagesRequiringStorageBufferLength |= dawn::ShaderStageBit::Vertex;
mStagesRequiringStorageBufferLength |= dawn::ShaderStage::Vertex;
}
const ShaderModule* fragmentModule = ToBackend(descriptor->fragmentStage->module);
const char* fragmentEntryPoint = descriptor->fragmentStage->entryPoint;
ShaderModule::MetalFunctionData fragmentData = fragmentModule->GetFunction(
fragmentEntryPoint, ShaderStage::Fragment, ToBackend(GetLayout()));
fragmentEntryPoint, SingleShaderStage::Fragment, ToBackend(GetLayout()));
descriptorMTL.fragmentFunction = fragmentData.function;
if (fragmentData.needsStorageBufferLength) {
mStagesRequiringStorageBufferLength |= dawn::ShaderStageBit::Fragment;
mStagesRequiringStorageBufferLength |= dawn::ShaderStage::Fragment;
}
if (HasDepthStencilAttachment()) {
@ -411,7 +411,7 @@ namespace dawn_native { namespace metal {
return mMtlVertexBufferIndices[dawnIndex];
}
dawn::ShaderStageBit RenderPipeline::GetStagesRequiringStorageBufferLength() const {
dawn::ShaderStage RenderPipeline::GetStagesRequiringStorageBufferLength() const {
return mStagesRequiringStorageBufferLength;
}
@ -420,7 +420,7 @@ namespace dawn_native { namespace metal {
// Vertex buffers are packed after all the buffers for the bind groups.
uint32_t mtlVertexBufferIndex =
ToBackend(GetLayout())->GetBufferBindingCount(ShaderStage::Vertex);
ToBackend(GetLayout())->GetBufferBindingCount(SingleShaderStage::Vertex);
for (uint32_t dawnVertexBufferIndex : IterateBitSet(GetInputsSetMask())) {
const VertexBufferInfo& info = GetInput(dawnVertexBufferIndex);

View File

@ -41,7 +41,7 @@ namespace dawn_native { namespace metal {
}
};
MetalFunctionData GetFunction(const char* functionName,
ShaderStage functionStage,
SingleShaderStage functionStage,
const PipelineLayout* layout) const;
private:

View File

@ -26,13 +26,13 @@ namespace dawn_native { namespace metal {
namespace {
spv::ExecutionModel SpirvExecutionModelForStage(ShaderStage stage) {
spv::ExecutionModel SpirvExecutionModelForStage(SingleShaderStage stage) {
switch (stage) {
case ShaderStage::Vertex:
case SingleShaderStage::Vertex:
return spv::ExecutionModelVertex;
case ShaderStage::Fragment:
case SingleShaderStage::Fragment:
return spv::ExecutionModelFragment;
case ShaderStage::Compute:
case SingleShaderStage::Compute:
return spv::ExecutionModelGLCompute;
default:
UNREACHABLE();
@ -48,7 +48,7 @@ namespace dawn_native { namespace metal {
}
ShaderModule::MetalFunctionData ShaderModule::GetFunction(const char* functionName,
ShaderStage functionStage,
SingleShaderStage functionStage,
const PipelineLayout* layout) const {
spirv_cross::CompilerMSL compiler(mSpirv);

View File

@ -21,7 +21,7 @@ namespace dawn_native { namespace opengl {
ComputePipeline::ComputePipeline(Device* device, const ComputePipelineDescriptor* descriptor)
: ComputePipelineBase(device, descriptor) {
PerStage<const ShaderModule*> modules(nullptr);
modules[ShaderStage::Compute] = ToBackend(descriptor->computeStage->module);
modules[SingleShaderStage::Compute] = ToBackend(descriptor->computeStage->module);
PipelineGL::Initialize(device->gl, ToBackend(descriptor->layout), modules);
}

View File

@ -28,13 +28,13 @@ namespace dawn_native { namespace opengl {
namespace {
GLenum GLShaderType(ShaderStage stage) {
GLenum GLShaderType(SingleShaderStage stage) {
switch (stage) {
case ShaderStage::Vertex:
case SingleShaderStage::Vertex:
return GL_VERTEX_SHADER;
case ShaderStage::Fragment:
case SingleShaderStage::Fragment:
return GL_FRAGMENT_SHADER;
case ShaderStage::Compute:
case SingleShaderStage::Compute:
return GL_COMPUTE_SHADER;
default:
UNREACHABLE();
@ -74,14 +74,14 @@ namespace dawn_native { namespace opengl {
mProgram = gl.CreateProgram();
dawn::ShaderStageBit activeStages = dawn::ShaderStageBit::None;
for (ShaderStage stage : IterateStages(kAllStages)) {
dawn::ShaderStage activeStages = dawn::ShaderStage::None;
for (SingleShaderStage stage : IterateStages(kAllStages)) {
if (modules[stage] != nullptr) {
activeStages |= StageBit(stage);
}
}
for (ShaderStage stage : IterateStages(activeStages)) {
for (SingleShaderStage stage : IterateStages(activeStages)) {
GLuint shader = CreateShader(gl, GLShaderType(stage), modules[stage]->GetSource());
gl.AttachShader(mProgram, shader);
}
@ -153,7 +153,7 @@ namespace dawn_native { namespace opengl {
// Compute links between stages for combined samplers, then bind them to texture units
{
std::set<CombinedSampler> combinedSamplersSet;
for (ShaderStage stage : IterateStages(activeStages)) {
for (SingleShaderStage stage : IterateStages(activeStages)) {
for (const auto& combined : modules[stage]->GetCombinedSamplerInfo()) {
combinedSamplersSet.insert(combined);
}

View File

@ -198,8 +198,8 @@ namespace dawn_native { namespace opengl {
mVertexArrayObject(0),
mGlPrimitiveTopology(GLPrimitiveTopology(GetPrimitiveTopology())) {
PerStage<const ShaderModule*> modules(nullptr);
modules[ShaderStage::Vertex] = ToBackend(descriptor->vertexStage->module);
modules[ShaderStage::Fragment] = ToBackend(descriptor->fragmentStage->module);
modules[SingleShaderStage::Vertex] = ToBackend(descriptor->vertexStage->module);
modules[SingleShaderStage::Fragment] = ToBackend(descriptor->fragmentStage->module);
PipelineGL::Initialize(device->gl, ToBackend(GetLayout()), modules);
CreateVAOForVertexInput(descriptor->vertexInput);

View File

@ -21,16 +21,16 @@ namespace dawn_native { namespace vulkan {
namespace {
VkShaderStageFlags VulkanShaderStageFlags(dawn::ShaderStageBit stages) {
VkShaderStageFlags VulkanShaderStageFlags(dawn::ShaderStage stages) {
VkShaderStageFlags flags = 0;
if (stages & dawn::ShaderStageBit::Vertex) {
if (stages & dawn::ShaderStage::Vertex) {
flags |= VK_SHADER_STAGE_VERTEX_BIT;
}
if (stages & dawn::ShaderStageBit::Fragment) {
if (stages & dawn::ShaderStage::Fragment) {
flags |= VK_SHADER_STAGE_FRAGMENT_BIT;
}
if (stages & dawn::ShaderStageBit::Compute) {
if (stages & dawn::ShaderStage::Compute) {
flags |= VK_SHADER_STAGE_COMPUTE_BIT;
}

View File

@ -49,11 +49,9 @@ protected:
// This test passes by not asserting or crashing.
TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) {
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device,
{
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::UniformBuffer},
}
);
device, {
{0, dawn::ShaderStage::Compute, dawn::BindingType::UniformBuffer},
});
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
const char* shader = R"(
@ -66,7 +64,7 @@ TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) {
)";
dawn::ShaderModule module =
utils::CreateShaderModule(device, utils::ShaderStage::Compute, shader);
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, shader);
dawn::ComputePipelineDescriptor cpDesc;
cpDesc.layout = pl;
@ -98,7 +96,8 @@ TEST_P(BindGroupTests, ReusedUBO) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
mat2 transform;
@ -109,7 +108,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout (set = 0, binding = 1) uniform fragmentUniformBuffer {
vec4 color;
@ -120,12 +119,10 @@ TEST_P(BindGroupTests, ReusedUBO) {
})");
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device,
{
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
}
);
device, {
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer},
});
dawn::PipelineLayout pipelineLayout = utils::MakeBasicPipelineLayout(device, &bgl);
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
@ -183,7 +180,8 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
mat2 transform;
@ -194,7 +192,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout (set = 0, binding = 1) uniform sampler samp;
layout (set = 0, binding = 2) uniform texture2D tex;
@ -204,13 +202,11 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
})");
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device,
{
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
{2, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture},
}
);
device, {
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
{2, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture},
});
dawn::PipelineLayout pipelineLayout = utils::MakeBasicPipelineLayout(device, &bgl);
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
@ -301,7 +297,8 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout (set = 0, binding = 0) uniform vertexUniformBuffer1 {
mat2 transform1;
@ -315,7 +312,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout (set = 0, binding = 1) uniform fragmentUniformBuffer1 {
vec4 color1;
@ -330,8 +327,8 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer},
});
dawn::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(device, {layout, layout});
@ -396,7 +393,8 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets)
{
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
const vec2 pos[3] = vec2[3](vec2(-1.f, -1.f), vec2(1.f, -1.f), vec2(-1.f, 1.f));
@ -404,7 +402,7 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets)
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout (std140, set = 0, binding = 0) uniform fragmentUniformBuffer1 {
vec4 color1;
@ -424,9 +422,7 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets)
})");
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {
{ 0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer }
});
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}});
dawn::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(
device, { layout, layout, layout, layout });

View File

@ -37,7 +37,7 @@ class ClipSpaceTest : public DawnTest {
gl_Position = vec4(pos[gl_VertexIndex], 1.0);
})";
pipelineDescriptor.cVertexStage.module =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vs);
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
const char* fs =
R"(#version 450
@ -46,7 +46,7 @@ class ClipSpaceTest : public DawnTest {
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
})";
pipelineDescriptor.cFragmentStage.module =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fs);
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs);
pipelineDescriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::LessEqual;
pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;

View File

@ -29,7 +29,7 @@ class ColorStateTest : public DawnTest {
void SetUp() override {
DawnTest::SetUp();
vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
const vec2 pos[3] = vec2[3](vec2(-1.f, -1.f), vec2(3.f, -1.f), vec2(-1.f, 3.f));
@ -39,7 +39,7 @@ class ColorStateTest : public DawnTest {
bindGroupLayout = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer},
});
pipelineLayout = utils::MakeBasicPipelineLayout(device, &bindGroupLayout);
@ -56,7 +56,7 @@ class ColorStateTest : public DawnTest {
// attachment. basePipeline has no blending
void SetupSingleSourcePipelines(dawn::ColorStateDescriptor colorStateDescriptor) {
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(set = 0, binding = 0) uniform myBlock {
vec4 color;
@ -773,7 +773,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
renderTargetViews[2], renderTargetViews[3]});
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(set = 0, binding = 0) uniform myBlock {
vec4 color0;
@ -884,7 +884,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
// Test that the default blend color is correctly set at the beginning of every subpass
TEST_P(ColorStateTest, DefaultBlendColor) {
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(set = 0, binding = 0) uniform myBlock {
vec4 color;
@ -1008,7 +1008,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
// attachment.
TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(set = 0, binding = 0) uniform myBlock {
vec4 color;

View File

@ -37,8 +37,8 @@ class CompressedTextureBCFormatTest : public DawnTest {
void SetUp() override {
DawnTest::SetUp();
mBindGroupLayout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture}});
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture}});
}
std::vector<const char*> GetRequiredExtensions() override {
@ -140,7 +140,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(location=0) out vec2 texCoord;
void main() {
@ -153,7 +153,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
texCoord = gl_Position.xy / 2.0f + vec2(0.5f);
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(set = 0, binding = 0) uniform sampler sampler0;
layout(set = 0, binding = 1) uniform texture2D texture0;

View File

@ -30,12 +30,12 @@ class ComputeCopyStorageBufferTests : public DawnTest {
void ComputeCopyStorageBufferTests::BasicTest(const char* shader) {
auto bgl = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
{1, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
{0, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
{1, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
});
// Set up shader and pipeline
auto module = utils::CreateShaderModule(device, utils::ShaderStage::Compute, shader);
auto module = utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, shader);
auto pl = utils::MakeBasicPipelineLayout(device, &bgl);
dawn::ComputePipelineDescriptor csDesc;

View File

@ -47,13 +47,13 @@ void ComputeIndirectTests::BasicTest(std::initializer_list<uint32_t> bufferList,
uint64_t indirectOffset) {
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
{0, dawn::ShaderStage::Compute, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
});
// Set up shader and pipeline
dawn::ShaderModule module =
utils::CreateShaderModule(device, utils::ShaderStage::Compute, shaderSource);
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, shaderSource);
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
dawn::ComputePipelineDescriptor csDesc;

View File

@ -28,11 +28,11 @@ class ComputeSharedMemoryTests : public DawnTest {
void ComputeSharedMemoryTests::BasicTest(const char* shader) {
auto bgl = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
{0, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
});
// Set up shader and pipeline
auto module = utils::CreateShaderModule(device, utils::ShaderStage::Compute, shader);
auto module = utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, shader);
auto pl = utils::MakeBasicPipelineLayout(device, &bgl);
dawn::ComputePipelineDescriptor csDesc;

View File

@ -37,7 +37,7 @@ class CullingTest : public DawnTest {
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
})";
pipelineDescriptor.cVertexStage.module =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vs);
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
// gl_FragCoord of pixel(x, y) in framebuffer coordinate is (x + 0.5, y + 0.5). And we use
// RGBA8 format for the back buffer. So (gl_FragCoord.xy - vec2(0.5)) / 255 in shader code
@ -49,7 +49,7 @@ class CullingTest : public DawnTest {
fragColor = vec4((gl_FragCoord.xy - vec2(0.5)) / 255, 0.0, 1.0);
})";
pipelineDescriptor.cFragmentStage.module =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fs);
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs);
// Set culling mode and front face according to the parameters
pipelineDescriptor.cRasterizationState.frontFace = frontFace;

View File

@ -54,7 +54,7 @@ class DepthStencilStateTest : public DawnTest {
depthTextureView = depthTexture.CreateDefaultView();
vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(set = 0, binding = 0) uniform myBlock {
vec3 color;
@ -69,7 +69,7 @@ class DepthStencilStateTest : public DawnTest {
}
)");
fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(set = 0, binding = 0) uniform myBlock {
vec3 color;
@ -83,7 +83,7 @@ class DepthStencilStateTest : public DawnTest {
bindGroupLayout = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment,
{0, dawn::ShaderStage::Vertex | dawn::ShaderStage::Fragment,
dawn::BindingType::UniformBuffer},
});

View File

@ -27,7 +27,7 @@ class DestroyTest : public DawnTest {
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(location = 0) in vec4 pos;
void main() {
@ -35,7 +35,7 @@ class DestroyTest : public DawnTest {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -27,7 +27,7 @@ class DrawIndexedIndirectTest : public DawnTest {
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(location = 0) in vec4 pos;
void main() {
@ -35,7 +35,7 @@ class DrawIndexedIndirectTest : public DawnTest {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -27,7 +27,7 @@ class DrawIndexedTest : public DawnTest {
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(location = 0) in vec4 pos;
void main() {
@ -35,7 +35,7 @@ class DrawIndexedTest : public DawnTest {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -27,7 +27,7 @@ class DrawIndirectTest : public DawnTest {
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(location = 0) in vec4 pos;
void main() {
@ -35,7 +35,7 @@ class DrawIndirectTest : public DawnTest {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -27,7 +27,7 @@ class DrawTest : public DawnTest {
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(location = 0) in vec4 pos;
void main() {
@ -35,7 +35,7 @@ class DrawTest : public DawnTest {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -55,13 +55,13 @@ class DynamicBufferOffsetTests : public DawnTest {
// Default bind group layout
mBindGroupLayouts[0] = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
device, {{0, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
{1, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
dawn::BindingType::StorageBuffer},
{3, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
{3, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
dawn::BindingType::UniformBuffer, true},
{4, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
{4, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
dawn::BindingType::StorageBuffer, true}});
// Default bind group
@ -77,7 +77,7 @@ class DynamicBufferOffsetTests : public DawnTest {
// Bind group layout for inheriting test
mBindGroupLayouts[1] = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
device, {{0, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
dawn::BindingType::UniformBuffer}});
// Bind group for inheriting test
@ -94,7 +94,7 @@ class DynamicBufferOffsetTests : public DawnTest {
dawn::RenderPipeline CreateRenderPipeline(bool isInheritedPipeline = false) {
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
const vec2 pos[3] = vec2[3](vec2(-1.0f, 0.0f), vec2(-1.0f, -1.0f), vec2(0.0f, -1.0f));
@ -137,7 +137,7 @@ class DynamicBufferOffsetTests : public DawnTest {
fs << " }\n";
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fs.str().c_str());
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs.str().c_str());
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.cVertexStage.module = vsModule;
@ -191,7 +191,7 @@ class DynamicBufferOffsetTests : public DawnTest {
cs << " }\n";
dawn::ShaderModule csModule =
utils::CreateShaderModule(device, utils::ShaderStage::Compute, cs.str().c_str());
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, cs.str().c_str());
dawn::ComputePipelineDescriptor csDesc;
dawn::PipelineStageDescriptor computeStage;

View File

@ -258,8 +258,8 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
bgl = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture},
{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture},
});
bindGroup = utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, textureView}});
@ -269,7 +269,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
dawn::RenderPipeline pipeline;
{
dawn::ShaderModule vs =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout (location = 0) out vec2 o_texCoord;
void main() {
@ -290,7 +290,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
}
)");
dawn::ShaderModule fs =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(set = 0, binding = 0) uniform sampler sampler0;
layout(set = 0, binding = 1) uniform texture2D texture0;

View File

@ -32,7 +32,7 @@ class IndexFormatTest : public DawnTest {
dawn::RenderPipeline MakeTestPipeline(dawn::IndexFormat format) {
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(location = 0) in vec4 pos;
void main() {
@ -40,7 +40,7 @@ class IndexFormatTest : public DawnTest {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -197,14 +197,14 @@ class MultisampledRenderingTest : public DawnTest {
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
})";
pipelineDescriptor.cVertexStage.module =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vs);
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
pipelineDescriptor.cFragmentStage.module =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fs);
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs);
mBindGroupLayout = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer},
});
dawn::PipelineLayout pipelineLayout =
utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);

View File

@ -22,11 +22,11 @@ class ObjectCachingTest : public DawnTest {};
// Test that BindGroupLayouts are correctly deduplicated.
TEST_P(ObjectCachingTest, BindGroupLayoutDeduplication) {
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}});
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}});
dawn::BindGroupLayout sameBgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}});
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}});
dawn::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}});
device, {{1, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer}});
EXPECT_NE(bgl.Get(), otherBgl.Get());
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
@ -35,11 +35,11 @@ TEST_P(ObjectCachingTest, BindGroupLayoutDeduplication) {
// Test that two similar bind group layouts won't refer to the same one if they differ by dynamic.
TEST_P(ObjectCachingTest, BindGroupLayoutDynamic) {
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer, true}});
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer, true}});
dawn::BindGroupLayout sameBgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer, true}});
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer, true}});
dawn::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer, false}});
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer, false}});
EXPECT_NE(bgl.Get(), otherBgl.Get());
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
@ -49,14 +49,14 @@ TEST_P(ObjectCachingTest, BindGroupLayoutDynamic) {
// textureComponentType
TEST_P(ObjectCachingTest, BindGroupLayoutTextureComponentType) {
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture, false,
false, dawn::TextureComponentType::Float}});
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture, false, false,
dawn::TextureComponentType::Float}});
dawn::BindGroupLayout sameBgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture, false,
false, dawn::TextureComponentType::Float}});
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture, false, false,
dawn::TextureComponentType::Float}});
dawn::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture, false,
false, dawn::TextureComponentType::Uint}});
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture, false, false,
dawn::TextureComponentType::Uint}});
EXPECT_NE(bgl.Get(), otherBgl.Get());
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
@ -66,16 +66,16 @@ TEST_P(ObjectCachingTest, BindGroupLayoutTextureComponentType) {
TEST_P(ObjectCachingTest, ErrorObjectDoesntUncache) {
ASSERT_DEVICE_ERROR(
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}}));
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer},
{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}}));
}
// Test that PipelineLayouts are correctly deduplicated.
TEST_P(ObjectCachingTest, PipelineLayoutDeduplication) {
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}});
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}});
dawn::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}});
device, {{1, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer}});
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
dawn::PipelineLayout samePl = utils::MakeBasicPipelineLayout(device, &bgl);
@ -89,21 +89,22 @@ TEST_P(ObjectCachingTest, PipelineLayoutDeduplication) {
// Test that ShaderModules are correctly deduplicated.
TEST_P(ObjectCachingTest, ShaderModuleDeduplication) {
dawn::ShaderModule module = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
dawn::ShaderModule module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
})");
dawn::ShaderModule sameModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
})");
dawn::ShaderModule otherModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {
@ -116,19 +117,20 @@ TEST_P(ObjectCachingTest, ShaderModuleDeduplication) {
// Test that ComputePipeline are correctly deduplicated wrt. their ShaderModule
TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnShaderModule) {
dawn::ShaderModule module = utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
dawn::ShaderModule module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
#version 450
void main() {
int i = 0;
})");
dawn::ShaderModule sameModule =
utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
#version 450
void main() {
int i = 0;
})");
dawn::ShaderModule otherModule =
utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
#version 450
void main() {
})");
@ -161,9 +163,9 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnShaderModule) {
// Test that ComputePipeline are correctly deduplicated wrt. their layout
TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnLayout) {
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}});
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}});
dawn::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}});
device, {{1, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer}});
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
dawn::PipelineLayout samePl = utils::MakeBasicPipelineLayout(device, &bgl);
@ -174,7 +176,7 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnLayout) {
dawn::PipelineStageDescriptor stageDesc;
stageDesc.entryPoint = "main";
stageDesc.module = utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
stageDesc.module = utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
#version 450
void main() {
int i = 0;
@ -199,9 +201,9 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnLayout) {
// Test that RenderPipelines are correctly deduplicated wrt. their layout
TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}});
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}});
dawn::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}});
device, {{1, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer}});
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
dawn::PipelineLayout samePl = utils::MakeBasicPipelineLayout(device, &bgl);
@ -211,12 +213,14 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
EXPECT_EQ(pl.Get() == samePl.Get(), !UsesWire());
utils::ComboRenderPipelineDescriptor desc(device);
desc.cVertexStage.module = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
desc.cVertexStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
gl_Position = vec4(0.0);
})");
desc.cFragmentStage.module = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
desc.cFragmentStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
void main() {
})");
@ -236,19 +240,20 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
// Test that RenderPipelines are correctly deduplicated wrt. their vertex module
TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
dawn::ShaderModule module = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
dawn::ShaderModule module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
gl_Position = vec4(0.0);
})");
dawn::ShaderModule sameModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
gl_Position = vec4(0.0);
})");
dawn::ShaderModule otherModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
gl_Position = vec4(1.0);
@ -258,7 +263,8 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
utils::ComboRenderPipelineDescriptor desc(device);
desc.cFragmentStage.module = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
desc.cFragmentStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
void main() {
})");
@ -278,17 +284,18 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
// Test that RenderPipelines are correctly deduplicated wrt. their fragment module
TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) {
dawn::ShaderModule module = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
dawn::ShaderModule module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
void main() {
})");
dawn::ShaderModule sameModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
void main() {
})");
dawn::ShaderModule otherModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
void main() {
int i = 0;
@ -298,7 +305,8 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) {
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
utils::ComboRenderPipelineDescriptor desc(device);
desc.cVertexStage.module = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
desc.cVertexStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
gl_Position = vec4(0.0);

View File

@ -36,9 +36,8 @@ class OpArrayLengthTest : public DawnTest {
mStorageBuffer512 = device.CreateBuffer(&bufferDesc);
// Put them all in a bind group for tests to bind them easily.
dawn::ShaderStageBit kAllStages = dawn::ShaderStageBit::Fragment |
dawn::ShaderStageBit::Vertex |
dawn::ShaderStageBit::Compute;
dawn::ShaderStage kAllStages =
dawn::ShaderStage::Fragment | dawn::ShaderStage::Vertex | dawn::ShaderStage::Compute;
mBindGroupLayout =
utils::MakeBindGroupLayout(device, {{0, kAllStages, dawn::BindingType::StorageBuffer},
{1, kAllStages, dawn::BindingType::StorageBuffer},
@ -100,7 +99,7 @@ TEST_P(OpArrayLengthTest, Compute) {
dawn::Buffer resultBuffer = device.CreateBuffer(&bufferDesc);
dawn::BindGroupLayout resultLayout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer}});
device, {{0, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer}});
dawn::BindGroup resultBindGroup =
utils::MakeBindGroup(device, resultLayout, {{0, resultBuffer, 0, dawn::kWholeSize}});
@ -114,7 +113,7 @@ TEST_P(OpArrayLengthTest, Compute) {
dawn::PipelineStageDescriptor computeStage;
computeStage.entryPoint = "main";
computeStage.module = utils::CreateShaderModule(device, utils::ShaderStage::Compute,
computeStage.module = utils::CreateShaderModule(device, utils::SingleShaderStage::Compute,
(R"(#version 450
layout(std430, set = 1, binding = 0) buffer ResultBuffer {
uint result[3];
@ -157,14 +156,16 @@ TEST_P(OpArrayLengthTest, Fragment) {
// Create the pipeline that computes the length of the buffers and writes it to the only render
// pass pixel.
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);
gl_PointSize = 1.0;
})");
dawn::ShaderModule fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment,
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment,
(R"(
#version 450
)" + mShaderInterface + R"(
@ -212,7 +213,8 @@ TEST_P(OpArrayLengthTest, Vertex) {
// Create the pipeline that computes the length of the buffers and writes it to the only render
// pass pixel.
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex,
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex,
(R"(
#version 450
)" + mShaderInterface + R"(
@ -229,7 +231,7 @@ TEST_P(OpArrayLengthTest, Vertex) {
.c_str());
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
layout(location = 0) in vec4 pointColor;

View File

@ -150,7 +150,7 @@ class PrimitiveTopologyTest : public DawnTest {
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(location = 0) in vec4 pos;
void main() {
@ -158,7 +158,7 @@ class PrimitiveTopologyTest : public DawnTest {
gl_PointSize = 1.0;
})");
fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -32,7 +32,7 @@ class RenderBundleTest : public DawnTest {
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(location = 0) in vec4 pos;
void main() {
@ -40,7 +40,7 @@ class RenderBundleTest : public DawnTest {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
layout (set = 0, binding = 0) uniform fragmentUniformBuffer {
@ -51,7 +51,7 @@ class RenderBundleTest : public DawnTest {
})");
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}});
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}});
float colors0[] = {kColors[0].r / 255.f, kColors[0].g / 255.f, kColors[0].b / 255.f,
kColors[0].a / 255.f};

View File

@ -26,8 +26,10 @@ class DrawQuad {
DrawQuad() {}
DrawQuad(dawn::Device device, const char* vsSource, const char* fsSource)
: device(device) {
vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vsSource);
fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fsSource);
vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vsSource);
fsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fsSource);
pipelineLayout = utils::MakeBasicPipelineLayout(device, nullptr);
}

View File

@ -27,7 +27,7 @@ protected:
// Shaders to draw a bottom-left triangle in blue.
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
const vec2 pos[3] = vec2[3](
@ -36,7 +36,7 @@ protected:
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -44,13 +44,13 @@ protected:
mBindGroupLayout = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture},
{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture},
});
auto pipelineLayout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
auto vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
auto vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
const vec2 pos[6] = vec2[6](vec2(-2.f, -2.f),
@ -62,7 +62,7 @@ protected:
gl_Position = vec4(pos[gl_VertexIndex], 0.f, 1.f);
}
)");
auto fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
auto fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(set = 0, binding = 0) uniform sampler sampler0;
layout(set = 0, binding = 1) uniform texture2D texture0;

View File

@ -21,7 +21,7 @@ class ScissorTest: public DawnTest {
protected:
dawn::RenderPipeline CreateQuadPipeline(dawn::TextureFormat format) {
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
const vec2 pos[6] = vec2[6](
vec2(-1.0f, -1.0f), vec2(-1.0f, 1.0f), vec2(1.0f, -1.0f),
@ -32,7 +32,7 @@ class ScissorTest: public DawnTest {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -174,7 +174,7 @@ class TextureFormatTest : public DawnTest {
utils::ComboRenderPipelineDescriptor desc(device);
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
const vec2 pos[3] = vec2[3](
@ -213,8 +213,8 @@ class TextureFormatTest : public DawnTest {
<< "sampler2D(myTexture, mySampler), ivec2(gl_FragCoord), 0);\n";
fsSource << "}";
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fsSource.str().c_str());
dawn::ShaderModule fsModule = utils::CreateShaderModule(
device, utils::SingleShaderStage::Fragment, fsSource.str().c_str());
desc.cVertexStage.module = vsModule;
desc.cFragmentStage.module = fsModule;
@ -271,8 +271,8 @@ class TextureFormatTest : public DawnTest {
// Create the bind group layout for sampling the texture
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture, false,
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture, false,
false, sampleFormatInfo.type}});
// Prepare objects needed to sample from texture in the renderpass

View File

@ -47,7 +47,7 @@ namespace {
}
dawn::ShaderModule CreateDefaultVertexShaderModule(dawn::Device device) {
return utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
return utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout (location = 0) out vec2 o_texCoord;
void main() {
@ -85,8 +85,8 @@ protected:
mBindGroupLayout = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture},
{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture},
});
dawn::FilterMode kFilterMode = dawn::FilterMode::Nearest;
@ -164,7 +164,7 @@ protected:
});
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fragmentShader);
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fragmentShader);
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
textureDescriptor.cVertexStage.module = mVSModule;
@ -501,8 +501,8 @@ class TextureViewRenderingTest : public DawnTest {
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
}
)";
dawn::ShaderModule oneColorFsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, oneColorFragmentShader);
dawn::ShaderModule oneColorFsModule = utils::CreateShaderModule(
device, utils::SingleShaderStage::Fragment, oneColorFragmentShader);
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.cVertexStage.module = vsModule;

View File

@ -65,7 +65,7 @@ class TextureZeroInitTest : public DawnTest {
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
})";
pipelineDescriptor.cVertexStage.module =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vs);
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
const char* fs =
R"(#version 450
@ -74,7 +74,7 @@ class TextureZeroInitTest : public DawnTest {
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
})";
pipelineDescriptor.cFragmentStage.module =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fs);
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs);
pipelineDescriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Equal;
pipelineDescriptor.cDepthStencilState.stencilFront.compare = dawn::CompareFunction::Equal;
@ -435,14 +435,14 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
dawn::Sampler sampler = device.CreateSampler(&samplerDesc);
dawn::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture}});
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture}});
// Create render pipeline
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
renderPipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bindGroupLayout);
renderPipelineDescriptor.cVertexStage.module =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(#version 450
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(#version 450
const vec2 pos[6] = vec2[6](vec2(-1.0f, -1.0f),
vec2(-1.0f, 1.0f),
vec2( 1.0f, -1.0f),
@ -455,7 +455,7 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
})");
renderPipelineDescriptor.cFragmentStage.module =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment,
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment,
R"(#version 450
layout(set = 0, binding = 0) uniform sampler sampler0;
layout(set = 0, binding = 1) uniform texture2D texture0;
@ -512,9 +512,9 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
dawn::Sampler sampler = device.CreateSampler(&samplerDesc);
dawn::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Compute, dawn::BindingType::SampledTexture},
{1, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
{2, dawn::ShaderStageBit::Compute, dawn::BindingType::Sampler}});
device, {{0, dawn::ShaderStage::Compute, dawn::BindingType::SampledTexture},
{1, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
{2, dawn::ShaderStage::Compute, dawn::BindingType::Sampler}});
// Create compute pipeline
dawn::ComputePipelineDescriptor computePipelineDescriptor;
@ -531,7 +531,7 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
bufferTex.result =
texelFetch(sampler2D(sampleTex, sampler0), ivec2(0,0), 0);
})";
computeStage.module = utils::CreateShaderModule(device, utils::ShaderStage::Compute, cs);
computeStage.module = utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, cs);
computeStage.entryPoint = "main";
computePipelineDescriptor.computeStage = &computeStage;
dawn::ComputePipeline computePipeline =

View File

@ -341,10 +341,10 @@ class VertexFormatTest : public DawnTest {
vs << "}\n";
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vs.str().c_str());
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs.str().c_str());
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) in vec4 color;
layout(location = 0) out vec4 fragColor;

View File

@ -117,9 +117,9 @@ class VertexInputTest : public DawnTest {
vs << "}\n";
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vs.str().c_str());
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs.str().c_str());
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) in vec4 color;
layout(location = 0) out vec4 fragColor;

View File

@ -23,7 +23,8 @@ class ViewportOrientationTests : public DawnTest {};
TEST_P(ViewportOrientationTests, OriginAt0x0) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 2, 2);
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
gl_Position = vec4(-0.5f, -0.5f, 0.0f, 1.0f);
@ -31,7 +32,7 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -45,7 +45,7 @@ class ViewportTest : public DawnTest {
}
})";
pipelineDescriptor.cVertexStage.module =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vs);
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
const char* fs =
R"(#version 450
@ -55,7 +55,7 @@ class ViewportTest : public DawnTest {
fragColor = color;
})";
pipelineDescriptor.cFragmentStage.module =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fs);
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs);
pipelineDescriptor.cDepthStencilState.depthCompare = depthCompare;
pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;

View File

@ -20,9 +20,9 @@ using namespace dawn_native;
// Tests for StageBit
TEST(PerStage, StageBit) {
ASSERT_EQ(StageBit(ShaderStage::Vertex), dawn::ShaderStageBit::Vertex);
ASSERT_EQ(StageBit(ShaderStage::Fragment), dawn::ShaderStageBit::Fragment);
ASSERT_EQ(StageBit(ShaderStage::Compute), dawn::ShaderStageBit::Compute);
ASSERT_EQ(StageBit(SingleShaderStage::Vertex), dawn::ShaderStage::Vertex);
ASSERT_EQ(StageBit(SingleShaderStage::Fragment), dawn::ShaderStage::Fragment);
ASSERT_EQ(StageBit(SingleShaderStage::Compute), dawn::ShaderStage::Compute);
}
// Basic test for the PerStage container
@ -30,60 +30,60 @@ TEST(PerStage, PerStage) {
PerStage<int> data;
// Store data using dawn::ShaderStage
data[ShaderStage::Vertex] = 42;
data[ShaderStage::Fragment] = 3;
data[ShaderStage::Compute] = -1;
data[SingleShaderStage::Vertex] = 42;
data[SingleShaderStage::Fragment] = 3;
data[SingleShaderStage::Compute] = -1;
// Load it using dawn::ShaderStageBit
ASSERT_EQ(data[dawn::ShaderStageBit::Vertex], 42);
ASSERT_EQ(data[dawn::ShaderStageBit::Fragment], 3);
ASSERT_EQ(data[dawn::ShaderStageBit::Compute], -1);
// Load it using dawn::ShaderStage
ASSERT_EQ(data[dawn::ShaderStage::Vertex], 42);
ASSERT_EQ(data[dawn::ShaderStage::Fragment], 3);
ASSERT_EQ(data[dawn::ShaderStage::Compute], -1);
}
// Test IterateStages with kAllStages
TEST(PerStage, IterateAllStages) {
PerStage<int> counts;
counts[ShaderStage::Vertex] = 0;
counts[ShaderStage::Fragment] = 0;
counts[ShaderStage::Compute] = 0;
counts[SingleShaderStage::Vertex] = 0;
counts[SingleShaderStage::Fragment] = 0;
counts[SingleShaderStage::Compute] = 0;
for (auto stage : IterateStages(kAllStages)) {
counts[stage] ++;
}
ASSERT_EQ(counts[dawn::ShaderStageBit::Vertex], 1);
ASSERT_EQ(counts[dawn::ShaderStageBit::Fragment], 1);
ASSERT_EQ(counts[dawn::ShaderStageBit::Compute], 1);
ASSERT_EQ(counts[dawn::ShaderStage::Vertex], 1);
ASSERT_EQ(counts[dawn::ShaderStage::Fragment], 1);
ASSERT_EQ(counts[dawn::ShaderStage::Compute], 1);
}
// Test IterateStages with one stage
TEST(PerStage, IterateOneStage) {
PerStage<int> counts;
counts[ShaderStage::Vertex] = 0;
counts[ShaderStage::Fragment] = 0;
counts[ShaderStage::Compute] = 0;
counts[SingleShaderStage::Vertex] = 0;
counts[SingleShaderStage::Fragment] = 0;
counts[SingleShaderStage::Compute] = 0;
for (auto stage : IterateStages(dawn::ShaderStageBit::Fragment)) {
for (auto stage : IterateStages(dawn::ShaderStage::Fragment)) {
counts[stage] ++;
}
ASSERT_EQ(counts[dawn::ShaderStageBit::Vertex], 0);
ASSERT_EQ(counts[dawn::ShaderStageBit::Fragment], 1);
ASSERT_EQ(counts[dawn::ShaderStageBit::Compute], 0);
ASSERT_EQ(counts[dawn::ShaderStage::Vertex], 0);
ASSERT_EQ(counts[dawn::ShaderStage::Fragment], 1);
ASSERT_EQ(counts[dawn::ShaderStage::Compute], 0);
}
// Test IterateStages with no stage
TEST(PerStage, IterateNoStages) {
PerStage<int> counts;
counts[ShaderStage::Vertex] = 0;
counts[ShaderStage::Fragment] = 0;
counts[ShaderStage::Compute] = 0;
counts[SingleShaderStage::Vertex] = 0;
counts[SingleShaderStage::Fragment] = 0;
counts[SingleShaderStage::Compute] = 0;
for (auto stage : IterateStages(dawn::ShaderStageBit::Fragment & dawn::ShaderStageBit::Vertex)) {
for (auto stage : IterateStages(dawn::ShaderStage::Fragment & dawn::ShaderStage::Vertex)) {
counts[stage] ++;
}
ASSERT_EQ(counts[dawn::ShaderStageBit::Vertex], 0);
ASSERT_EQ(counts[dawn::ShaderStageBit::Fragment], 0);
ASSERT_EQ(counts[dawn::ShaderStageBit::Compute], 0);
ASSERT_EQ(counts[dawn::ShaderStage::Vertex], 0);
ASSERT_EQ(counts[dawn::ShaderStage::Fragment], 0);
ASSERT_EQ(counts[dawn::ShaderStage::Compute], 0);
}

View File

@ -80,9 +80,8 @@ TEST_F(BindGroupValidationTest, NextInChainNullptr) {
// Check constraints on bindingCount
TEST_F(BindGroupValidationTest, bindingCountMismatch) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler}
});
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler}});
// Control case: check that a descriptor with one binding is ok
utils::MakeBindGroup(device, layout, {{0, mSampler}});
@ -93,9 +92,8 @@ TEST_F(BindGroupValidationTest, bindingCountMismatch) {
// Check constraints on BindGroupBinding::binding
TEST_F(BindGroupValidationTest, WrongBindings) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler}
});
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler}});
// Control case: check that a descriptor with a binding matching the layout's is ok
utils::MakeBindGroup(device, layout, {{0, mSampler}});
@ -109,10 +107,9 @@ TEST_F(BindGroupValidationTest, WrongBindings) {
// Check that the same binding cannot be set twice
TEST_F(BindGroupValidationTest, BindingSetTwice) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler}
});
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
{1, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler}});
// Control case: check that different bindings work
utils::MakeBindGroup(device, layout, {
@ -129,9 +126,8 @@ TEST_F(BindGroupValidationTest, BindingSetTwice) {
// Check that a sampler binding must contain exactly one sampler
TEST_F(BindGroupValidationTest, SamplerBindingType) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler}
});
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler}});
dawn::BindGroupBinding binding;
binding.binding = 0;
@ -179,9 +175,8 @@ TEST_F(BindGroupValidationTest, SamplerBindingType) {
// Check that a texture binding must contain exactly a texture view
TEST_F(BindGroupValidationTest, TextureBindingType) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture}
});
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture}});
dawn::BindGroupBinding binding;
binding.binding = 0;
@ -234,9 +229,8 @@ TEST_F(BindGroupValidationTest, TextureBindingType) {
// Check that a buffer binding must contain exactly a buffer
TEST_F(BindGroupValidationTest, BufferBindingType) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}
});
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}});
dawn::BindGroupBinding binding;
binding.binding = 0;
@ -285,9 +279,8 @@ TEST_F(BindGroupValidationTest, BufferBindingType) {
// Check that a texture must have the correct usage
TEST_F(BindGroupValidationTest, TextureUsage) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture}
});
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture}});
// Control case: setting a sampleable texture view works.
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
@ -309,8 +302,8 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
// Check that a texture must have the correct component type
TEST_F(BindGroupValidationTest, TextureComponentType) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture, false,
false, dawn::TextureComponentType::Float}});
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture, false, false,
dawn::TextureComponentType::Float}});
// Control case: setting a Float typed texture view works.
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
@ -332,9 +325,8 @@ TEST_F(BindGroupValidationTest, TextureComponentType) {
// Check that a UBO must have the correct usage
TEST_F(BindGroupValidationTest, BufferUsageUBO) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}
});
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}});
// Control case: using a buffer with the uniform usage works
utils::MakeBindGroup(device, layout, {{0, mUBO, 0, 256}});
@ -345,9 +337,8 @@ TEST_F(BindGroupValidationTest, BufferUsageUBO) {
// Check that a SSBO must have the correct usage
TEST_F(BindGroupValidationTest, BufferUsageSSBO) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::StorageBuffer}
});
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::StorageBuffer}});
// Control case: using a buffer with the storage usage works
utils::MakeBindGroup(device, layout, {{0, mSSBO, 0, 256}});
@ -358,8 +349,9 @@ TEST_F(BindGroupValidationTest, BufferUsageSSBO) {
// Tests constraints on the buffer offset for bind groups.
TEST_F(BindGroupValidationTest, BufferOffsetAlignment) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
});
// Check that offset 0 is valid
@ -376,8 +368,9 @@ TEST_F(BindGroupValidationTest, BufferOffsetAlignment) {
// Tests constraints to be sure the buffer binding fits in the buffer
TEST_F(BindGroupValidationTest, BufferBindingOOB) {
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
});
dawn::BufferDescriptor descriptor;
@ -412,14 +405,17 @@ TEST_F(BindGroupValidationTest, BufferBindingOOB) {
// Test what happens when the layout is an error.
TEST_F(BindGroupValidationTest, ErrorLayout) {
dawn::BindGroupLayout goodLayout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
dawn::BindGroupLayout goodLayout = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
});
dawn::BindGroupLayout errorLayout;
ASSERT_DEVICE_ERROR(errorLayout = utils::MakeBindGroupLayout(device, {
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
ASSERT_DEVICE_ERROR(
errorLayout = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
}));
// Control case, creating with the good layout works
@ -463,23 +459,22 @@ class BindGroupLayoutValidationTest : public ValidationTest {
// Tests setting OOB checks for kMaxBindingsPerGroup in bind group layouts.
TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutBindingOOB) {
// Checks that kMaxBindingsPerGroup - 1 is valid.
utils::MakeBindGroupLayout(device, {
{kMaxBindingsPerGroup - 1, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}
});
utils::MakeBindGroupLayout(device, {{kMaxBindingsPerGroup - 1, dawn::ShaderStage::Vertex,
dawn::BindingType::UniformBuffer}});
// Checks that kMaxBindingsPerGroup is OOB
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(device, {
{kMaxBindingsPerGroup, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}
}));
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device,
{{kMaxBindingsPerGroup, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer}}));
}
// This test verifies that the BindGroupLayout bindings are correctly validated, even if the
// binding ids are out-of-order.
TEST_F(BindGroupLayoutValidationTest, BindGroupBinding) {
utils::MakeBindGroupLayout(
device, {
{1, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
utils::MakeBindGroupLayout(device,
{
{1, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
});
}
@ -487,33 +482,33 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupBinding) {
TEST_F(BindGroupLayoutValidationTest, DynamicAndTypeCompatibility) {
utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::UniformBuffer, true},
{0, dawn::ShaderStage::Compute, dawn::BindingType::UniformBuffer, true},
});
utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer, true},
{0, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer, true},
});
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::SampledTexture, true},
{0, dawn::ShaderStage::Compute, dawn::BindingType::SampledTexture, true},
}));
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::Sampler, true},
{0, dawn::ShaderStage::Compute, dawn::BindingType::Sampler, true},
}));
}
// This test verifies that visibility of bindings in BindGroupLayout can't be none
TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutVisibilityNone) {
utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
utils::MakeBindGroupLayout(device,
{
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
});
dawn::BindGroupLayoutBinding binding = {0, dawn::ShaderStageBit::None,
dawn::BindGroupLayoutBinding binding = {0, dawn::ShaderStage::None,
dawn::BindingType::UniformBuffer};
dawn::BindGroupLayoutDescriptor descriptor;
descriptor.bindingCount = 1;
@ -529,12 +524,12 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
for (uint32_t i = 0; i < kMaxDynamicUniformBufferCount; ++i) {
maxUniformDB.push_back(
{i, dawn::ShaderStageBit::Compute, dawn::BindingType::UniformBuffer, true});
{i, dawn::ShaderStage::Compute, dawn::BindingType::UniformBuffer, true});
}
for (uint32_t i = 0; i < kMaxDynamicStorageBufferCount; ++i) {
maxStorageDB.push_back(
{i, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer, true});
{i, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer, true});
}
auto MakeBindGroupLayout = [&](dawn::BindGroupLayoutBinding* binding,
@ -557,7 +552,7 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
bgl[0] = MakeBindGroupLayout(maxUniformDB.data(), maxUniformDB.size());
bgl[1] = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::UniformBuffer, true},
{0, dawn::ShaderStage::Compute, dawn::BindingType::UniformBuffer, true},
});
TestCreatePipelineLayout(bgl, 2, false);
@ -568,7 +563,7 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
bgl[0] = MakeBindGroupLayout(maxStorageDB.data(), maxStorageDB.size());
bgl[1] = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer, true},
{0, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer, true},
});
TestCreatePipelineLayout(bgl, 2, false);
@ -576,14 +571,14 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
// Check dynamic uniform buffers exceed maximum in bind group layout.
{
maxUniformDB.push_back({kMaxDynamicUniformBufferCount, dawn::ShaderStageBit::Compute,
maxUniformDB.push_back({kMaxDynamicUniformBufferCount, dawn::ShaderStage::Compute,
dawn::BindingType::UniformBuffer, true});
TestCreateBindGroupLayout(maxUniformDB.data(), maxUniformDB.size(), false);
}
// Check dynamic storage buffers exceed maximum in bind group layout.
{
maxStorageDB.push_back({kMaxDynamicStorageBufferCount, dawn::ShaderStageBit::Compute,
maxStorageDB.push_back({kMaxDynamicStorageBufferCount, dawn::ShaderStage::Compute,
dawn::BindingType::StorageBuffer, true});
TestCreateBindGroupLayout(maxStorageDB.data(), maxStorageDB.size(), false);
}
@ -596,9 +591,9 @@ class SetBindGroupValidationTest : public ValidationTest {
public:
void SetUp() override {
mBindGroupLayout = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
device, {{0, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
dawn::BindingType::UniformBuffer, true},
{1, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
{1, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
dawn::BindingType::StorageBuffer, true}});
}
@ -616,13 +611,13 @@ class SetBindGroupValidationTest : public ValidationTest {
dawn::RenderPipeline CreateRenderPipeline() {
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(std140, set = 0, binding = 0) uniform uBuffer {
vec2 value1;
@ -645,7 +640,7 @@ class SetBindGroupValidationTest : public ValidationTest {
dawn::ComputePipeline CreateComputePipeline() {
dawn::ShaderModule csModule =
utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
#version 450
const uint kTileSize = 4;
const uint kInstances = 11;

View File

@ -210,9 +210,8 @@ TEST_F(CommandBufferValidationTest, BufferWithReadAndWriteUsage) {
dawn::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
// Create the bind group to use the buffer as storage
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(device, {{
0, dawn::ShaderStageBit::Vertex, dawn::BindingType::StorageBuffer
}});
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStage::Vertex, dawn::BindingType::StorageBuffer}});
dawn::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, buffer, 0, 4}});
// Use the buffer as both index and storage in the same pass
@ -240,9 +239,8 @@ TEST_F(CommandBufferValidationTest, TextureWithReadAndWriteUsage) {
dawn::TextureView view = texture.CreateDefaultView();
// Create the bind group to use the texture as sampled
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(device, {{
0, dawn::ShaderStageBit::Vertex, dawn::BindingType::SampledTexture
}});
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStage::Vertex, dawn::BindingType::SampledTexture}});
dawn::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}});
// Create the render pass that will use the texture as an output attachment

View File

@ -23,7 +23,7 @@ class ComputeIndirectValidationTest : public ValidationTest {
ValidationTest::SetUp();
dawn::ShaderModule computeModule =
utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
#version 450
layout(local_size_x = 1) in;
void main() {

View File

@ -24,14 +24,14 @@ class DrawIndirectValidationTest : public ValidationTest {
ValidationTest::SetUp();
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
gl_Position = vec4(0.0);
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -27,7 +27,7 @@ namespace {
void SetUp() override {
ValidationTest::SetUp();
vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(location = 0) in vec2 pos;
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
@ -36,7 +36,7 @@ namespace {
void main() {
})");
fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout (set = 1, binding = 0) uniform fragmentUniformBuffer {
vec4 color;
@ -49,12 +49,11 @@ namespace {
dawn::BindGroupLayout bgls[] = {
utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}}),
device, {{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer}}),
utils::MakeBindGroupLayout(
device,
{
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::StorageBuffer},
device, {
{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer},
{1, dawn::ShaderStage::Fragment, dawn::BindingType::StorageBuffer},
})};
dawn::PipelineLayoutDescriptor pipelineLayoutDesc = {};

View File

@ -25,7 +25,8 @@ class RenderPassValidationTest : public ValidationTest {};
// Test that it is invalid to draw in a render pass with missing bind groups
TEST_F(RenderPassValidationTest, MissingBindGroup) {
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
mat2 transform;
@ -36,7 +37,7 @@ void main() {
})");
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout (set = 1, binding = 0) uniform fragmentUniformBuffer {
vec4 color;
@ -48,9 +49,9 @@ void main() {
dawn::BindGroupLayout bgls[] = {
utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}}),
device, {{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer}}),
utils::MakeBindGroupLayout(
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}})};
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}})};
dawn::PipelineLayoutDescriptor pipelineLayoutDesc;
pipelineLayoutDesc.bindGroupLayoutCount = 2;

View File

@ -23,13 +23,13 @@ class RenderPipelineValidationTest : public ValidationTest {
void SetUp() override {
ValidationTest::SetUp();
vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
})");
fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -24,7 +24,7 @@ class VertexBufferValidationTest : public ValidationTest {
void SetUp() override {
ValidationTest::SetUp();
fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {
@ -64,7 +64,8 @@ class VertexBufferValidationTest : public ValidationTest {
vs << "}\n";
return utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vs.str().c_str());
return utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex,
vs.str().c_str());
}
dawn::RenderPipeline MakeRenderPipeline(const dawn::ShaderModule& vsModule,

View File

@ -22,10 +22,10 @@ class VertexInputTest : public ValidationTest {
void CreatePipeline(bool success,
const utils::ComboVertexInputDescriptor& state,
std::string vertexSource) {
dawn::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vertexSource.c_str());
dawn::ShaderModule vsModule = utils::CreateShaderModule(
device, utils::SingleShaderStage::Vertex, vertexSource.c_str());
dawn::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
void main() {

View File

@ -332,13 +332,11 @@ TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) {
TEST_F(WireArgumentTests, StructureOfStructureArrayArgument) {
static constexpr int NUM_BINDINGS = 3;
DawnBindGroupLayoutBinding bindings[NUM_BINDINGS]{
{0, DAWN_SHADER_STAGE_BIT_VERTEX, DAWN_BINDING_TYPE_SAMPLER, false, false,
{0, DAWN_SHADER_STAGE_VERTEX, DAWN_BINDING_TYPE_SAMPLER, false, false,
DAWN_TEXTURE_COMPONENT_TYPE_FLOAT},
{1, DAWN_SHADER_STAGE_BIT_VERTEX, DAWN_BINDING_TYPE_SAMPLED_TEXTURE, false, false,
{1, DAWN_SHADER_STAGE_VERTEX, DAWN_BINDING_TYPE_SAMPLED_TEXTURE, false, false,
DAWN_TEXTURE_COMPONENT_TYPE_FLOAT},
{2,
static_cast<DawnShaderStageBit>(DAWN_SHADER_STAGE_BIT_VERTEX |
DAWN_SHADER_STAGE_BIT_FRAGMENT),
{2, static_cast<DawnShaderStage>(DAWN_SHADER_STAGE_VERTEX | DAWN_SHADER_STAGE_FRAGMENT),
DAWN_BINDING_TYPE_UNIFORM_BUFFER, false, false, DAWN_TEXTURE_COMPONENT_TYPE_FLOAT},
};
DawnBindGroupLayoutDescriptor bglDescriptor;

View File

@ -28,13 +28,13 @@ namespace utils {
namespace {
shaderc_shader_kind ShadercShaderKind(ShaderStage stage) {
shaderc_shader_kind ShadercShaderKind(SingleShaderStage stage) {
switch (stage) {
case ShaderStage::Vertex:
case SingleShaderStage::Vertex:
return shaderc_glsl_vertex_shader;
case ShaderStage::Fragment:
case SingleShaderStage::Fragment:
return shaderc_glsl_fragment_shader;
case ShaderStage::Compute:
case SingleShaderStage::Compute:
return shaderc_glsl_compute_shader;
default:
UNREACHABLE();
@ -60,7 +60,7 @@ namespace utils {
} // anonymous namespace
dawn::ShaderModule CreateShaderModule(const dawn::Device& device,
ShaderStage stage,
SingleShaderStage stage,
const char* source) {
shaderc_shader_kind kind = ShadercShaderKind(stage);
@ -288,7 +288,7 @@ namespace utils {
dawn::BindGroupLayout MakeBindGroupLayout(
const dawn::Device& device,
std::initializer_list<dawn::BindGroupLayoutBinding> bindingsInitializer) {
constexpr dawn::ShaderStageBit kNoStages{};
constexpr dawn::ShaderStage kNoStages{};
std::vector<dawn::BindGroupLayoutBinding> bindings;
for (const dawn::BindGroupLayoutBinding& binding : bindingsInitializer) {

View File

@ -26,10 +26,10 @@ namespace utils {
enum Expectation { Success, Failure };
enum class ShaderStage { Vertex, Fragment, Compute };
enum class SingleShaderStage { Vertex, Fragment, Compute };
dawn::ShaderModule CreateShaderModule(const dawn::Device& device,
ShaderStage stage,
SingleShaderStage stage,
const char* source);
dawn::ShaderModule CreateShaderModuleFromASM(const dawn::Device& device, const char* source);