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:
parent
9e9e29f7a6
commit
b9b088f57e
|
@ -54,7 +54,7 @@
|
||||||
"extensible": false,
|
"extensible": false,
|
||||||
"members": [
|
"members": [
|
||||||
{"name": "binding", "type": "uint32_t"},
|
{"name": "binding", "type": "uint32_t"},
|
||||||
{"name": "visibility", "type": "shader stage bit"},
|
{"name": "visibility", "type": "shader stage"},
|
||||||
{"name": "type", "type": "binding type"},
|
{"name": "type", "type": "binding type"},
|
||||||
{"name": "dynamic", "type": "bool", "default": "false"},
|
{"name": "dynamic", "type": "bool", "default": "false"},
|
||||||
{"name": "multisampled", "type": "bool", "default": "false"},
|
{"name": "multisampled", "type": "bool", "default": "false"},
|
||||||
|
@ -1063,7 +1063,7 @@
|
||||||
{"name": "code", "type": "uint32_t", "annotation": "const*", "length": "code size"}
|
{"name": "code", "type": "uint32_t", "annotation": "const*", "length": "code size"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"shader stage bit": {
|
"shader stage": {
|
||||||
"category": "bitmask",
|
"category": "bitmask",
|
||||||
"values": [
|
"values": [
|
||||||
{"value": 0, "name": "none"},
|
{"value": 0, "name": "none"},
|
||||||
|
|
|
@ -55,7 +55,8 @@ void init() {
|
||||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment,
|
swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment,
|
||||||
640, 480);
|
640, 480);
|
||||||
|
|
||||||
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
dawn::ShaderModule vsModule =
|
||||||
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 0) uniform Constants {
|
layout(std140, set = 0, binding = 0) uniform Constants {
|
||||||
|
@ -103,7 +104,7 @@ void init() {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
layout(location = 0) in vec4 v_color;
|
layout(location = 0) in vec4 v_color;
|
||||||
|
@ -112,7 +113,7 @@ void init() {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
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);
|
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
|
@ -45,7 +45,8 @@ void init() {
|
||||||
" gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n"
|
" gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
DawnShaderModule vsModule =
|
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 =
|
const char* fs =
|
||||||
"#version 450\n"
|
"#version 450\n"
|
||||||
|
@ -54,7 +55,7 @@ void init() {
|
||||||
" fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
|
" fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
DawnShaderModule fsModule =
|
DawnShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fs).Release();
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs).Release();
|
||||||
|
|
||||||
{
|
{
|
||||||
DawnRenderPipelineDescriptor descriptor;
|
DawnRenderPipelineDescriptor descriptor;
|
||||||
|
|
|
@ -96,7 +96,8 @@ void initBuffers() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initRender() {
|
void initRender() {
|
||||||
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
dawn::ShaderModule vsModule =
|
||||||
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec2 a_particlePos;
|
layout(location = 0) in vec2 a_particlePos;
|
||||||
layout(location = 1) in vec2 a_particleVel;
|
layout(location = 1) in vec2 a_particleVel;
|
||||||
|
@ -110,7 +111,7 @@ void initRender() {
|
||||||
)");
|
)");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -146,7 +147,8 @@ void initRender() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSim() {
|
void initSim() {
|
||||||
dawn::ShaderModule module = utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
|
dawn::ShaderModule module =
|
||||||
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
struct Particle {
|
struct Particle {
|
||||||
|
@ -237,9 +239,9 @@ void initSim() {
|
||||||
|
|
||||||
auto bgl = utils::MakeBindGroupLayout(
|
auto bgl = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::UniformBuffer},
|
{0, dawn::ShaderStage::Compute, dawn::BindingType::UniformBuffer},
|
||||||
{1, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
|
{1, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
|
||||||
{2, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
|
{2, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
|
||||||
});
|
});
|
||||||
|
|
||||||
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
|
@ -96,7 +96,8 @@ void init() {
|
||||||
initBuffers();
|
initBuffers();
|
||||||
initTextures();
|
initTextures();
|
||||||
|
|
||||||
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
dawn::ShaderModule vsModule =
|
||||||
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec4 pos;
|
layout(location = 0) in vec4 pos;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -104,7 +105,7 @@ void init() {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(set = 0, binding = 0) uniform sampler mySampler;
|
layout(set = 0, binding = 0) uniform sampler mySampler;
|
||||||
layout(set = 0, binding = 1) uniform texture2D myTexture;
|
layout(set = 0, binding = 1) uniform texture2D myTexture;
|
||||||
|
@ -116,8 +117,8 @@ void init() {
|
||||||
|
|
||||||
auto bgl = utils::MakeBindGroupLayout(
|
auto bgl = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
|
{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
|
||||||
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture},
|
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture},
|
||||||
});
|
});
|
||||||
|
|
||||||
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
|
@ -124,7 +124,8 @@ void init() {
|
||||||
|
|
||||||
initBuffers();
|
initBuffers();
|
||||||
|
|
||||||
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
dawn::ShaderModule vsModule =
|
||||||
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(set = 0, binding = 0) uniform cameraData {
|
layout(set = 0, binding = 0) uniform cameraData {
|
||||||
mat4 view;
|
mat4 view;
|
||||||
|
@ -142,7 +143,7 @@ void init() {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 2) in vec3 f_col;
|
layout(location = 2) in vec3 f_col;
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
@ -151,7 +152,7 @@ void init() {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsReflectionModule =
|
dawn::ShaderModule fsReflectionModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 2) in vec3 f_col;
|
layout(location = 2) in vec3 f_col;
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
@ -171,8 +172,8 @@ void init() {
|
||||||
|
|
||||||
auto bgl = utils::MakeBindGroupLayout(
|
auto bgl = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
|
||||||
{1, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
{1, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
|
||||||
});
|
});
|
||||||
|
|
||||||
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace dawn_native {
|
||||||
uint32_t dynamicStorageBufferCount = 0;
|
uint32_t dynamicStorageBufferCount = 0;
|
||||||
for (uint32_t i = 0; i < descriptor->bindingCount; ++i) {
|
for (uint32_t i = 0; i < descriptor->bindingCount; ++i) {
|
||||||
const BindGroupLayoutBinding& binding = descriptor->bindings[i];
|
const BindGroupLayoutBinding& binding = descriptor->bindings[i];
|
||||||
DAWN_TRY(ValidateShaderStageBit(binding.visibility));
|
DAWN_TRY(ValidateShaderStage(binding.visibility));
|
||||||
DAWN_TRY(ValidateBindingType(binding.type));
|
DAWN_TRY(ValidateBindingType(binding.type));
|
||||||
DAWN_TRY(ValidateTextureComponentType(binding.textureComponentType));
|
DAWN_TRY(ValidateTextureComponentType(binding.textureComponentType));
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ namespace dawn_native {
|
||||||
return DAWN_VALIDATION_ERROR("some binding index was specified more than once");
|
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");
|
return DAWN_VALIDATION_ERROR("Visibility of bindings can't be None");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace dawn_native {
|
||||||
static BindGroupLayoutBase* MakeError(DeviceBase* device);
|
static BindGroupLayoutBase* MakeError(DeviceBase* device);
|
||||||
|
|
||||||
struct LayoutBindingInfo {
|
struct LayoutBindingInfo {
|
||||||
std::array<dawn::ShaderStageBit, kMaxBindingsPerGroup> visibilities;
|
std::array<dawn::ShaderStage, kMaxBindingsPerGroup> visibilities;
|
||||||
std::array<dawn::BindingType, kMaxBindingsPerGroup> types;
|
std::array<dawn::BindingType, kMaxBindingsPerGroup> types;
|
||||||
std::array<dawn::TextureComponentType, kMaxBindingsPerGroup> textureComponentTypes;
|
std::array<dawn::TextureComponentType, kMaxBindingsPerGroup> textureComponentTypes;
|
||||||
std::bitset<kMaxBindingsPerGroup> dynamic;
|
std::bitset<kMaxBindingsPerGroup> dynamic;
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
DAWN_TRY(device->ValidateObject(descriptor->layout));
|
DAWN_TRY(device->ValidateObject(descriptor->layout));
|
||||||
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->computeStage,
|
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->computeStage,
|
||||||
descriptor->layout, ShaderStage::Compute));
|
descriptor->layout, SingleShaderStage::Compute));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ namespace dawn_native {
|
||||||
ComputePipelineBase::ComputePipelineBase(DeviceBase* device,
|
ComputePipelineBase::ComputePipelineBase(DeviceBase* device,
|
||||||
const ComputePipelineDescriptor* descriptor,
|
const ComputePipelineDescriptor* descriptor,
|
||||||
bool blueprint)
|
bool blueprint)
|
||||||
: PipelineBase(device, descriptor->layout, dawn::ShaderStageBit::Compute),
|
: PipelineBase(device, descriptor->layout, dawn::ShaderStage::Compute),
|
||||||
mModule(descriptor->computeStage->module),
|
mModule(descriptor->computeStage->module),
|
||||||
mEntryPoint(descriptor->computeStage->entryPoint),
|
mEntryPoint(descriptor->computeStage->entryPoint),
|
||||||
mIsBlueprint(blueprint) {
|
mIsBlueprint(blueprint) {
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
|
|
||||||
namespace dawn_native {
|
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));
|
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);
|
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
|
} // namespace dawn_native
|
||||||
|
|
|
@ -25,27 +25,27 @@
|
||||||
|
|
||||||
namespace dawn_native {
|
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>(SingleShaderStage::Vertex) < kNumStages, "");
|
||||||
static_assert(static_cast<uint32_t>(ShaderStage::Fragment) < kNumStages, "");
|
static_assert(static_cast<uint32_t>(SingleShaderStage::Fragment) < kNumStages, "");
|
||||||
static_assert(static_cast<uint32_t>(ShaderStage::Compute) < kNumStages, "");
|
static_assert(static_cast<uint32_t>(SingleShaderStage::Compute) < kNumStages, "");
|
||||||
|
|
||||||
static_assert(static_cast<uint32_t>(dawn::ShaderStageBit::Vertex) ==
|
static_assert(static_cast<uint32_t>(dawn::ShaderStage::Vertex) ==
|
||||||
(1 << static_cast<uint32_t>(ShaderStage::Vertex)),
|
(1 << static_cast<uint32_t>(SingleShaderStage::Vertex)),
|
||||||
"");
|
"");
|
||||||
static_assert(static_cast<uint32_t>(dawn::ShaderStageBit::Fragment) ==
|
static_assert(static_cast<uint32_t>(dawn::ShaderStage::Fragment) ==
|
||||||
(1 << static_cast<uint32_t>(ShaderStage::Fragment)),
|
(1 << static_cast<uint32_t>(SingleShaderStage::Fragment)),
|
||||||
"");
|
"");
|
||||||
static_assert(static_cast<uint32_t>(dawn::ShaderStageBit::Compute) ==
|
static_assert(static_cast<uint32_t>(dawn::ShaderStage::Compute) ==
|
||||||
(1 << static_cast<uint32_t>(ShaderStage::Compute)),
|
(1 << static_cast<uint32_t>(SingleShaderStage::Compute)),
|
||||||
"");
|
"");
|
||||||
|
|
||||||
BitSetIterator<kNumStages, ShaderStage> IterateStages(dawn::ShaderStageBit stages);
|
BitSetIterator<kNumStages, SingleShaderStage> IterateStages(dawn::ShaderStage stages);
|
||||||
dawn::ShaderStageBit StageBit(ShaderStage stage);
|
dawn::ShaderStage StageBit(SingleShaderStage stage);
|
||||||
|
|
||||||
static constexpr dawn::ShaderStageBit kAllStages =
|
static constexpr dawn::ShaderStage kAllStages =
|
||||||
static_cast<dawn::ShaderStageBit>((1 << kNumStages) - 1);
|
static_cast<dawn::ShaderStage>((1 << kNumStages) - 1);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class PerStage {
|
class PerStage {
|
||||||
|
@ -55,21 +55,21 @@ namespace dawn_native {
|
||||||
mData.fill(initialValue);
|
mData.fill(initialValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
T& operator[](ShaderStage stage) {
|
T& operator[](SingleShaderStage stage) {
|
||||||
DAWN_ASSERT(static_cast<uint32_t>(stage) < kNumStages);
|
DAWN_ASSERT(static_cast<uint32_t>(stage) < kNumStages);
|
||||||
return mData[static_cast<uint32_t>(stage)];
|
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);
|
DAWN_ASSERT(static_cast<uint32_t>(stage) < kNumStages);
|
||||||
return mData[static_cast<uint32_t>(stage)];
|
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);
|
uint32_t bit = static_cast<uint32_t>(stageBit);
|
||||||
DAWN_ASSERT(bit != 0 && IsPowerOfTwo(bit) && bit <= (1 << kNumStages));
|
DAWN_ASSERT(bit != 0 && IsPowerOfTwo(bit) && bit <= (1 << kNumStages));
|
||||||
return mData[Log2(bit)];
|
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);
|
uint32_t bit = static_cast<uint32_t>(stageBit);
|
||||||
DAWN_ASSERT(bit != 0 && IsPowerOfTwo(bit) && bit <= (1 << kNumStages));
|
DAWN_ASSERT(bit != 0 && IsPowerOfTwo(bit) && bit <= (1 << kNumStages));
|
||||||
return mData[Log2(bit)];
|
return mData[Log2(bit)];
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace dawn_native {
|
||||||
MaybeError ValidatePipelineStageDescriptor(const DeviceBase* device,
|
MaybeError ValidatePipelineStageDescriptor(const DeviceBase* device,
|
||||||
const PipelineStageDescriptor* descriptor,
|
const PipelineStageDescriptor* descriptor,
|
||||||
const PipelineLayoutBase* layout,
|
const PipelineLayoutBase* layout,
|
||||||
ShaderStage stage) {
|
SingleShaderStage stage) {
|
||||||
DAWN_TRY(device->ValidateObject(descriptor->module));
|
DAWN_TRY(device->ValidateObject(descriptor->module));
|
||||||
|
|
||||||
if (descriptor->entryPoint != std::string("main")) {
|
if (descriptor->entryPoint != std::string("main")) {
|
||||||
|
@ -42,7 +42,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
PipelineBase::PipelineBase(DeviceBase* device,
|
PipelineBase::PipelineBase(DeviceBase* device,
|
||||||
PipelineLayoutBase* layout,
|
PipelineLayoutBase* layout,
|
||||||
dawn::ShaderStageBit stages)
|
dawn::ShaderStage stages)
|
||||||
: ObjectBase(device), mStageMask(stages), mLayout(layout) {
|
: ObjectBase(device), mStageMask(stages), mLayout(layout) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace dawn_native {
|
||||||
: ObjectBase(device, tag) {
|
: ObjectBase(device, tag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
dawn::ShaderStageBit PipelineBase::GetStageMask() const {
|
dawn::ShaderStage PipelineBase::GetStageMask() const {
|
||||||
ASSERT(!IsError());
|
ASSERT(!IsError());
|
||||||
return mStageMask;
|
return mStageMask;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,20 +31,20 @@ namespace dawn_native {
|
||||||
MaybeError ValidatePipelineStageDescriptor(const DeviceBase* device,
|
MaybeError ValidatePipelineStageDescriptor(const DeviceBase* device,
|
||||||
const PipelineStageDescriptor* descriptor,
|
const PipelineStageDescriptor* descriptor,
|
||||||
const PipelineLayoutBase* layout,
|
const PipelineLayoutBase* layout,
|
||||||
ShaderStage stage);
|
SingleShaderStage stage);
|
||||||
|
|
||||||
class PipelineBase : public ObjectBase {
|
class PipelineBase : public ObjectBase {
|
||||||
public:
|
public:
|
||||||
dawn::ShaderStageBit GetStageMask() const;
|
dawn::ShaderStage GetStageMask() const;
|
||||||
PipelineLayoutBase* GetLayout();
|
PipelineLayoutBase* GetLayout();
|
||||||
const PipelineLayoutBase* GetLayout() const;
|
const PipelineLayoutBase* GetLayout() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PipelineBase(DeviceBase* device, PipelineLayoutBase* layout, dawn::ShaderStageBit stages);
|
PipelineBase(DeviceBase* device, PipelineLayoutBase* layout, dawn::ShaderStage stages);
|
||||||
PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag);
|
PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
dawn::ShaderStageBit mStageMask;
|
dawn::ShaderStage mStageMask;
|
||||||
Ref<PipelineLayoutBase> mLayout;
|
Ref<PipelineLayoutBase> mLayout;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -280,9 +280,9 @@ namespace dawn_native {
|
||||||
DAWN_TRY(ValidateVertexInputDescriptor(descriptor->vertexInput, &attributesSetMask));
|
DAWN_TRY(ValidateVertexInputDescriptor(descriptor->vertexInput, &attributesSetMask));
|
||||||
DAWN_TRY(ValidatePrimitiveTopology(descriptor->primitiveTopology));
|
DAWN_TRY(ValidatePrimitiveTopology(descriptor->primitiveTopology));
|
||||||
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->vertexStage,
|
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->vertexStage,
|
||||||
descriptor->layout, ShaderStage::Vertex));
|
descriptor->layout, SingleShaderStage::Vertex));
|
||||||
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->fragmentStage,
|
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->fragmentStage,
|
||||||
descriptor->layout, ShaderStage::Fragment));
|
descriptor->layout, SingleShaderStage::Fragment));
|
||||||
|
|
||||||
if (descriptor->rasterizationState) {
|
if (descriptor->rasterizationState) {
|
||||||
DAWN_TRY(ValidateRasterizationStateDescriptor(descriptor->rasterizationState));
|
DAWN_TRY(ValidateRasterizationStateDescriptor(descriptor->rasterizationState));
|
||||||
|
@ -352,7 +352,7 @@ namespace dawn_native {
|
||||||
bool blueprint)
|
bool blueprint)
|
||||||
: PipelineBase(device,
|
: PipelineBase(device,
|
||||||
descriptor->layout,
|
descriptor->layout,
|
||||||
dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment),
|
dawn::ShaderStage::Vertex | dawn::ShaderStage::Fragment),
|
||||||
mVertexInput(*descriptor->vertexInput),
|
mVertexInput(*descriptor->vertexInput),
|
||||||
mAttachmentState(device->GetOrCreateAttachmentState(descriptor)),
|
mAttachmentState(device->GetOrCreateAttachmentState(descriptor)),
|
||||||
mPrimitiveTopology(descriptor->primitiveTopology),
|
mPrimitiveTopology(descriptor->primitiveTopology),
|
||||||
|
|
|
@ -102,13 +102,13 @@ namespace dawn_native {
|
||||||
|
|
||||||
switch (compiler.get_execution_model()) {
|
switch (compiler.get_execution_model()) {
|
||||||
case spv::ExecutionModelVertex:
|
case spv::ExecutionModelVertex:
|
||||||
mExecutionModel = ShaderStage::Vertex;
|
mExecutionModel = SingleShaderStage::Vertex;
|
||||||
break;
|
break;
|
||||||
case spv::ExecutionModelFragment:
|
case spv::ExecutionModelFragment:
|
||||||
mExecutionModel = ShaderStage::Fragment;
|
mExecutionModel = SingleShaderStage::Fragment;
|
||||||
break;
|
break;
|
||||||
case spv::ExecutionModelGLCompute:
|
case spv::ExecutionModelGLCompute:
|
||||||
mExecutionModel = ShaderStage::Compute;
|
mExecutionModel = SingleShaderStage::Compute;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -153,7 +153,7 @@ namespace dawn_native {
|
||||||
dawn::BindingType::StorageBuffer);
|
dawn::BindingType::StorageBuffer);
|
||||||
|
|
||||||
// Extract the vertex attributes
|
// Extract the vertex attributes
|
||||||
if (mExecutionModel == ShaderStage::Vertex) {
|
if (mExecutionModel == SingleShaderStage::Vertex) {
|
||||||
for (const auto& attrib : resources.stage_inputs) {
|
for (const auto& attrib : resources.stage_inputs) {
|
||||||
ASSERT(compiler.get_decoration_bitset(attrib.id).get(spv::DecorationLocation));
|
ASSERT(compiler.get_decoration_bitset(attrib.id).get(spv::DecorationLocation));
|
||||||
uint32_t location = compiler.get_decoration(attrib.id, 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
|
// Without a location qualifier on vertex inputs, spirv_cross::CompilerMSL gives them
|
||||||
// all the location 0, causing a compile error.
|
// all the location 0, causing a compile error.
|
||||||
for (const auto& attrib : resources.stage_inputs) {
|
for (const auto& attrib : resources.stage_inputs) {
|
||||||
|
@ -198,7 +198,7 @@ namespace dawn_native {
|
||||||
return mUsedVertexAttributes;
|
return mUsedVertexAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderStage ShaderModuleBase::GetExecutionModel() const {
|
SingleShaderStage ShaderModuleBase::GetExecutionModel() const {
|
||||||
ASSERT(!IsError());
|
ASSERT(!IsError());
|
||||||
return mExecutionModel;
|
return mExecutionModel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
const ModuleBindingInfo& GetBindingInfo() const;
|
const ModuleBindingInfo& GetBindingInfo() const;
|
||||||
const std::bitset<kMaxVertexAttributes>& GetUsedVertexAttributes() const;
|
const std::bitset<kMaxVertexAttributes>& GetUsedVertexAttributes() const;
|
||||||
ShaderStage GetExecutionModel() const;
|
SingleShaderStage GetExecutionModel() const;
|
||||||
|
|
||||||
bool IsCompatibleWithPipelineLayout(const PipelineLayoutBase* layout);
|
bool IsCompatibleWithPipelineLayout(const PipelineLayoutBase* layout);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
ModuleBindingInfo mBindingInfo;
|
ModuleBindingInfo mBindingInfo;
|
||||||
std::bitset<kMaxVertexAttributes> mUsedVertexAttributes;
|
std::bitset<kMaxVertexAttributes> mUsedVertexAttributes;
|
||||||
ShaderStage mExecutionModel;
|
SingleShaderStage mExecutionModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dawn_native
|
} // namespace dawn_native
|
||||||
|
|
|
@ -24,14 +24,14 @@ using Microsoft::WRL::ComPtr;
|
||||||
|
|
||||||
namespace dawn_native { namespace d3d12 {
|
namespace dawn_native { namespace d3d12 {
|
||||||
namespace {
|
namespace {
|
||||||
D3D12_SHADER_VISIBILITY ShaderVisibilityType(dawn::ShaderStageBit visibility) {
|
D3D12_SHADER_VISIBILITY ShaderVisibilityType(dawn::ShaderStage visibility) {
|
||||||
ASSERT(visibility != dawn::ShaderStageBit::None);
|
ASSERT(visibility != dawn::ShaderStage::None);
|
||||||
|
|
||||||
if (visibility == dawn::ShaderStageBit::Vertex) {
|
if (visibility == dawn::ShaderStage::Vertex) {
|
||||||
return D3D12_SHADER_VISIBILITY_VERTEX;
|
return D3D12_SHADER_VISIBILITY_VERTEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visibility == dawn::ShaderStageBit::Fragment) {
|
if (visibility == dawn::ShaderStage::Fragment) {
|
||||||
return D3D12_SHADER_VISIBILITY_PIXEL;
|
return D3D12_SHADER_VISIBILITY_PIXEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -304,21 +304,20 @@ namespace dawn_native { namespace d3d12 {
|
||||||
PerStage<ComPtr<ID3DBlob>> compiledShader;
|
PerStage<ComPtr<ID3DBlob>> compiledShader;
|
||||||
ComPtr<ID3DBlob> errors;
|
ComPtr<ID3DBlob> errors;
|
||||||
|
|
||||||
dawn::ShaderStageBit renderStages =
|
dawn::ShaderStage renderStages = dawn::ShaderStage::Vertex | dawn::ShaderStage::Fragment;
|
||||||
dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment;
|
|
||||||
for (auto stage : IterateStages(renderStages)) {
|
for (auto stage : IterateStages(renderStages)) {
|
||||||
const ShaderModule* module = nullptr;
|
const ShaderModule* module = nullptr;
|
||||||
const char* entryPoint = nullptr;
|
const char* entryPoint = nullptr;
|
||||||
const char* compileTarget = nullptr;
|
const char* compileTarget = nullptr;
|
||||||
D3D12_SHADER_BYTECODE* shader = nullptr;
|
D3D12_SHADER_BYTECODE* shader = nullptr;
|
||||||
switch (stage) {
|
switch (stage) {
|
||||||
case ShaderStage::Vertex:
|
case SingleShaderStage::Vertex:
|
||||||
module = ToBackend(descriptor->vertexStage->module);
|
module = ToBackend(descriptor->vertexStage->module);
|
||||||
entryPoint = descriptor->vertexStage->entryPoint;
|
entryPoint = descriptor->vertexStage->entryPoint;
|
||||||
shader = &descriptorD3D12.VS;
|
shader = &descriptorD3D12.VS;
|
||||||
compileTarget = "vs_5_1";
|
compileTarget = "vs_5_1";
|
||||||
break;
|
break;
|
||||||
case ShaderStage::Fragment:
|
case SingleShaderStage::Fragment:
|
||||||
module = ToBackend(descriptor->fragmentStage->module);
|
module = ToBackend(descriptor->fragmentStage->module);
|
||||||
entryPoint = descriptor->fragmentStage->entryPoint;
|
entryPoint = descriptor->fragmentStage->entryPoint;
|
||||||
shader = &descriptorD3D12.PS;
|
shader = &descriptorD3D12.PS;
|
||||||
|
|
|
@ -200,32 +200,32 @@ namespace dawn_native { namespace metal {
|
||||||
// length of storage buffers and can apply them to the reserved "buffer length buffer" when
|
// length of storage buffers and can apply them to the reserved "buffer length buffer" when
|
||||||
// needed for a draw or a dispatch.
|
// needed for a draw or a dispatch.
|
||||||
struct StorageBufferLengthTracker {
|
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
|
// The lengths of buffers are stored as 32bit integers because that is the width the
|
||||||
// MSL code generated by SPIRV-Cross expects.
|
// MSL code generated by SPIRV-Cross expects.
|
||||||
PerStage<std::array<uint32_t, kGenericMetalBufferSlots>> data;
|
PerStage<std::array<uint32_t, kGenericMetalBufferSlots>> data;
|
||||||
|
|
||||||
void Apply(RenderPipeline* pipeline, id<MTLRenderCommandEncoder> render) {
|
void Apply(RenderPipeline* pipeline, id<MTLRenderCommandEncoder> render) {
|
||||||
dawn::ShaderStageBit stagesToApply =
|
dawn::ShaderStage stagesToApply =
|
||||||
dirtyStages & pipeline->GetStagesRequiringStorageBufferLength();
|
dirtyStages & pipeline->GetStagesRequiringStorageBufferLength();
|
||||||
|
|
||||||
if (stagesToApply == dawn::ShaderStageBit::None) {
|
if (stagesToApply == dawn::ShaderStage::None) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stagesToApply & dawn::ShaderStageBit::Vertex) {
|
if (stagesToApply & dawn::ShaderStage::Vertex) {
|
||||||
uint32_t bufferCount = ToBackend(pipeline->GetLayout())
|
uint32_t bufferCount = ToBackend(pipeline->GetLayout())
|
||||||
->GetBufferBindingCount(ShaderStage::Vertex);
|
->GetBufferBindingCount(SingleShaderStage::Vertex);
|
||||||
[render setVertexBytes:data[ShaderStage::Vertex].data()
|
[render setVertexBytes:data[SingleShaderStage::Vertex].data()
|
||||||
length:sizeof(uint32_t) * bufferCount
|
length:sizeof(uint32_t) * bufferCount
|
||||||
atIndex:kBufferLengthBufferSlot];
|
atIndex:kBufferLengthBufferSlot];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stagesToApply & dawn::ShaderStageBit::Fragment) {
|
if (stagesToApply & dawn::ShaderStage::Fragment) {
|
||||||
uint32_t bufferCount = ToBackend(pipeline->GetLayout())
|
uint32_t bufferCount = ToBackend(pipeline->GetLayout())
|
||||||
->GetBufferBindingCount(ShaderStage::Fragment);
|
->GetBufferBindingCount(SingleShaderStage::Fragment);
|
||||||
[render setFragmentBytes:data[ShaderStage::Fragment].data()
|
[render setFragmentBytes:data[SingleShaderStage::Fragment].data()
|
||||||
length:sizeof(uint32_t) * bufferCount
|
length:sizeof(uint32_t) * bufferCount
|
||||||
atIndex:kBufferLengthBufferSlot];
|
atIndex:kBufferLengthBufferSlot];
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ namespace dawn_native { namespace metal {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Apply(ComputePipeline* pipeline, id<MTLComputeCommandEncoder> compute) {
|
void Apply(ComputePipeline* pipeline, id<MTLComputeCommandEncoder> compute) {
|
||||||
if (!(dirtyStages & dawn::ShaderStageBit::Compute)) {
|
if (!(dirtyStages & dawn::ShaderStage::Compute)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,13 +243,13 @@ namespace dawn_native { namespace metal {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t bufferCount =
|
uint32_t bufferCount = ToBackend(pipeline->GetLayout())
|
||||||
ToBackend(pipeline->GetLayout())->GetBufferBindingCount(ShaderStage::Compute);
|
->GetBufferBindingCount(SingleShaderStage::Compute);
|
||||||
[compute setBytes:data[ShaderStage::Compute].data()
|
[compute setBytes:data[SingleShaderStage::Compute].data()
|
||||||
length:sizeof(uint32_t) * bufferCount
|
length:sizeof(uint32_t) * bufferCount
|
||||||
atIndex:kBufferLengthBufferSlot];
|
atIndex:kBufferLengthBufferSlot];
|
||||||
|
|
||||||
dirtyStages ^= dawn::ShaderStageBit::Compute;
|
dirtyStages ^= dawn::ShaderStage::Compute;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -273,9 +273,9 @@ namespace dawn_native { namespace metal {
|
||||||
// call here.
|
// call here.
|
||||||
for (uint32_t bindingIndex : IterateBitSet(layout.mask)) {
|
for (uint32_t bindingIndex : IterateBitSet(layout.mask)) {
|
||||||
auto stage = layout.visibilities[bindingIndex];
|
auto stage = layout.visibilities[bindingIndex];
|
||||||
bool hasVertStage = stage & dawn::ShaderStageBit::Vertex && render != nil;
|
bool hasVertStage = stage & dawn::ShaderStage::Vertex && render != nil;
|
||||||
bool hasFragStage = stage & dawn::ShaderStageBit::Fragment && render != nil;
|
bool hasFragStage = stage & dawn::ShaderStage::Fragment && render != nil;
|
||||||
bool hasComputeStage = stage & dawn::ShaderStageBit::Compute && compute != nil;
|
bool hasComputeStage = stage & dawn::ShaderStage::Compute && compute != nil;
|
||||||
|
|
||||||
uint32_t vertIndex = 0;
|
uint32_t vertIndex = 0;
|
||||||
uint32_t fragIndex = 0;
|
uint32_t fragIndex = 0;
|
||||||
|
@ -283,15 +283,15 @@ namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
if (hasVertStage) {
|
if (hasVertStage) {
|
||||||
vertIndex = pipelineLayout->GetBindingIndexInfo(
|
vertIndex = pipelineLayout->GetBindingIndexInfo(
|
||||||
ShaderStage::Vertex)[index][bindingIndex];
|
SingleShaderStage::Vertex)[index][bindingIndex];
|
||||||
}
|
}
|
||||||
if (hasFragStage) {
|
if (hasFragStage) {
|
||||||
fragIndex = pipelineLayout->GetBindingIndexInfo(
|
fragIndex = pipelineLayout->GetBindingIndexInfo(
|
||||||
ShaderStage::Fragment)[index][bindingIndex];
|
SingleShaderStage::Fragment)[index][bindingIndex];
|
||||||
}
|
}
|
||||||
if (hasComputeStage) {
|
if (hasComputeStage) {
|
||||||
computeIndex = pipelineLayout->GetBindingIndexInfo(
|
computeIndex = pipelineLayout->GetBindingIndexInfo(
|
||||||
ShaderStage::Compute)[index][bindingIndex];
|
SingleShaderStage::Compute)[index][bindingIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (layout.types[bindingIndex]) {
|
switch (layout.types[bindingIndex]) {
|
||||||
|
@ -310,22 +310,25 @@ namespace dawn_native { namespace metal {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasVertStage) {
|
if (hasVertStage) {
|
||||||
lengthTracker->data[ShaderStage::Vertex][vertIndex] = binding.size;
|
lengthTracker->data[SingleShaderStage::Vertex][vertIndex] =
|
||||||
lengthTracker->dirtyStages |= dawn::ShaderStageBit::Vertex;
|
binding.size;
|
||||||
|
lengthTracker->dirtyStages |= dawn::ShaderStage::Vertex;
|
||||||
[render setVertexBuffers:&buffer
|
[render setVertexBuffers:&buffer
|
||||||
offsets:&offset
|
offsets:&offset
|
||||||
withRange:NSMakeRange(vertIndex, 1)];
|
withRange:NSMakeRange(vertIndex, 1)];
|
||||||
}
|
}
|
||||||
if (hasFragStage) {
|
if (hasFragStage) {
|
||||||
lengthTracker->data[ShaderStage::Fragment][fragIndex] = binding.size;
|
lengthTracker->data[SingleShaderStage::Fragment][fragIndex] =
|
||||||
lengthTracker->dirtyStages |= dawn::ShaderStageBit::Fragment;
|
binding.size;
|
||||||
|
lengthTracker->dirtyStages |= dawn::ShaderStage::Fragment;
|
||||||
[render setFragmentBuffers:&buffer
|
[render setFragmentBuffers:&buffer
|
||||||
offsets:&offset
|
offsets:&offset
|
||||||
withRange:NSMakeRange(fragIndex, 1)];
|
withRange:NSMakeRange(fragIndex, 1)];
|
||||||
}
|
}
|
||||||
if (hasComputeStage) {
|
if (hasComputeStage) {
|
||||||
lengthTracker->data[ShaderStage::Compute][computeIndex] = binding.size;
|
lengthTracker->data[SingleShaderStage::Compute][computeIndex] =
|
||||||
lengthTracker->dirtyStages |= dawn::ShaderStageBit::Compute;
|
binding.size;
|
||||||
|
lengthTracker->dirtyStages |= dawn::ShaderStage::Compute;
|
||||||
[compute setBuffers:&buffer
|
[compute setBuffers:&buffer
|
||||||
offsets:&offset
|
offsets:&offset
|
||||||
withRange:NSMakeRange(computeIndex, 1)];
|
withRange:NSMakeRange(computeIndex, 1)];
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace dawn_native { namespace metal {
|
||||||
const ShaderModule* computeModule = ToBackend(descriptor->computeStage->module);
|
const ShaderModule* computeModule = ToBackend(descriptor->computeStage->module);
|
||||||
const char* computeEntryPoint = descriptor->computeStage->entryPoint;
|
const char* computeEntryPoint = descriptor->computeStage->entryPoint;
|
||||||
ShaderModule::MetalFunctionData computeData = computeModule->GetFunction(
|
ShaderModule::MetalFunctionData computeData = computeModule->GetFunction(
|
||||||
computeEntryPoint, ShaderStage::Compute, ToBackend(GetLayout()));
|
computeEntryPoint, SingleShaderStage::Compute, ToBackend(GetLayout()));
|
||||||
|
|
||||||
NSError* error = nil;
|
NSError* error = nil;
|
||||||
mMtlComputePipelineState =
|
mMtlComputePipelineState =
|
||||||
|
|
|
@ -42,10 +42,10 @@ namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
using BindingIndexInfo =
|
using BindingIndexInfo =
|
||||||
std::array<std::array<uint32_t, kMaxBindingsPerGroup>, kMaxBindGroups>;
|
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.
|
// The number of Metal vertex stage buffers used for the whole pipeline layout.
|
||||||
uint32_t GetBufferBindingCount(ShaderStage stage);
|
uint32_t GetBufferBindingCount(SingleShaderStage stage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PerStage<BindingIndexInfo> mIndexInfo;
|
PerStage<BindingIndexInfo> mIndexInfo;
|
||||||
|
|
|
@ -66,11 +66,11 @@ namespace dawn_native { namespace metal {
|
||||||
}
|
}
|
||||||
|
|
||||||
const PipelineLayout::BindingIndexInfo& PipelineLayout::GetBindingIndexInfo(
|
const PipelineLayout::BindingIndexInfo& PipelineLayout::GetBindingIndexInfo(
|
||||||
ShaderStage stage) const {
|
SingleShaderStage stage) const {
|
||||||
return mIndexInfo[stage];
|
return mIndexInfo[stage];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t PipelineLayout::GetBufferBindingCount(ShaderStage stage) {
|
uint32_t PipelineLayout::GetBufferBindingCount(SingleShaderStage stage) {
|
||||||
return mBufferBindingCount[stage];
|
return mBufferBindingCount[stage];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace dawn_native { namespace metal {
|
||||||
// vertex buffer table.
|
// vertex buffer table.
|
||||||
uint32_t GetMtlVertexBufferIndex(uint32_t dawnIndex) const;
|
uint32_t GetMtlVertexBufferIndex(uint32_t dawnIndex) const;
|
||||||
|
|
||||||
dawn::ShaderStageBit GetStagesRequiringStorageBufferLength() const;
|
dawn::ShaderStage GetStagesRequiringStorageBufferLength() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MTLVertexDescriptor* MakeVertexDesc();
|
MTLVertexDescriptor* MakeVertexDesc();
|
||||||
|
@ -54,7 +54,7 @@ namespace dawn_native { namespace metal {
|
||||||
id<MTLDepthStencilState> mMtlDepthStencilState = nil;
|
id<MTLDepthStencilState> mMtlDepthStencilState = nil;
|
||||||
std::array<uint32_t, kMaxVertexBuffers> mMtlVertexBufferIndices;
|
std::array<uint32_t, kMaxVertexBuffers> mMtlVertexBufferIndices;
|
||||||
|
|
||||||
dawn::ShaderStageBit mStagesRequiringStorageBufferLength = dawn::ShaderStageBit::None;
|
dawn::ShaderStage mStagesRequiringStorageBufferLength = dawn::ShaderStage::None;
|
||||||
};
|
};
|
||||||
|
|
||||||
}} // namespace dawn_native::metal
|
}} // namespace dawn_native::metal
|
||||||
|
|
|
@ -317,19 +317,19 @@ namespace dawn_native { namespace metal {
|
||||||
const ShaderModule* vertexModule = ToBackend(descriptor->vertexStage->module);
|
const ShaderModule* vertexModule = ToBackend(descriptor->vertexStage->module);
|
||||||
const char* vertexEntryPoint = descriptor->vertexStage->entryPoint;
|
const char* vertexEntryPoint = descriptor->vertexStage->entryPoint;
|
||||||
ShaderModule::MetalFunctionData vertexData = vertexModule->GetFunction(
|
ShaderModule::MetalFunctionData vertexData = vertexModule->GetFunction(
|
||||||
vertexEntryPoint, ShaderStage::Vertex, ToBackend(GetLayout()));
|
vertexEntryPoint, SingleShaderStage::Vertex, ToBackend(GetLayout()));
|
||||||
descriptorMTL.vertexFunction = vertexData.function;
|
descriptorMTL.vertexFunction = vertexData.function;
|
||||||
if (vertexData.needsStorageBufferLength) {
|
if (vertexData.needsStorageBufferLength) {
|
||||||
mStagesRequiringStorageBufferLength |= dawn::ShaderStageBit::Vertex;
|
mStagesRequiringStorageBufferLength |= dawn::ShaderStage::Vertex;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ShaderModule* fragmentModule = ToBackend(descriptor->fragmentStage->module);
|
const ShaderModule* fragmentModule = ToBackend(descriptor->fragmentStage->module);
|
||||||
const char* fragmentEntryPoint = descriptor->fragmentStage->entryPoint;
|
const char* fragmentEntryPoint = descriptor->fragmentStage->entryPoint;
|
||||||
ShaderModule::MetalFunctionData fragmentData = fragmentModule->GetFunction(
|
ShaderModule::MetalFunctionData fragmentData = fragmentModule->GetFunction(
|
||||||
fragmentEntryPoint, ShaderStage::Fragment, ToBackend(GetLayout()));
|
fragmentEntryPoint, SingleShaderStage::Fragment, ToBackend(GetLayout()));
|
||||||
descriptorMTL.fragmentFunction = fragmentData.function;
|
descriptorMTL.fragmentFunction = fragmentData.function;
|
||||||
if (fragmentData.needsStorageBufferLength) {
|
if (fragmentData.needsStorageBufferLength) {
|
||||||
mStagesRequiringStorageBufferLength |= dawn::ShaderStageBit::Fragment;
|
mStagesRequiringStorageBufferLength |= dawn::ShaderStage::Fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasDepthStencilAttachment()) {
|
if (HasDepthStencilAttachment()) {
|
||||||
|
@ -411,7 +411,7 @@ namespace dawn_native { namespace metal {
|
||||||
return mMtlVertexBufferIndices[dawnIndex];
|
return mMtlVertexBufferIndices[dawnIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
dawn::ShaderStageBit RenderPipeline::GetStagesRequiringStorageBufferLength() const {
|
dawn::ShaderStage RenderPipeline::GetStagesRequiringStorageBufferLength() const {
|
||||||
return mStagesRequiringStorageBufferLength;
|
return mStagesRequiringStorageBufferLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
// Vertex buffers are packed after all the buffers for the bind groups.
|
// Vertex buffers are packed after all the buffers for the bind groups.
|
||||||
uint32_t mtlVertexBufferIndex =
|
uint32_t mtlVertexBufferIndex =
|
||||||
ToBackend(GetLayout())->GetBufferBindingCount(ShaderStage::Vertex);
|
ToBackend(GetLayout())->GetBufferBindingCount(SingleShaderStage::Vertex);
|
||||||
|
|
||||||
for (uint32_t dawnVertexBufferIndex : IterateBitSet(GetInputsSetMask())) {
|
for (uint32_t dawnVertexBufferIndex : IterateBitSet(GetInputsSetMask())) {
|
||||||
const VertexBufferInfo& info = GetInput(dawnVertexBufferIndex);
|
const VertexBufferInfo& info = GetInput(dawnVertexBufferIndex);
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace dawn_native { namespace metal {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MetalFunctionData GetFunction(const char* functionName,
|
MetalFunctionData GetFunction(const char* functionName,
|
||||||
ShaderStage functionStage,
|
SingleShaderStage functionStage,
|
||||||
const PipelineLayout* layout) const;
|
const PipelineLayout* layout) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -26,13 +26,13 @@ namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
spv::ExecutionModel SpirvExecutionModelForStage(ShaderStage stage) {
|
spv::ExecutionModel SpirvExecutionModelForStage(SingleShaderStage stage) {
|
||||||
switch (stage) {
|
switch (stage) {
|
||||||
case ShaderStage::Vertex:
|
case SingleShaderStage::Vertex:
|
||||||
return spv::ExecutionModelVertex;
|
return spv::ExecutionModelVertex;
|
||||||
case ShaderStage::Fragment:
|
case SingleShaderStage::Fragment:
|
||||||
return spv::ExecutionModelFragment;
|
return spv::ExecutionModelFragment;
|
||||||
case ShaderStage::Compute:
|
case SingleShaderStage::Compute:
|
||||||
return spv::ExecutionModelGLCompute;
|
return spv::ExecutionModelGLCompute;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -48,7 +48,7 @@ namespace dawn_native { namespace metal {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderModule::MetalFunctionData ShaderModule::GetFunction(const char* functionName,
|
ShaderModule::MetalFunctionData ShaderModule::GetFunction(const char* functionName,
|
||||||
ShaderStage functionStage,
|
SingleShaderStage functionStage,
|
||||||
const PipelineLayout* layout) const {
|
const PipelineLayout* layout) const {
|
||||||
spirv_cross::CompilerMSL compiler(mSpirv);
|
spirv_cross::CompilerMSL compiler(mSpirv);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace dawn_native { namespace opengl {
|
||||||
ComputePipeline::ComputePipeline(Device* device, const ComputePipelineDescriptor* descriptor)
|
ComputePipeline::ComputePipeline(Device* device, const ComputePipelineDescriptor* descriptor)
|
||||||
: ComputePipelineBase(device, descriptor) {
|
: ComputePipelineBase(device, descriptor) {
|
||||||
PerStage<const ShaderModule*> modules(nullptr);
|
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);
|
PipelineGL::Initialize(device->gl, ToBackend(descriptor->layout), modules);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,13 @@ namespace dawn_native { namespace opengl {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
GLenum GLShaderType(ShaderStage stage) {
|
GLenum GLShaderType(SingleShaderStage stage) {
|
||||||
switch (stage) {
|
switch (stage) {
|
||||||
case ShaderStage::Vertex:
|
case SingleShaderStage::Vertex:
|
||||||
return GL_VERTEX_SHADER;
|
return GL_VERTEX_SHADER;
|
||||||
case ShaderStage::Fragment:
|
case SingleShaderStage::Fragment:
|
||||||
return GL_FRAGMENT_SHADER;
|
return GL_FRAGMENT_SHADER;
|
||||||
case ShaderStage::Compute:
|
case SingleShaderStage::Compute:
|
||||||
return GL_COMPUTE_SHADER;
|
return GL_COMPUTE_SHADER;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -74,14 +74,14 @@ namespace dawn_native { namespace opengl {
|
||||||
|
|
||||||
mProgram = gl.CreateProgram();
|
mProgram = gl.CreateProgram();
|
||||||
|
|
||||||
dawn::ShaderStageBit activeStages = dawn::ShaderStageBit::None;
|
dawn::ShaderStage activeStages = dawn::ShaderStage::None;
|
||||||
for (ShaderStage stage : IterateStages(kAllStages)) {
|
for (SingleShaderStage stage : IterateStages(kAllStages)) {
|
||||||
if (modules[stage] != nullptr) {
|
if (modules[stage] != nullptr) {
|
||||||
activeStages |= StageBit(stage);
|
activeStages |= StageBit(stage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ShaderStage stage : IterateStages(activeStages)) {
|
for (SingleShaderStage stage : IterateStages(activeStages)) {
|
||||||
GLuint shader = CreateShader(gl, GLShaderType(stage), modules[stage]->GetSource());
|
GLuint shader = CreateShader(gl, GLShaderType(stage), modules[stage]->GetSource());
|
||||||
gl.AttachShader(mProgram, shader);
|
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
|
// Compute links between stages for combined samplers, then bind them to texture units
|
||||||
{
|
{
|
||||||
std::set<CombinedSampler> combinedSamplersSet;
|
std::set<CombinedSampler> combinedSamplersSet;
|
||||||
for (ShaderStage stage : IterateStages(activeStages)) {
|
for (SingleShaderStage stage : IterateStages(activeStages)) {
|
||||||
for (const auto& combined : modules[stage]->GetCombinedSamplerInfo()) {
|
for (const auto& combined : modules[stage]->GetCombinedSamplerInfo()) {
|
||||||
combinedSamplersSet.insert(combined);
|
combinedSamplersSet.insert(combined);
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,8 +198,8 @@ namespace dawn_native { namespace opengl {
|
||||||
mVertexArrayObject(0),
|
mVertexArrayObject(0),
|
||||||
mGlPrimitiveTopology(GLPrimitiveTopology(GetPrimitiveTopology())) {
|
mGlPrimitiveTopology(GLPrimitiveTopology(GetPrimitiveTopology())) {
|
||||||
PerStage<const ShaderModule*> modules(nullptr);
|
PerStage<const ShaderModule*> modules(nullptr);
|
||||||
modules[ShaderStage::Vertex] = ToBackend(descriptor->vertexStage->module);
|
modules[SingleShaderStage::Vertex] = ToBackend(descriptor->vertexStage->module);
|
||||||
modules[ShaderStage::Fragment] = ToBackend(descriptor->fragmentStage->module);
|
modules[SingleShaderStage::Fragment] = ToBackend(descriptor->fragmentStage->module);
|
||||||
|
|
||||||
PipelineGL::Initialize(device->gl, ToBackend(GetLayout()), modules);
|
PipelineGL::Initialize(device->gl, ToBackend(GetLayout()), modules);
|
||||||
CreateVAOForVertexInput(descriptor->vertexInput);
|
CreateVAOForVertexInput(descriptor->vertexInput);
|
||||||
|
|
|
@ -21,16 +21,16 @@ namespace dawn_native { namespace vulkan {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
VkShaderStageFlags VulkanShaderStageFlags(dawn::ShaderStageBit stages) {
|
VkShaderStageFlags VulkanShaderStageFlags(dawn::ShaderStage stages) {
|
||||||
VkShaderStageFlags flags = 0;
|
VkShaderStageFlags flags = 0;
|
||||||
|
|
||||||
if (stages & dawn::ShaderStageBit::Vertex) {
|
if (stages & dawn::ShaderStage::Vertex) {
|
||||||
flags |= VK_SHADER_STAGE_VERTEX_BIT;
|
flags |= VK_SHADER_STAGE_VERTEX_BIT;
|
||||||
}
|
}
|
||||||
if (stages & dawn::ShaderStageBit::Fragment) {
|
if (stages & dawn::ShaderStage::Fragment) {
|
||||||
flags |= VK_SHADER_STAGE_FRAGMENT_BIT;
|
flags |= VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||||
}
|
}
|
||||||
if (stages & dawn::ShaderStageBit::Compute) {
|
if (stages & dawn::ShaderStage::Compute) {
|
||||||
flags |= VK_SHADER_STAGE_COMPUTE_BIT;
|
flags |= VK_SHADER_STAGE_COMPUTE_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,9 @@ protected:
|
||||||
// This test passes by not asserting or crashing.
|
// This test passes by not asserting or crashing.
|
||||||
TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) {
|
TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) {
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
device,
|
device, {
|
||||||
{
|
{0, dawn::ShaderStage::Compute, dawn::BindingType::UniformBuffer},
|
||||||
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::UniformBuffer},
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
||||||
const char* shader = R"(
|
const char* shader = R"(
|
||||||
|
@ -66,7 +64,7 @@ TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) {
|
||||||
)";
|
)";
|
||||||
|
|
||||||
dawn::ShaderModule module =
|
dawn::ShaderModule module =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Compute, shader);
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, shader);
|
||||||
dawn::ComputePipelineDescriptor cpDesc;
|
dawn::ComputePipelineDescriptor cpDesc;
|
||||||
cpDesc.layout = pl;
|
cpDesc.layout = pl;
|
||||||
|
|
||||||
|
@ -98,7 +96,8 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
||||||
|
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
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
|
#version 450
|
||||||
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
|
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
|
||||||
mat2 transform;
|
mat2 transform;
|
||||||
|
@ -109,7 +108,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout (set = 0, binding = 1) uniform fragmentUniformBuffer {
|
layout (set = 0, binding = 1) uniform fragmentUniformBuffer {
|
||||||
vec4 color;
|
vec4 color;
|
||||||
|
@ -120,12 +119,10 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
device,
|
device, {
|
||||||
{
|
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
|
||||||
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
{1, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer},
|
||||||
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
dawn::PipelineLayout pipelineLayout = utils::MakeBasicPipelineLayout(device, &bgl);
|
dawn::PipelineLayout pipelineLayout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
|
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
|
||||||
|
@ -183,7 +180,8 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
||||||
|
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
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
|
#version 450
|
||||||
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
|
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
|
||||||
mat2 transform;
|
mat2 transform;
|
||||||
|
@ -194,7 +192,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout (set = 0, binding = 1) uniform sampler samp;
|
layout (set = 0, binding = 1) uniform sampler samp;
|
||||||
layout (set = 0, binding = 2) uniform texture2D tex;
|
layout (set = 0, binding = 2) uniform texture2D tex;
|
||||||
|
@ -204,13 +202,11 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
device,
|
device, {
|
||||||
{
|
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
|
||||||
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
{1, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
|
||||||
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
|
{2, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture},
|
||||||
{2, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture},
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
dawn::PipelineLayout pipelineLayout = utils::MakeBasicPipelineLayout(device, &bgl);
|
dawn::PipelineLayout pipelineLayout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||||
|
@ -301,7 +297,8 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
||||||
|
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
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
|
#version 450
|
||||||
layout (set = 0, binding = 0) uniform vertexUniformBuffer1 {
|
layout (set = 0, binding = 0) uniform vertexUniformBuffer1 {
|
||||||
mat2 transform1;
|
mat2 transform1;
|
||||||
|
@ -315,7 +312,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout (set = 0, binding = 1) uniform fragmentUniformBuffer1 {
|
layout (set = 0, binding = 1) uniform fragmentUniformBuffer1 {
|
||||||
vec4 color1;
|
vec4 color1;
|
||||||
|
@ -330,8 +327,8 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
||||||
|
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
|
||||||
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
|
{1, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer},
|
||||||
});
|
});
|
||||||
|
|
||||||
dawn::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(device, {layout, layout});
|
dawn::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(device, {layout, layout});
|
||||||
|
@ -396,7 +393,8 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets)
|
||||||
{
|
{
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
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
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
const vec2 pos[3] = vec2[3](vec2(-1.f, -1.f), vec2(1.f, -1.f), vec2(-1.f, 1.f));
|
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 =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout (std140, set = 0, binding = 0) uniform fragmentUniformBuffer1 {
|
layout (std140, set = 0, binding = 0) uniform fragmentUniformBuffer1 {
|
||||||
vec4 color1;
|
vec4 color1;
|
||||||
|
@ -424,9 +422,7 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets)
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}});
|
||||||
{ 0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer }
|
|
||||||
});
|
|
||||||
dawn::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(
|
dawn::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(
|
||||||
device, { layout, layout, layout, layout });
|
device, { layout, layout, layout, layout });
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class ClipSpaceTest : public DawnTest {
|
||||||
gl_Position = vec4(pos[gl_VertexIndex], 1.0);
|
gl_Position = vec4(pos[gl_VertexIndex], 1.0);
|
||||||
})";
|
})";
|
||||||
pipelineDescriptor.cVertexStage.module =
|
pipelineDescriptor.cVertexStage.module =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vs);
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
|
||||||
|
|
||||||
const char* fs =
|
const char* fs =
|
||||||
R"(#version 450
|
R"(#version 450
|
||||||
|
@ -46,7 +46,7 @@ class ClipSpaceTest : public DawnTest {
|
||||||
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||||
})";
|
})";
|
||||||
pipelineDescriptor.cFragmentStage.module =
|
pipelineDescriptor.cFragmentStage.module =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fs);
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs);
|
||||||
|
|
||||||
pipelineDescriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::LessEqual;
|
pipelineDescriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::LessEqual;
|
||||||
pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;
|
pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;
|
||||||
|
|
|
@ -29,7 +29,7 @@ class ColorStateTest : public DawnTest {
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
DawnTest::SetUp();
|
DawnTest::SetUp();
|
||||||
|
|
||||||
vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
const vec2 pos[3] = vec2[3](vec2(-1.f, -1.f), vec2(3.f, -1.f), vec2(-1.f, 3.f));
|
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(
|
bindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
|
{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer},
|
||||||
});
|
});
|
||||||
|
|
||||||
pipelineLayout = utils::MakeBasicPipelineLayout(device, &bindGroupLayout);
|
pipelineLayout = utils::MakeBasicPipelineLayout(device, &bindGroupLayout);
|
||||||
|
@ -56,7 +56,7 @@ class ColorStateTest : public DawnTest {
|
||||||
// attachment. basePipeline has no blending
|
// attachment. basePipeline has no blending
|
||||||
void SetupSingleSourcePipelines(dawn::ColorStateDescriptor colorStateDescriptor) {
|
void SetupSingleSourcePipelines(dawn::ColorStateDescriptor colorStateDescriptor) {
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(set = 0, binding = 0) uniform myBlock {
|
layout(set = 0, binding = 0) uniform myBlock {
|
||||||
vec4 color;
|
vec4 color;
|
||||||
|
@ -773,7 +773,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
||||||
renderTargetViews[2], renderTargetViews[3]});
|
renderTargetViews[2], renderTargetViews[3]});
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(set = 0, binding = 0) uniform myBlock {
|
layout(set = 0, binding = 0) uniform myBlock {
|
||||||
vec4 color0;
|
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 that the default blend color is correctly set at the beginning of every subpass
|
||||||
TEST_P(ColorStateTest, DefaultBlendColor) {
|
TEST_P(ColorStateTest, DefaultBlendColor) {
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(set = 0, binding = 0) uniform myBlock {
|
layout(set = 0, binding = 0) uniform myBlock {
|
||||||
vec4 color;
|
vec4 color;
|
||||||
|
@ -1008,7 +1008,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
|
||||||
// attachment.
|
// attachment.
|
||||||
TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
|
TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(set = 0, binding = 0) uniform myBlock {
|
layout(set = 0, binding = 0) uniform myBlock {
|
||||||
vec4 color;
|
vec4 color;
|
||||||
|
|
|
@ -37,8 +37,8 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
DawnTest::SetUp();
|
DawnTest::SetUp();
|
||||||
mBindGroupLayout = utils::MakeBindGroupLayout(
|
mBindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
|
||||||
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture}});
|
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture}});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<const char*> GetRequiredExtensions() override {
|
std::vector<const char*> GetRequiredExtensions() override {
|
||||||
|
@ -140,7 +140,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location=0) out vec2 texCoord;
|
layout(location=0) out vec2 texCoord;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -153,7 +153,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
||||||
texCoord = gl_Position.xy / 2.0f + vec2(0.5f);
|
texCoord = gl_Position.xy / 2.0f + vec2(0.5f);
|
||||||
})");
|
})");
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(set = 0, binding = 0) uniform sampler sampler0;
|
layout(set = 0, binding = 0) uniform sampler sampler0;
|
||||||
layout(set = 0, binding = 1) uniform texture2D texture0;
|
layout(set = 0, binding = 1) uniform texture2D texture0;
|
||||||
|
|
|
@ -30,12 +30,12 @@ class ComputeCopyStorageBufferTests : public DawnTest {
|
||||||
void ComputeCopyStorageBufferTests::BasicTest(const char* shader) {
|
void ComputeCopyStorageBufferTests::BasicTest(const char* shader) {
|
||||||
auto bgl = utils::MakeBindGroupLayout(
|
auto bgl = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
|
{0, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
|
||||||
{1, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
|
{1, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set up shader and pipeline
|
// 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);
|
auto pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
||||||
dawn::ComputePipelineDescriptor csDesc;
|
dawn::ComputePipelineDescriptor csDesc;
|
||||||
|
|
|
@ -47,13 +47,13 @@ void ComputeIndirectTests::BasicTest(std::initializer_list<uint32_t> bufferList,
|
||||||
uint64_t indirectOffset) {
|
uint64_t indirectOffset) {
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::UniformBuffer},
|
{0, dawn::ShaderStage::Compute, dawn::BindingType::UniformBuffer},
|
||||||
{1, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
|
{1, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set up shader and pipeline
|
// Set up shader and pipeline
|
||||||
dawn::ShaderModule module =
|
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::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
||||||
dawn::ComputePipelineDescriptor csDesc;
|
dawn::ComputePipelineDescriptor csDesc;
|
||||||
|
|
|
@ -28,11 +28,11 @@ class ComputeSharedMemoryTests : public DawnTest {
|
||||||
void ComputeSharedMemoryTests::BasicTest(const char* shader) {
|
void ComputeSharedMemoryTests::BasicTest(const char* shader) {
|
||||||
auto bgl = utils::MakeBindGroupLayout(
|
auto bgl = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
|
{0, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set up shader and pipeline
|
// 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);
|
auto pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
||||||
dawn::ComputePipelineDescriptor csDesc;
|
dawn::ComputePipelineDescriptor csDesc;
|
||||||
|
|
|
@ -37,7 +37,7 @@ class CullingTest : public DawnTest {
|
||||||
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
|
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
|
||||||
})";
|
})";
|
||||||
pipelineDescriptor.cVertexStage.module =
|
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
|
// 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
|
// 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);
|
fragColor = vec4((gl_FragCoord.xy - vec2(0.5)) / 255, 0.0, 1.0);
|
||||||
})";
|
})";
|
||||||
pipelineDescriptor.cFragmentStage.module =
|
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
|
// Set culling mode and front face according to the parameters
|
||||||
pipelineDescriptor.cRasterizationState.frontFace = frontFace;
|
pipelineDescriptor.cRasterizationState.frontFace = frontFace;
|
||||||
|
|
|
@ -54,7 +54,7 @@ class DepthStencilStateTest : public DawnTest {
|
||||||
|
|
||||||
depthTextureView = depthTexture.CreateDefaultView();
|
depthTextureView = depthTexture.CreateDefaultView();
|
||||||
|
|
||||||
vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(set = 0, binding = 0) uniform myBlock {
|
layout(set = 0, binding = 0) uniform myBlock {
|
||||||
vec3 color;
|
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
|
#version 450
|
||||||
layout(set = 0, binding = 0) uniform myBlock {
|
layout(set = 0, binding = 0) uniform myBlock {
|
||||||
vec3 color;
|
vec3 color;
|
||||||
|
@ -83,7 +83,7 @@ class DepthStencilStateTest : public DawnTest {
|
||||||
|
|
||||||
bindGroupLayout = utils::MakeBindGroupLayout(
|
bindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment,
|
{0, dawn::ShaderStage::Vertex | dawn::ShaderStage::Fragment,
|
||||||
dawn::BindingType::UniformBuffer},
|
dawn::BindingType::UniformBuffer},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class DestroyTest : public DawnTest {
|
||||||
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec4 pos;
|
layout(location = 0) in vec4 pos;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -35,7 +35,7 @@ class DestroyTest : public DawnTest {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -27,7 +27,7 @@ class DrawIndexedIndirectTest : public DawnTest {
|
||||||
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec4 pos;
|
layout(location = 0) in vec4 pos;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -35,7 +35,7 @@ class DrawIndexedIndirectTest : public DawnTest {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -27,7 +27,7 @@ class DrawIndexedTest : public DawnTest {
|
||||||
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec4 pos;
|
layout(location = 0) in vec4 pos;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -35,7 +35,7 @@ class DrawIndexedTest : public DawnTest {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -27,7 +27,7 @@ class DrawIndirectTest : public DawnTest {
|
||||||
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec4 pos;
|
layout(location = 0) in vec4 pos;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -35,7 +35,7 @@ class DrawIndirectTest : public DawnTest {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -27,7 +27,7 @@ class DrawTest : public DawnTest {
|
||||||
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec4 pos;
|
layout(location = 0) in vec4 pos;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -35,7 +35,7 @@ class DrawTest : public DawnTest {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -55,13 +55,13 @@ class DynamicBufferOffsetTests : public DawnTest {
|
||||||
|
|
||||||
// Default bind group layout
|
// Default bind group layout
|
||||||
mBindGroupLayouts[0] = utils::MakeBindGroupLayout(
|
mBindGroupLayouts[0] = utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
|
device, {{0, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
|
||||||
dawn::BindingType::UniformBuffer},
|
dawn::BindingType::UniformBuffer},
|
||||||
{1, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
|
{1, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
|
||||||
dawn::BindingType::StorageBuffer},
|
dawn::BindingType::StorageBuffer},
|
||||||
{3, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
|
{3, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
|
||||||
dawn::BindingType::UniformBuffer, true},
|
dawn::BindingType::UniformBuffer, true},
|
||||||
{4, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
|
{4, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
|
||||||
dawn::BindingType::StorageBuffer, true}});
|
dawn::BindingType::StorageBuffer, true}});
|
||||||
|
|
||||||
// Default bind group
|
// Default bind group
|
||||||
|
@ -77,7 +77,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
||||||
|
|
||||||
// Bind group layout for inheriting test
|
// Bind group layout for inheriting test
|
||||||
mBindGroupLayouts[1] = utils::MakeBindGroupLayout(
|
mBindGroupLayouts[1] = utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
|
device, {{0, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
|
||||||
dawn::BindingType::UniformBuffer}});
|
dawn::BindingType::UniformBuffer}});
|
||||||
|
|
||||||
// Bind group for inheriting test
|
// Bind group for inheriting test
|
||||||
|
@ -94,7 +94,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
||||||
|
|
||||||
dawn::RenderPipeline CreateRenderPipeline(bool isInheritedPipeline = false) {
|
dawn::RenderPipeline CreateRenderPipeline(bool isInheritedPipeline = false) {
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
const vec2 pos[3] = vec2[3](vec2(-1.0f, 0.0f), vec2(-1.0f, -1.0f), vec2(0.0f, -1.0f));
|
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";
|
fs << " }\n";
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
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);
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||||
pipelineDescriptor.cVertexStage.module = vsModule;
|
pipelineDescriptor.cVertexStage.module = vsModule;
|
||||||
|
@ -191,7 +191,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
||||||
cs << " }\n";
|
cs << " }\n";
|
||||||
|
|
||||||
dawn::ShaderModule csModule =
|
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::ComputePipelineDescriptor csDesc;
|
||||||
dawn::PipelineStageDescriptor computeStage;
|
dawn::PipelineStageDescriptor computeStage;
|
||||||
|
|
|
@ -258,8 +258,8 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
||||||
|
|
||||||
bgl = utils::MakeBindGroupLayout(
|
bgl = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
|
{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
|
||||||
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture},
|
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture},
|
||||||
});
|
});
|
||||||
|
|
||||||
bindGroup = utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, textureView}});
|
bindGroup = utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, textureView}});
|
||||||
|
@ -269,7 +269,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
||||||
dawn::RenderPipeline pipeline;
|
dawn::RenderPipeline pipeline;
|
||||||
{
|
{
|
||||||
dawn::ShaderModule vs =
|
dawn::ShaderModule vs =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout (location = 0) out vec2 o_texCoord;
|
layout (location = 0) out vec2 o_texCoord;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -290,7 +290,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
dawn::ShaderModule fs =
|
dawn::ShaderModule fs =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(set = 0, binding = 0) uniform sampler sampler0;
|
layout(set = 0, binding = 0) uniform sampler sampler0;
|
||||||
layout(set = 0, binding = 1) uniform texture2D texture0;
|
layout(set = 0, binding = 1) uniform texture2D texture0;
|
||||||
|
|
|
@ -32,7 +32,7 @@ class IndexFormatTest : public DawnTest {
|
||||||
|
|
||||||
dawn::RenderPipeline MakeTestPipeline(dawn::IndexFormat format) {
|
dawn::RenderPipeline MakeTestPipeline(dawn::IndexFormat format) {
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec4 pos;
|
layout(location = 0) in vec4 pos;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -40,7 +40,7 @@ class IndexFormatTest : public DawnTest {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -197,15 +197,15 @@ class MultisampledRenderingTest : public DawnTest {
|
||||||
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
|
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
|
||||||
})";
|
})";
|
||||||
pipelineDescriptor.cVertexStage.module =
|
pipelineDescriptor.cVertexStage.module =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vs);
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
|
||||||
|
|
||||||
pipelineDescriptor.cFragmentStage.module =
|
pipelineDescriptor.cFragmentStage.module =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fs);
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs);
|
||||||
|
|
||||||
mBindGroupLayout = utils::MakeBindGroupLayout(
|
mBindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
|
{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer},
|
||||||
});
|
});
|
||||||
dawn::PipelineLayout pipelineLayout =
|
dawn::PipelineLayout pipelineLayout =
|
||||||
utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
||||||
pipelineDescriptor.layout = pipelineLayout;
|
pipelineDescriptor.layout = pipelineLayout;
|
||||||
|
|
|
@ -22,11 +22,11 @@ class ObjectCachingTest : public DawnTest {};
|
||||||
// Test that BindGroupLayouts are correctly deduplicated.
|
// Test that BindGroupLayouts are correctly deduplicated.
|
||||||
TEST_P(ObjectCachingTest, BindGroupLayoutDeduplication) {
|
TEST_P(ObjectCachingTest, BindGroupLayoutDeduplication) {
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
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(
|
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(
|
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_NE(bgl.Get(), otherBgl.Get());
|
||||||
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
|
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 that two similar bind group layouts won't refer to the same one if they differ by dynamic.
|
||||||
TEST_P(ObjectCachingTest, BindGroupLayoutDynamic) {
|
TEST_P(ObjectCachingTest, BindGroupLayoutDynamic) {
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
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(
|
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(
|
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_NE(bgl.Get(), otherBgl.Get());
|
||||||
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
|
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
|
||||||
|
@ -49,14 +49,14 @@ TEST_P(ObjectCachingTest, BindGroupLayoutDynamic) {
|
||||||
// textureComponentType
|
// textureComponentType
|
||||||
TEST_P(ObjectCachingTest, BindGroupLayoutTextureComponentType) {
|
TEST_P(ObjectCachingTest, BindGroupLayoutTextureComponentType) {
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture, false,
|
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture, false, false,
|
||||||
false, dawn::TextureComponentType::Float}});
|
dawn::TextureComponentType::Float}});
|
||||||
dawn::BindGroupLayout sameBgl = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout sameBgl = utils::MakeBindGroupLayout(
|
||||||
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture, false,
|
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture, false, false,
|
||||||
false, dawn::TextureComponentType::Float}});
|
dawn::TextureComponentType::Float}});
|
||||||
dawn::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
|
||||||
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture, false,
|
device, {{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture, false, false,
|
||||||
false, dawn::TextureComponentType::Uint}});
|
dawn::TextureComponentType::Uint}});
|
||||||
|
|
||||||
EXPECT_NE(bgl.Get(), otherBgl.Get());
|
EXPECT_NE(bgl.Get(), otherBgl.Get());
|
||||||
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
|
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
|
||||||
|
@ -66,16 +66,16 @@ TEST_P(ObjectCachingTest, BindGroupLayoutTextureComponentType) {
|
||||||
TEST_P(ObjectCachingTest, ErrorObjectDoesntUncache) {
|
TEST_P(ObjectCachingTest, ErrorObjectDoesntUncache) {
|
||||||
ASSERT_DEVICE_ERROR(
|
ASSERT_DEVICE_ERROR(
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer},
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}}));
|
{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that PipelineLayouts are correctly deduplicated.
|
// Test that PipelineLayouts are correctly deduplicated.
|
||||||
TEST_P(ObjectCachingTest, PipelineLayoutDeduplication) {
|
TEST_P(ObjectCachingTest, PipelineLayoutDeduplication) {
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
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(
|
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 pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
dawn::PipelineLayout samePl = 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 that ShaderModules are correctly deduplicated.
|
||||||
TEST_P(ObjectCachingTest, ShaderModuleDeduplication) {
|
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
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
dawn::ShaderModule sameModule =
|
dawn::ShaderModule sameModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
dawn::ShaderModule otherModule =
|
dawn::ShaderModule otherModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -116,19 +117,20 @@ TEST_P(ObjectCachingTest, ShaderModuleDeduplication) {
|
||||||
|
|
||||||
// Test that ComputePipeline are correctly deduplicated wrt. their ShaderModule
|
// Test that ComputePipeline are correctly deduplicated wrt. their ShaderModule
|
||||||
TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnShaderModule) {
|
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
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
})");
|
})");
|
||||||
dawn::ShaderModule sameModule =
|
dawn::ShaderModule sameModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
})");
|
})");
|
||||||
dawn::ShaderModule otherModule =
|
dawn::ShaderModule otherModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
})");
|
})");
|
||||||
|
@ -161,9 +163,9 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnShaderModule) {
|
||||||
// Test that ComputePipeline are correctly deduplicated wrt. their layout
|
// Test that ComputePipeline are correctly deduplicated wrt. their layout
|
||||||
TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnLayout) {
|
TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnLayout) {
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
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(
|
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 pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
dawn::PipelineLayout samePl = utils::MakeBasicPipelineLayout(device, &bgl);
|
dawn::PipelineLayout samePl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
@ -174,7 +176,7 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnLayout) {
|
||||||
|
|
||||||
dawn::PipelineStageDescriptor stageDesc;
|
dawn::PipelineStageDescriptor stageDesc;
|
||||||
stageDesc.entryPoint = "main";
|
stageDesc.entryPoint = "main";
|
||||||
stageDesc.module = utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
|
stageDesc.module = utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -199,9 +201,9 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnLayout) {
|
||||||
// Test that RenderPipelines are correctly deduplicated wrt. their layout
|
// Test that RenderPipelines are correctly deduplicated wrt. their layout
|
||||||
TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
|
TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
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(
|
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 pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
dawn::PipelineLayout samePl = 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());
|
EXPECT_EQ(pl.Get() == samePl.Get(), !UsesWire());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
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
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = vec4(0.0);
|
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
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
})");
|
})");
|
||||||
|
@ -236,19 +240,20 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
|
||||||
|
|
||||||
// Test that RenderPipelines are correctly deduplicated wrt. their vertex module
|
// Test that RenderPipelines are correctly deduplicated wrt. their vertex module
|
||||||
TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
|
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
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = vec4(0.0);
|
gl_Position = vec4(0.0);
|
||||||
})");
|
})");
|
||||||
dawn::ShaderModule sameModule =
|
dawn::ShaderModule sameModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = vec4(0.0);
|
gl_Position = vec4(0.0);
|
||||||
})");
|
})");
|
||||||
dawn::ShaderModule otherModule =
|
dawn::ShaderModule otherModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = vec4(1.0);
|
gl_Position = vec4(1.0);
|
||||||
|
@ -258,7 +263,8 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
|
||||||
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
|
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
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
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
})");
|
})");
|
||||||
|
@ -278,17 +284,18 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
|
||||||
|
|
||||||
// Test that RenderPipelines are correctly deduplicated wrt. their fragment module
|
// Test that RenderPipelines are correctly deduplicated wrt. their fragment module
|
||||||
TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) {
|
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
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
})");
|
})");
|
||||||
dawn::ShaderModule sameModule =
|
dawn::ShaderModule sameModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
})");
|
})");
|
||||||
dawn::ShaderModule otherModule =
|
dawn::ShaderModule otherModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -298,7 +305,8 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) {
|
||||||
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
|
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
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
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = vec4(0.0);
|
gl_Position = vec4(0.0);
|
||||||
|
|
|
@ -36,9 +36,8 @@ class OpArrayLengthTest : public DawnTest {
|
||||||
mStorageBuffer512 = device.CreateBuffer(&bufferDesc);
|
mStorageBuffer512 = device.CreateBuffer(&bufferDesc);
|
||||||
|
|
||||||
// Put them all in a bind group for tests to bind them easily.
|
// Put them all in a bind group for tests to bind them easily.
|
||||||
dawn::ShaderStageBit kAllStages = dawn::ShaderStageBit::Fragment |
|
dawn::ShaderStage kAllStages =
|
||||||
dawn::ShaderStageBit::Vertex |
|
dawn::ShaderStage::Fragment | dawn::ShaderStage::Vertex | dawn::ShaderStage::Compute;
|
||||||
dawn::ShaderStageBit::Compute;
|
|
||||||
mBindGroupLayout =
|
mBindGroupLayout =
|
||||||
utils::MakeBindGroupLayout(device, {{0, kAllStages, dawn::BindingType::StorageBuffer},
|
utils::MakeBindGroupLayout(device, {{0, kAllStages, dawn::BindingType::StorageBuffer},
|
||||||
{1, kAllStages, dawn::BindingType::StorageBuffer},
|
{1, kAllStages, dawn::BindingType::StorageBuffer},
|
||||||
|
@ -100,7 +99,7 @@ TEST_P(OpArrayLengthTest, Compute) {
|
||||||
dawn::Buffer resultBuffer = device.CreateBuffer(&bufferDesc);
|
dawn::Buffer resultBuffer = device.CreateBuffer(&bufferDesc);
|
||||||
|
|
||||||
dawn::BindGroupLayout resultLayout = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout resultLayout = utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer}});
|
device, {{0, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer}});
|
||||||
|
|
||||||
dawn::BindGroup resultBindGroup =
|
dawn::BindGroup resultBindGroup =
|
||||||
utils::MakeBindGroup(device, resultLayout, {{0, resultBuffer, 0, dawn::kWholeSize}});
|
utils::MakeBindGroup(device, resultLayout, {{0, resultBuffer, 0, dawn::kWholeSize}});
|
||||||
|
@ -114,7 +113,7 @@ TEST_P(OpArrayLengthTest, Compute) {
|
||||||
|
|
||||||
dawn::PipelineStageDescriptor computeStage;
|
dawn::PipelineStageDescriptor computeStage;
|
||||||
computeStage.entryPoint = "main";
|
computeStage.entryPoint = "main";
|
||||||
computeStage.module = utils::CreateShaderModule(device, utils::ShaderStage::Compute,
|
computeStage.module = utils::CreateShaderModule(device, utils::SingleShaderStage::Compute,
|
||||||
(R"(#version 450
|
(R"(#version 450
|
||||||
layout(std430, set = 1, binding = 0) buffer ResultBuffer {
|
layout(std430, set = 1, binding = 0) buffer ResultBuffer {
|
||||||
uint result[3];
|
uint result[3];
|
||||||
|
@ -157,15 +156,17 @@ TEST_P(OpArrayLengthTest, Fragment) {
|
||||||
|
|
||||||
// Create the pipeline that computes the length of the buffers and writes it to the only render
|
// Create the pipeline that computes the length of the buffers and writes it to the only render
|
||||||
// pass pixel.
|
// pass pixel.
|
||||||
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
dawn::ShaderModule vsModule =
|
||||||
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
gl_PointSize = 1.0;
|
gl_PointSize = 1.0;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment,
|
dawn::ShaderModule fsModule =
|
||||||
(R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment,
|
||||||
|
(R"(
|
||||||
#version 450
|
#version 450
|
||||||
)" + mShaderInterface + R"(
|
)" + mShaderInterface + R"(
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
@ -175,7 +176,7 @@ TEST_P(OpArrayLengthTest, Fragment) {
|
||||||
fragColor.b = buffer3.data.length() / 255.0f;
|
fragColor.b = buffer3.data.length() / 255.0f;
|
||||||
fragColor.a = 0.0f;
|
fragColor.a = 0.0f;
|
||||||
})")
|
})")
|
||||||
.c_str());
|
.c_str());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||||
descriptor.cVertexStage.module = vsModule;
|
descriptor.cVertexStage.module = vsModule;
|
||||||
|
@ -212,8 +213,9 @@ TEST_P(OpArrayLengthTest, Vertex) {
|
||||||
|
|
||||||
// Create the pipeline that computes the length of the buffers and writes it to the only render
|
// Create the pipeline that computes the length of the buffers and writes it to the only render
|
||||||
// pass pixel.
|
// pass pixel.
|
||||||
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex,
|
dawn::ShaderModule vsModule =
|
||||||
(R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex,
|
||||||
|
(R"(
|
||||||
#version 450
|
#version 450
|
||||||
)" + mShaderInterface + R"(
|
)" + mShaderInterface + R"(
|
||||||
layout(location = 0) out vec4 pointColor;
|
layout(location = 0) out vec4 pointColor;
|
||||||
|
@ -226,10 +228,10 @@ TEST_P(OpArrayLengthTest, Vertex) {
|
||||||
gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
gl_PointSize = 1.0;
|
gl_PointSize = 1.0;
|
||||||
})")
|
})")
|
||||||
.c_str());
|
.c_str());
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
layout(location = 0) in vec4 pointColor;
|
layout(location = 0) in vec4 pointColor;
|
||||||
|
|
|
@ -150,7 +150,7 @@ class PrimitiveTopologyTest : public DawnTest {
|
||||||
|
|
||||||
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
||||||
vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec4 pos;
|
layout(location = 0) in vec4 pos;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -158,7 +158,7 @@ class PrimitiveTopologyTest : public DawnTest {
|
||||||
gl_PointSize = 1.0;
|
gl_PointSize = 1.0;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -32,7 +32,7 @@ class RenderBundleTest : public DawnTest {
|
||||||
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec4 pos;
|
layout(location = 0) in vec4 pos;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -40,7 +40,7 @@ class RenderBundleTest : public DawnTest {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
layout (set = 0, binding = 0) uniform fragmentUniformBuffer {
|
layout (set = 0, binding = 0) uniform fragmentUniformBuffer {
|
||||||
|
@ -51,7 +51,7 @@ class RenderBundleTest : public DawnTest {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
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,
|
float colors0[] = {kColors[0].r / 255.f, kColors[0].g / 255.f, kColors[0].b / 255.f,
|
||||||
kColors[0].a / 255.f};
|
kColors[0].a / 255.f};
|
||||||
|
|
|
@ -26,8 +26,10 @@ class DrawQuad {
|
||||||
DrawQuad() {}
|
DrawQuad() {}
|
||||||
DrawQuad(dawn::Device device, const char* vsSource, const char* fsSource)
|
DrawQuad(dawn::Device device, const char* vsSource, const char* fsSource)
|
||||||
: device(device) {
|
: device(device) {
|
||||||
vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vsSource);
|
vsModule =
|
||||||
fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fsSource);
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vsSource);
|
||||||
|
fsModule =
|
||||||
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fsSource);
|
||||||
|
|
||||||
pipelineLayout = utils::MakeBasicPipelineLayout(device, nullptr);
|
pipelineLayout = utils::MakeBasicPipelineLayout(device, nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ protected:
|
||||||
|
|
||||||
// Shaders to draw a bottom-left triangle in blue.
|
// Shaders to draw a bottom-left triangle in blue.
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
const vec2 pos[3] = vec2[3](
|
const vec2 pos[3] = vec2[3](
|
||||||
|
@ -36,7 +36,7 @@ protected:
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -44,13 +44,13 @@ protected:
|
||||||
|
|
||||||
mBindGroupLayout = utils::MakeBindGroupLayout(
|
mBindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
|
{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
|
||||||
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture},
|
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture},
|
||||||
});
|
});
|
||||||
|
|
||||||
auto pipelineLayout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
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
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
const vec2 pos[6] = vec2[6](vec2(-2.f, -2.f),
|
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);
|
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
|
#version 450
|
||||||
layout(set = 0, binding = 0) uniform sampler sampler0;
|
layout(set = 0, binding = 0) uniform sampler sampler0;
|
||||||
layout(set = 0, binding = 1) uniform texture2D texture0;
|
layout(set = 0, binding = 1) uniform texture2D texture0;
|
||||||
|
|
|
@ -21,7 +21,7 @@ class ScissorTest: public DawnTest {
|
||||||
protected:
|
protected:
|
||||||
dawn::RenderPipeline CreateQuadPipeline(dawn::TextureFormat format) {
|
dawn::RenderPipeline CreateQuadPipeline(dawn::TextureFormat format) {
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
const vec2 pos[6] = vec2[6](
|
const vec2 pos[6] = vec2[6](
|
||||||
vec2(-1.0f, -1.0f), vec2(-1.0f, 1.0f), vec2(1.0f, -1.0f),
|
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 =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -174,7 +174,7 @@ class TextureFormatTest : public DawnTest {
|
||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
utils::ComboRenderPipelineDescriptor desc(device);
|
||||||
|
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
const vec2 pos[3] = vec2[3](
|
const vec2 pos[3] = vec2[3](
|
||||||
|
@ -213,8 +213,8 @@ class TextureFormatTest : public DawnTest {
|
||||||
<< "sampler2D(myTexture, mySampler), ivec2(gl_FragCoord), 0);\n";
|
<< "sampler2D(myTexture, mySampler), ivec2(gl_FragCoord), 0);\n";
|
||||||
fsSource << "}";
|
fsSource << "}";
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule = utils::CreateShaderModule(
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fsSource.str().c_str());
|
device, utils::SingleShaderStage::Fragment, fsSource.str().c_str());
|
||||||
|
|
||||||
desc.cVertexStage.module = vsModule;
|
desc.cVertexStage.module = vsModule;
|
||||||
desc.cFragmentStage.module = fsModule;
|
desc.cFragmentStage.module = fsModule;
|
||||||
|
@ -271,8 +271,8 @@ class TextureFormatTest : public DawnTest {
|
||||||
|
|
||||||
// Create the bind group layout for sampling the texture
|
// Create the bind group layout for sampling the texture
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
|
||||||
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture, false,
|
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture, false,
|
||||||
false, sampleFormatInfo.type}});
|
false, sampleFormatInfo.type}});
|
||||||
|
|
||||||
// Prepare objects needed to sample from texture in the renderpass
|
// Prepare objects needed to sample from texture in the renderpass
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
dawn::ShaderModule CreateDefaultVertexShaderModule(dawn::Device device) {
|
dawn::ShaderModule CreateDefaultVertexShaderModule(dawn::Device device) {
|
||||||
return utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
return utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout (location = 0) out vec2 o_texCoord;
|
layout (location = 0) out vec2 o_texCoord;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -85,9 +85,9 @@ protected:
|
||||||
|
|
||||||
mBindGroupLayout = utils::MakeBindGroupLayout(
|
mBindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
|
{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
|
||||||
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture},
|
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture},
|
||||||
});
|
});
|
||||||
|
|
||||||
dawn::FilterMode kFilterMode = dawn::FilterMode::Nearest;
|
dawn::FilterMode kFilterMode = dawn::FilterMode::Nearest;
|
||||||
dawn::AddressMode kAddressMode = dawn::AddressMode::ClampToEdge;
|
dawn::AddressMode kAddressMode = dawn::AddressMode::ClampToEdge;
|
||||||
|
@ -164,7 +164,7 @@ protected:
|
||||||
});
|
});
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fragmentShader);
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fragmentShader);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
|
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
|
||||||
textureDescriptor.cVertexStage.module = mVSModule;
|
textureDescriptor.cVertexStage.module = mVSModule;
|
||||||
|
@ -501,8 +501,8 @@ class TextureViewRenderingTest : public DawnTest {
|
||||||
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
dawn::ShaderModule oneColorFsModule =
|
dawn::ShaderModule oneColorFsModule = utils::CreateShaderModule(
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, oneColorFragmentShader);
|
device, utils::SingleShaderStage::Fragment, oneColorFragmentShader);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||||
pipelineDescriptor.cVertexStage.module = vsModule;
|
pipelineDescriptor.cVertexStage.module = vsModule;
|
||||||
|
|
|
@ -65,7 +65,7 @@ class TextureZeroInitTest : public DawnTest {
|
||||||
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
|
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
|
||||||
})";
|
})";
|
||||||
pipelineDescriptor.cVertexStage.module =
|
pipelineDescriptor.cVertexStage.module =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vs);
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
|
||||||
|
|
||||||
const char* fs =
|
const char* fs =
|
||||||
R"(#version 450
|
R"(#version 450
|
||||||
|
@ -74,7 +74,7 @@ class TextureZeroInitTest : public DawnTest {
|
||||||
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||||
})";
|
})";
|
||||||
pipelineDescriptor.cFragmentStage.module =
|
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.depthCompare = dawn::CompareFunction::Equal;
|
||||||
pipelineDescriptor.cDepthStencilState.stencilFront.compare = 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::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||||
|
|
||||||
dawn::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
|
||||||
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture}});
|
{1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture}});
|
||||||
|
|
||||||
// Create render pipeline
|
// Create render pipeline
|
||||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||||
renderPipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bindGroupLayout);
|
renderPipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bindGroupLayout);
|
||||||
renderPipelineDescriptor.cVertexStage.module =
|
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),
|
const vec2 pos[6] = vec2[6](vec2(-1.0f, -1.0f),
|
||||||
vec2(-1.0f, 1.0f),
|
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);
|
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
renderPipelineDescriptor.cFragmentStage.module =
|
renderPipelineDescriptor.cFragmentStage.module =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment,
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment,
|
||||||
R"(#version 450
|
R"(#version 450
|
||||||
layout(set = 0, binding = 0) uniform sampler sampler0;
|
layout(set = 0, binding = 0) uniform sampler sampler0;
|
||||||
layout(set = 0, binding = 1) uniform texture2D texture0;
|
layout(set = 0, binding = 1) uniform texture2D texture0;
|
||||||
|
@ -512,9 +512,9 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
|
||||||
dawn::Sampler sampler = device.CreateSampler(&samplerDesc);
|
dawn::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||||
|
|
||||||
dawn::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Compute, dawn::BindingType::SampledTexture},
|
device, {{0, dawn::ShaderStage::Compute, dawn::BindingType::SampledTexture},
|
||||||
{1, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer},
|
{1, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer},
|
||||||
{2, dawn::ShaderStageBit::Compute, dawn::BindingType::Sampler}});
|
{2, dawn::ShaderStage::Compute, dawn::BindingType::Sampler}});
|
||||||
|
|
||||||
// Create compute pipeline
|
// Create compute pipeline
|
||||||
dawn::ComputePipelineDescriptor computePipelineDescriptor;
|
dawn::ComputePipelineDescriptor computePipelineDescriptor;
|
||||||
|
@ -531,7 +531,7 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
|
||||||
bufferTex.result =
|
bufferTex.result =
|
||||||
texelFetch(sampler2D(sampleTex, sampler0), ivec2(0,0), 0);
|
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";
|
computeStage.entryPoint = "main";
|
||||||
computePipelineDescriptor.computeStage = &computeStage;
|
computePipelineDescriptor.computeStage = &computeStage;
|
||||||
dawn::ComputePipeline computePipeline =
|
dawn::ComputePipeline computePipeline =
|
||||||
|
|
|
@ -341,10 +341,10 @@ class VertexFormatTest : public DawnTest {
|
||||||
vs << "}\n";
|
vs << "}\n";
|
||||||
|
|
||||||
dawn::ShaderModule vsModule =
|
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 =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec4 color;
|
layout(location = 0) in vec4 color;
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
|
|
@ -117,9 +117,9 @@ class VertexInputTest : public DawnTest {
|
||||||
vs << "}\n";
|
vs << "}\n";
|
||||||
|
|
||||||
dawn::ShaderModule vsModule =
|
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 =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec4 color;
|
layout(location = 0) in vec4 color;
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
|
|
@ -23,7 +23,8 @@ class ViewportOrientationTests : public DawnTest {};
|
||||||
TEST_P(ViewportOrientationTests, OriginAt0x0) {
|
TEST_P(ViewportOrientationTests, OriginAt0x0) {
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 2, 2);
|
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
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = vec4(-0.5f, -0.5f, 0.0f, 1.0f);
|
gl_Position = vec4(-0.5f, -0.5f, 0.0f, 1.0f);
|
||||||
|
@ -31,7 +32,7 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -45,7 +45,7 @@ class ViewportTest : public DawnTest {
|
||||||
}
|
}
|
||||||
})";
|
})";
|
||||||
pipelineDescriptor.cVertexStage.module =
|
pipelineDescriptor.cVertexStage.module =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vs);
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
|
||||||
|
|
||||||
const char* fs =
|
const char* fs =
|
||||||
R"(#version 450
|
R"(#version 450
|
||||||
|
@ -55,7 +55,7 @@ class ViewportTest : public DawnTest {
|
||||||
fragColor = color;
|
fragColor = color;
|
||||||
})";
|
})";
|
||||||
pipelineDescriptor.cFragmentStage.module =
|
pipelineDescriptor.cFragmentStage.module =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, fs);
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs);
|
||||||
|
|
||||||
pipelineDescriptor.cDepthStencilState.depthCompare = depthCompare;
|
pipelineDescriptor.cDepthStencilState.depthCompare = depthCompare;
|
||||||
pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;
|
pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;
|
||||||
|
|
|
@ -20,9 +20,9 @@ using namespace dawn_native;
|
||||||
|
|
||||||
// Tests for StageBit
|
// Tests for StageBit
|
||||||
TEST(PerStage, StageBit) {
|
TEST(PerStage, StageBit) {
|
||||||
ASSERT_EQ(StageBit(ShaderStage::Vertex), dawn::ShaderStageBit::Vertex);
|
ASSERT_EQ(StageBit(SingleShaderStage::Vertex), dawn::ShaderStage::Vertex);
|
||||||
ASSERT_EQ(StageBit(ShaderStage::Fragment), dawn::ShaderStageBit::Fragment);
|
ASSERT_EQ(StageBit(SingleShaderStage::Fragment), dawn::ShaderStage::Fragment);
|
||||||
ASSERT_EQ(StageBit(ShaderStage::Compute), dawn::ShaderStageBit::Compute);
|
ASSERT_EQ(StageBit(SingleShaderStage::Compute), dawn::ShaderStage::Compute);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basic test for the PerStage container
|
// Basic test for the PerStage container
|
||||||
|
@ -30,60 +30,60 @@ TEST(PerStage, PerStage) {
|
||||||
PerStage<int> data;
|
PerStage<int> data;
|
||||||
|
|
||||||
// Store data using dawn::ShaderStage
|
// Store data using dawn::ShaderStage
|
||||||
data[ShaderStage::Vertex] = 42;
|
data[SingleShaderStage::Vertex] = 42;
|
||||||
data[ShaderStage::Fragment] = 3;
|
data[SingleShaderStage::Fragment] = 3;
|
||||||
data[ShaderStage::Compute] = -1;
|
data[SingleShaderStage::Compute] = -1;
|
||||||
|
|
||||||
// Load it using dawn::ShaderStageBit
|
// Load it using dawn::ShaderStage
|
||||||
ASSERT_EQ(data[dawn::ShaderStageBit::Vertex], 42);
|
ASSERT_EQ(data[dawn::ShaderStage::Vertex], 42);
|
||||||
ASSERT_EQ(data[dawn::ShaderStageBit::Fragment], 3);
|
ASSERT_EQ(data[dawn::ShaderStage::Fragment], 3);
|
||||||
ASSERT_EQ(data[dawn::ShaderStageBit::Compute], -1);
|
ASSERT_EQ(data[dawn::ShaderStage::Compute], -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test IterateStages with kAllStages
|
// Test IterateStages with kAllStages
|
||||||
TEST(PerStage, IterateAllStages) {
|
TEST(PerStage, IterateAllStages) {
|
||||||
PerStage<int> counts;
|
PerStage<int> counts;
|
||||||
counts[ShaderStage::Vertex] = 0;
|
counts[SingleShaderStage::Vertex] = 0;
|
||||||
counts[ShaderStage::Fragment] = 0;
|
counts[SingleShaderStage::Fragment] = 0;
|
||||||
counts[ShaderStage::Compute] = 0;
|
counts[SingleShaderStage::Compute] = 0;
|
||||||
|
|
||||||
for (auto stage : IterateStages(kAllStages)) {
|
for (auto stage : IterateStages(kAllStages)) {
|
||||||
counts[stage] ++;
|
counts[stage] ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EQ(counts[dawn::ShaderStageBit::Vertex], 1);
|
ASSERT_EQ(counts[dawn::ShaderStage::Vertex], 1);
|
||||||
ASSERT_EQ(counts[dawn::ShaderStageBit::Fragment], 1);
|
ASSERT_EQ(counts[dawn::ShaderStage::Fragment], 1);
|
||||||
ASSERT_EQ(counts[dawn::ShaderStageBit::Compute], 1);
|
ASSERT_EQ(counts[dawn::ShaderStage::Compute], 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test IterateStages with one stage
|
// Test IterateStages with one stage
|
||||||
TEST(PerStage, IterateOneStage) {
|
TEST(PerStage, IterateOneStage) {
|
||||||
PerStage<int> counts;
|
PerStage<int> counts;
|
||||||
counts[ShaderStage::Vertex] = 0;
|
counts[SingleShaderStage::Vertex] = 0;
|
||||||
counts[ShaderStage::Fragment] = 0;
|
counts[SingleShaderStage::Fragment] = 0;
|
||||||
counts[ShaderStage::Compute] = 0;
|
counts[SingleShaderStage::Compute] = 0;
|
||||||
|
|
||||||
for (auto stage : IterateStages(dawn::ShaderStageBit::Fragment)) {
|
for (auto stage : IterateStages(dawn::ShaderStage::Fragment)) {
|
||||||
counts[stage] ++;
|
counts[stage] ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EQ(counts[dawn::ShaderStageBit::Vertex], 0);
|
ASSERT_EQ(counts[dawn::ShaderStage::Vertex], 0);
|
||||||
ASSERT_EQ(counts[dawn::ShaderStageBit::Fragment], 1);
|
ASSERT_EQ(counts[dawn::ShaderStage::Fragment], 1);
|
||||||
ASSERT_EQ(counts[dawn::ShaderStageBit::Compute], 0);
|
ASSERT_EQ(counts[dawn::ShaderStage::Compute], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test IterateStages with no stage
|
// Test IterateStages with no stage
|
||||||
TEST(PerStage, IterateNoStages) {
|
TEST(PerStage, IterateNoStages) {
|
||||||
PerStage<int> counts;
|
PerStage<int> counts;
|
||||||
counts[ShaderStage::Vertex] = 0;
|
counts[SingleShaderStage::Vertex] = 0;
|
||||||
counts[ShaderStage::Fragment] = 0;
|
counts[SingleShaderStage::Fragment] = 0;
|
||||||
counts[ShaderStage::Compute] = 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] ++;
|
counts[stage] ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EQ(counts[dawn::ShaderStageBit::Vertex], 0);
|
ASSERT_EQ(counts[dawn::ShaderStage::Vertex], 0);
|
||||||
ASSERT_EQ(counts[dawn::ShaderStageBit::Fragment], 0);
|
ASSERT_EQ(counts[dawn::ShaderStage::Fragment], 0);
|
||||||
ASSERT_EQ(counts[dawn::ShaderStageBit::Compute], 0);
|
ASSERT_EQ(counts[dawn::ShaderStage::Compute], 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,8 @@ TEST_F(BindGroupValidationTest, NextInChainNullptr) {
|
||||||
|
|
||||||
// Check constraints on bindingCount
|
// Check constraints on bindingCount
|
||||||
TEST_F(BindGroupValidationTest, bindingCountMismatch) {
|
TEST_F(BindGroupValidationTest, bindingCountMismatch) {
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler}
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler}});
|
||||||
});
|
|
||||||
|
|
||||||
// Control case: check that a descriptor with one binding is ok
|
// Control case: check that a descriptor with one binding is ok
|
||||||
utils::MakeBindGroup(device, layout, {{0, mSampler}});
|
utils::MakeBindGroup(device, layout, {{0, mSampler}});
|
||||||
|
@ -93,9 +92,8 @@ TEST_F(BindGroupValidationTest, bindingCountMismatch) {
|
||||||
|
|
||||||
// Check constraints on BindGroupBinding::binding
|
// Check constraints on BindGroupBinding::binding
|
||||||
TEST_F(BindGroupValidationTest, WrongBindings) {
|
TEST_F(BindGroupValidationTest, WrongBindings) {
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler}
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler}});
|
||||||
});
|
|
||||||
|
|
||||||
// Control case: check that a descriptor with a binding matching the layout's is ok
|
// Control case: check that a descriptor with a binding matching the layout's is ok
|
||||||
utils::MakeBindGroup(device, layout, {{0, mSampler}});
|
utils::MakeBindGroup(device, layout, {{0, mSampler}});
|
||||||
|
@ -109,10 +107,9 @@ TEST_F(BindGroupValidationTest, WrongBindings) {
|
||||||
|
|
||||||
// Check that the same binding cannot be set twice
|
// Check that the same binding cannot be set twice
|
||||||
TEST_F(BindGroupValidationTest, BindingSetTwice) {
|
TEST_F(BindGroupValidationTest, BindingSetTwice) {
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler},
|
||||||
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler}
|
{1, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler}});
|
||||||
});
|
|
||||||
|
|
||||||
// Control case: check that different bindings work
|
// Control case: check that different bindings work
|
||||||
utils::MakeBindGroup(device, layout, {
|
utils::MakeBindGroup(device, layout, {
|
||||||
|
@ -129,9 +126,8 @@ TEST_F(BindGroupValidationTest, BindingSetTwice) {
|
||||||
|
|
||||||
// Check that a sampler binding must contain exactly one sampler
|
// Check that a sampler binding must contain exactly one sampler
|
||||||
TEST_F(BindGroupValidationTest, SamplerBindingType) {
|
TEST_F(BindGroupValidationTest, SamplerBindingType) {
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler}
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler}});
|
||||||
});
|
|
||||||
|
|
||||||
dawn::BindGroupBinding binding;
|
dawn::BindGroupBinding binding;
|
||||||
binding.binding = 0;
|
binding.binding = 0;
|
||||||
|
@ -179,9 +175,8 @@ TEST_F(BindGroupValidationTest, SamplerBindingType) {
|
||||||
|
|
||||||
// Check that a texture binding must contain exactly a texture view
|
// Check that a texture binding must contain exactly a texture view
|
||||||
TEST_F(BindGroupValidationTest, TextureBindingType) {
|
TEST_F(BindGroupValidationTest, TextureBindingType) {
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture}
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture}});
|
||||||
});
|
|
||||||
|
|
||||||
dawn::BindGroupBinding binding;
|
dawn::BindGroupBinding binding;
|
||||||
binding.binding = 0;
|
binding.binding = 0;
|
||||||
|
@ -234,9 +229,8 @@ TEST_F(BindGroupValidationTest, TextureBindingType) {
|
||||||
|
|
||||||
// Check that a buffer binding must contain exactly a buffer
|
// Check that a buffer binding must contain exactly a buffer
|
||||||
TEST_F(BindGroupValidationTest, BufferBindingType) {
|
TEST_F(BindGroupValidationTest, BufferBindingType) {
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}});
|
||||||
});
|
|
||||||
|
|
||||||
dawn::BindGroupBinding binding;
|
dawn::BindGroupBinding binding;
|
||||||
binding.binding = 0;
|
binding.binding = 0;
|
||||||
|
@ -285,9 +279,8 @@ TEST_F(BindGroupValidationTest, BufferBindingType) {
|
||||||
|
|
||||||
// Check that a texture must have the correct usage
|
// Check that a texture must have the correct usage
|
||||||
TEST_F(BindGroupValidationTest, TextureUsage) {
|
TEST_F(BindGroupValidationTest, TextureUsage) {
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture}
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture}});
|
||||||
});
|
|
||||||
|
|
||||||
// Control case: setting a sampleable texture view works.
|
// Control case: setting a sampleable texture view works.
|
||||||
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
|
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
|
||||||
|
@ -309,8 +302,8 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
|
||||||
// Check that a texture must have the correct component type
|
// Check that a texture must have the correct component type
|
||||||
TEST_F(BindGroupValidationTest, TextureComponentType) {
|
TEST_F(BindGroupValidationTest, TextureComponentType) {
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture, false,
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture, false, false,
|
||||||
false, dawn::TextureComponentType::Float}});
|
dawn::TextureComponentType::Float}});
|
||||||
|
|
||||||
// Control case: setting a Float typed texture view works.
|
// Control case: setting a Float typed texture view works.
|
||||||
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
|
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
|
||||||
|
@ -332,9 +325,8 @@ TEST_F(BindGroupValidationTest, TextureComponentType) {
|
||||||
|
|
||||||
// Check that a UBO must have the correct usage
|
// Check that a UBO must have the correct usage
|
||||||
TEST_F(BindGroupValidationTest, BufferUsageUBO) {
|
TEST_F(BindGroupValidationTest, BufferUsageUBO) {
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}});
|
||||||
});
|
|
||||||
|
|
||||||
// Control case: using a buffer with the uniform usage works
|
// Control case: using a buffer with the uniform usage works
|
||||||
utils::MakeBindGroup(device, layout, {{0, mUBO, 0, 256}});
|
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
|
// Check that a SSBO must have the correct usage
|
||||||
TEST_F(BindGroupValidationTest, BufferUsageSSBO) {
|
TEST_F(BindGroupValidationTest, BufferUsageSSBO) {
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::StorageBuffer}
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::StorageBuffer}});
|
||||||
});
|
|
||||||
|
|
||||||
// Control case: using a buffer with the storage usage works
|
// Control case: using a buffer with the storage usage works
|
||||||
utils::MakeBindGroup(device, layout, {{0, mSSBO, 0, 256}});
|
utils::MakeBindGroup(device, layout, {{0, mSSBO, 0, 256}});
|
||||||
|
@ -358,9 +349,10 @@ TEST_F(BindGroupValidationTest, BufferUsageSSBO) {
|
||||||
|
|
||||||
// Tests constraints on the buffer offset for bind groups.
|
// Tests constraints on the buffer offset for bind groups.
|
||||||
TEST_F(BindGroupValidationTest, BufferOffsetAlignment) {
|
TEST_F(BindGroupValidationTest, BufferOffsetAlignment) {
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
device, {
|
||||||
});
|
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
|
||||||
|
});
|
||||||
|
|
||||||
// Check that offset 0 is valid
|
// Check that offset 0 is valid
|
||||||
utils::MakeBindGroup(device, layout, {{0, mUBO, 0, 512}});
|
utils::MakeBindGroup(device, layout, {{0, mUBO, 0, 512}});
|
||||||
|
@ -376,9 +368,10 @@ TEST_F(BindGroupValidationTest, BufferOffsetAlignment) {
|
||||||
|
|
||||||
// Tests constraints to be sure the buffer binding fits in the buffer
|
// Tests constraints to be sure the buffer binding fits in the buffer
|
||||||
TEST_F(BindGroupValidationTest, BufferBindingOOB) {
|
TEST_F(BindGroupValidationTest, BufferBindingOOB) {
|
||||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {
|
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
device, {
|
||||||
});
|
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
|
||||||
|
});
|
||||||
|
|
||||||
dawn::BufferDescriptor descriptor;
|
dawn::BufferDescriptor descriptor;
|
||||||
descriptor.size = 1024;
|
descriptor.size = 1024;
|
||||||
|
@ -412,15 +405,18 @@ TEST_F(BindGroupValidationTest, BufferBindingOOB) {
|
||||||
|
|
||||||
// Test what happens when the layout is an error.
|
// Test what happens when the layout is an error.
|
||||||
TEST_F(BindGroupValidationTest, ErrorLayout) {
|
TEST_F(BindGroupValidationTest, ErrorLayout) {
|
||||||
dawn::BindGroupLayout goodLayout = utils::MakeBindGroupLayout(device, {
|
dawn::BindGroupLayout goodLayout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
device, {
|
||||||
});
|
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
|
||||||
|
});
|
||||||
|
|
||||||
dawn::BindGroupLayout errorLayout;
|
dawn::BindGroupLayout errorLayout;
|
||||||
ASSERT_DEVICE_ERROR(errorLayout = utils::MakeBindGroupLayout(device, {
|
ASSERT_DEVICE_ERROR(
|
||||||
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
errorLayout = utils::MakeBindGroupLayout(
|
||||||
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
device, {
|
||||||
}));
|
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
|
||||||
|
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
|
||||||
|
}));
|
||||||
|
|
||||||
// Control case, creating with the good layout works
|
// Control case, creating with the good layout works
|
||||||
utils::MakeBindGroup(device, goodLayout, {{0, mUBO, 0, 256}});
|
utils::MakeBindGroup(device, goodLayout, {{0, mUBO, 0, 256}});
|
||||||
|
@ -463,57 +459,56 @@ class BindGroupLayoutValidationTest : public ValidationTest {
|
||||||
// Tests setting OOB checks for kMaxBindingsPerGroup in bind group layouts.
|
// Tests setting OOB checks for kMaxBindingsPerGroup in bind group layouts.
|
||||||
TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutBindingOOB) {
|
TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutBindingOOB) {
|
||||||
// Checks that kMaxBindingsPerGroup - 1 is valid.
|
// Checks that kMaxBindingsPerGroup - 1 is valid.
|
||||||
utils::MakeBindGroupLayout(device, {
|
utils::MakeBindGroupLayout(device, {{kMaxBindingsPerGroup - 1, dawn::ShaderStage::Vertex,
|
||||||
{kMaxBindingsPerGroup - 1, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}
|
dawn::BindingType::UniformBuffer}});
|
||||||
});
|
|
||||||
|
|
||||||
// Checks that kMaxBindingsPerGroup is OOB
|
// Checks that kMaxBindingsPerGroup is OOB
|
||||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(device, {
|
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
|
||||||
{kMaxBindingsPerGroup, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}
|
device,
|
||||||
}));
|
{{kMaxBindingsPerGroup, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer}}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This test verifies that the BindGroupLayout bindings are correctly validated, even if the
|
// This test verifies that the BindGroupLayout bindings are correctly validated, even if the
|
||||||
// binding ids are out-of-order.
|
// binding ids are out-of-order.
|
||||||
TEST_F(BindGroupLayoutValidationTest, BindGroupBinding) {
|
TEST_F(BindGroupLayoutValidationTest, BindGroupBinding) {
|
||||||
utils::MakeBindGroupLayout(
|
utils::MakeBindGroupLayout(device,
|
||||||
device, {
|
{
|
||||||
{1, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
{1, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
|
||||||
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that dynamic = true is only allowed with buffer bindings.
|
// Check that dynamic = true is only allowed with buffer bindings.
|
||||||
TEST_F(BindGroupLayoutValidationTest, DynamicAndTypeCompatibility) {
|
TEST_F(BindGroupLayoutValidationTest, DynamicAndTypeCompatibility) {
|
||||||
utils::MakeBindGroupLayout(
|
utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::UniformBuffer, true},
|
{0, dawn::ShaderStage::Compute, dawn::BindingType::UniformBuffer, true},
|
||||||
});
|
});
|
||||||
|
|
||||||
utils::MakeBindGroupLayout(
|
utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer, true},
|
{0, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer, true},
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
|
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::SampledTexture, true},
|
{0, dawn::ShaderStage::Compute, dawn::BindingType::SampledTexture, true},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
|
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
|
||||||
device, {
|
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
|
// This test verifies that visibility of bindings in BindGroupLayout can't be none
|
||||||
TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutVisibilityNone) {
|
TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutVisibilityNone) {
|
||||||
utils::MakeBindGroupLayout(
|
utils::MakeBindGroupLayout(device,
|
||||||
device, {
|
{
|
||||||
{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer},
|
{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::BindingType::UniformBuffer};
|
||||||
dawn::BindGroupLayoutDescriptor descriptor;
|
dawn::BindGroupLayoutDescriptor descriptor;
|
||||||
descriptor.bindingCount = 1;
|
descriptor.bindingCount = 1;
|
||||||
|
@ -529,12 +524,12 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
|
||||||
|
|
||||||
for (uint32_t i = 0; i < kMaxDynamicUniformBufferCount; ++i) {
|
for (uint32_t i = 0; i < kMaxDynamicUniformBufferCount; ++i) {
|
||||||
maxUniformDB.push_back(
|
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) {
|
for (uint32_t i = 0; i < kMaxDynamicStorageBufferCount; ++i) {
|
||||||
maxStorageDB.push_back(
|
maxStorageDB.push_back(
|
||||||
{i, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer, true});
|
{i, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer, true});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto MakeBindGroupLayout = [&](dawn::BindGroupLayoutBinding* binding,
|
auto MakeBindGroupLayout = [&](dawn::BindGroupLayoutBinding* binding,
|
||||||
|
@ -557,7 +552,7 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
|
||||||
bgl[0] = MakeBindGroupLayout(maxUniformDB.data(), maxUniformDB.size());
|
bgl[0] = MakeBindGroupLayout(maxUniformDB.data(), maxUniformDB.size());
|
||||||
bgl[1] = utils::MakeBindGroupLayout(
|
bgl[1] = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::UniformBuffer, true},
|
{0, dawn::ShaderStage::Compute, dawn::BindingType::UniformBuffer, true},
|
||||||
});
|
});
|
||||||
|
|
||||||
TestCreatePipelineLayout(bgl, 2, false);
|
TestCreatePipelineLayout(bgl, 2, false);
|
||||||
|
@ -568,7 +563,7 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
|
||||||
bgl[0] = MakeBindGroupLayout(maxStorageDB.data(), maxStorageDB.size());
|
bgl[0] = MakeBindGroupLayout(maxStorageDB.data(), maxStorageDB.size());
|
||||||
bgl[1] = utils::MakeBindGroupLayout(
|
bgl[1] = utils::MakeBindGroupLayout(
|
||||||
device, {
|
device, {
|
||||||
{0, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer, true},
|
{0, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer, true},
|
||||||
});
|
});
|
||||||
|
|
||||||
TestCreatePipelineLayout(bgl, 2, false);
|
TestCreatePipelineLayout(bgl, 2, false);
|
||||||
|
@ -576,14 +571,14 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
|
||||||
|
|
||||||
// Check dynamic uniform buffers exceed maximum in bind group layout.
|
// 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});
|
dawn::BindingType::UniformBuffer, true});
|
||||||
TestCreateBindGroupLayout(maxUniformDB.data(), maxUniformDB.size(), false);
|
TestCreateBindGroupLayout(maxUniformDB.data(), maxUniformDB.size(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check dynamic storage buffers exceed maximum in bind group layout.
|
// 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});
|
dawn::BindingType::StorageBuffer, true});
|
||||||
TestCreateBindGroupLayout(maxStorageDB.data(), maxStorageDB.size(), false);
|
TestCreateBindGroupLayout(maxStorageDB.data(), maxStorageDB.size(), false);
|
||||||
}
|
}
|
||||||
|
@ -596,9 +591,9 @@ class SetBindGroupValidationTest : public ValidationTest {
|
||||||
public:
|
public:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
mBindGroupLayout = utils::MakeBindGroupLayout(
|
mBindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
|
device, {{0, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
|
||||||
dawn::BindingType::UniformBuffer, true},
|
dawn::BindingType::UniformBuffer, true},
|
||||||
{1, dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment,
|
{1, dawn::ShaderStage::Compute | dawn::ShaderStage::Fragment,
|
||||||
dawn::BindingType::StorageBuffer, true}});
|
dawn::BindingType::StorageBuffer, true}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,13 +611,13 @@ class SetBindGroupValidationTest : public ValidationTest {
|
||||||
|
|
||||||
dawn::RenderPipeline CreateRenderPipeline() {
|
dawn::RenderPipeline CreateRenderPipeline() {
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(std140, set = 0, binding = 0) uniform uBuffer {
|
layout(std140, set = 0, binding = 0) uniform uBuffer {
|
||||||
vec2 value1;
|
vec2 value1;
|
||||||
|
@ -645,7 +640,7 @@ class SetBindGroupValidationTest : public ValidationTest {
|
||||||
|
|
||||||
dawn::ComputePipeline CreateComputePipeline() {
|
dawn::ComputePipeline CreateComputePipeline() {
|
||||||
dawn::ShaderModule csModule =
|
dawn::ShaderModule csModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
|
||||||
#version 450
|
#version 450
|
||||||
const uint kTileSize = 4;
|
const uint kTileSize = 4;
|
||||||
const uint kInstances = 11;
|
const uint kInstances = 11;
|
||||||
|
|
|
@ -210,9 +210,8 @@ TEST_F(CommandBufferValidationTest, BufferWithReadAndWriteUsage) {
|
||||||
dawn::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
|
dawn::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
|
||||||
|
|
||||||
// Create the bind group to use the buffer as storage
|
// Create the bind group to use the buffer as storage
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(device, {{
|
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
0, dawn::ShaderStageBit::Vertex, dawn::BindingType::StorageBuffer
|
device, {{0, dawn::ShaderStage::Vertex, dawn::BindingType::StorageBuffer}});
|
||||||
}});
|
|
||||||
dawn::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, buffer, 0, 4}});
|
dawn::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, buffer, 0, 4}});
|
||||||
|
|
||||||
// Use the buffer as both index and storage in the same pass
|
// 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();
|
dawn::TextureView view = texture.CreateDefaultView();
|
||||||
|
|
||||||
// Create the bind group to use the texture as sampled
|
// Create the bind group to use the texture as sampled
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(device, {{
|
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
0, dawn::ShaderStageBit::Vertex, dawn::BindingType::SampledTexture
|
device, {{0, dawn::ShaderStage::Vertex, dawn::BindingType::SampledTexture}});
|
||||||
}});
|
|
||||||
dawn::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}});
|
dawn::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}});
|
||||||
|
|
||||||
// Create the render pass that will use the texture as an output attachment
|
// Create the render pass that will use the texture as an output attachment
|
||||||
|
|
|
@ -23,7 +23,7 @@ class ComputeIndirectValidationTest : public ValidationTest {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
dawn::ShaderModule computeModule =
|
dawn::ShaderModule computeModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Compute, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(local_size_x = 1) in;
|
layout(local_size_x = 1) in;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -24,14 +24,14 @@ class DrawIndirectValidationTest : public ValidationTest {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = vec4(0.0);
|
gl_Position = vec4(0.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace {
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) in vec2 pos;
|
layout(location = 0) in vec2 pos;
|
||||||
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
|
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
|
||||||
|
@ -36,7 +36,7 @@ namespace {
|
||||||
void main() {
|
void main() {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout (set = 1, binding = 0) uniform fragmentUniformBuffer {
|
layout (set = 1, binding = 0) uniform fragmentUniformBuffer {
|
||||||
vec4 color;
|
vec4 color;
|
||||||
|
@ -49,13 +49,12 @@ namespace {
|
||||||
|
|
||||||
dawn::BindGroupLayout bgls[] = {
|
dawn::BindGroupLayout bgls[] = {
|
||||||
utils::MakeBindGroupLayout(
|
utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}}),
|
device, {{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer}}),
|
||||||
utils::MakeBindGroupLayout(
|
utils::MakeBindGroupLayout(
|
||||||
device,
|
device, {
|
||||||
{
|
{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer},
|
||||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
|
{1, dawn::ShaderStage::Fragment, dawn::BindingType::StorageBuffer},
|
||||||
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::StorageBuffer},
|
})};
|
||||||
})};
|
|
||||||
|
|
||||||
dawn::PipelineLayoutDescriptor pipelineLayoutDesc = {};
|
dawn::PipelineLayoutDescriptor pipelineLayoutDesc = {};
|
||||||
pipelineLayoutDesc.bindGroupLayoutCount = 2;
|
pipelineLayoutDesc.bindGroupLayoutCount = 2;
|
||||||
|
|
|
@ -25,7 +25,8 @@ class RenderPassValidationTest : public ValidationTest {};
|
||||||
|
|
||||||
// Test that it is invalid to draw in a render pass with missing bind groups
|
// Test that it is invalid to draw in a render pass with missing bind groups
|
||||||
TEST_F(RenderPassValidationTest, MissingBindGroup) {
|
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
|
#version 450
|
||||||
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
|
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
|
||||||
mat2 transform;
|
mat2 transform;
|
||||||
|
@ -36,7 +37,7 @@ void main() {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout (set = 1, binding = 0) uniform fragmentUniformBuffer {
|
layout (set = 1, binding = 0) uniform fragmentUniformBuffer {
|
||||||
vec4 color;
|
vec4 color;
|
||||||
|
@ -48,9 +49,9 @@ void main() {
|
||||||
|
|
||||||
dawn::BindGroupLayout bgls[] = {
|
dawn::BindGroupLayout bgls[] = {
|
||||||
utils::MakeBindGroupLayout(
|
utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}}),
|
device, {{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer}}),
|
||||||
utils::MakeBindGroupLayout(
|
utils::MakeBindGroupLayout(
|
||||||
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}})};
|
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::UniformBuffer}})};
|
||||||
|
|
||||||
dawn::PipelineLayoutDescriptor pipelineLayoutDesc;
|
dawn::PipelineLayoutDescriptor pipelineLayoutDesc;
|
||||||
pipelineLayoutDesc.bindGroupLayoutCount = 2;
|
pipelineLayoutDesc.bindGroupLayoutCount = 2;
|
||||||
|
|
|
@ -23,13 +23,13 @@ class RenderPipelineValidationTest : public ValidationTest {
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
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
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -24,7 +24,7 @@ class VertexBufferValidationTest : public ValidationTest {
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
fsModule = utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -64,7 +64,8 @@ class VertexBufferValidationTest : public ValidationTest {
|
||||||
|
|
||||||
vs << "}\n";
|
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,
|
dawn::RenderPipeline MakeRenderPipeline(const dawn::ShaderModule& vsModule,
|
||||||
|
|
|
@ -22,10 +22,10 @@ class VertexInputTest : public ValidationTest {
|
||||||
void CreatePipeline(bool success,
|
void CreatePipeline(bool success,
|
||||||
const utils::ComboVertexInputDescriptor& state,
|
const utils::ComboVertexInputDescriptor& state,
|
||||||
std::string vertexSource) {
|
std::string vertexSource) {
|
||||||
dawn::ShaderModule vsModule =
|
dawn::ShaderModule vsModule = utils::CreateShaderModule(
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Vertex, vertexSource.c_str());
|
device, utils::SingleShaderStage::Vertex, vertexSource.c_str());
|
||||||
dawn::ShaderModule fsModule =
|
dawn::ShaderModule fsModule =
|
||||||
utils::CreateShaderModule(device, utils::ShaderStage::Fragment, R"(
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||||
#version 450
|
#version 450
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -332,13 +332,11 @@ TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) {
|
||||||
TEST_F(WireArgumentTests, StructureOfStructureArrayArgument) {
|
TEST_F(WireArgumentTests, StructureOfStructureArrayArgument) {
|
||||||
static constexpr int NUM_BINDINGS = 3;
|
static constexpr int NUM_BINDINGS = 3;
|
||||||
DawnBindGroupLayoutBinding bindings[NUM_BINDINGS]{
|
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},
|
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},
|
DAWN_TEXTURE_COMPONENT_TYPE_FLOAT},
|
||||||
{2,
|
{2, static_cast<DawnShaderStage>(DAWN_SHADER_STAGE_VERTEX | DAWN_SHADER_STAGE_FRAGMENT),
|
||||||
static_cast<DawnShaderStageBit>(DAWN_SHADER_STAGE_BIT_VERTEX |
|
|
||||||
DAWN_SHADER_STAGE_BIT_FRAGMENT),
|
|
||||||
DAWN_BINDING_TYPE_UNIFORM_BUFFER, false, false, DAWN_TEXTURE_COMPONENT_TYPE_FLOAT},
|
DAWN_BINDING_TYPE_UNIFORM_BUFFER, false, false, DAWN_TEXTURE_COMPONENT_TYPE_FLOAT},
|
||||||
};
|
};
|
||||||
DawnBindGroupLayoutDescriptor bglDescriptor;
|
DawnBindGroupLayoutDescriptor bglDescriptor;
|
||||||
|
|
|
@ -28,13 +28,13 @@ namespace utils {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
shaderc_shader_kind ShadercShaderKind(ShaderStage stage) {
|
shaderc_shader_kind ShadercShaderKind(SingleShaderStage stage) {
|
||||||
switch (stage) {
|
switch (stage) {
|
||||||
case ShaderStage::Vertex:
|
case SingleShaderStage::Vertex:
|
||||||
return shaderc_glsl_vertex_shader;
|
return shaderc_glsl_vertex_shader;
|
||||||
case ShaderStage::Fragment:
|
case SingleShaderStage::Fragment:
|
||||||
return shaderc_glsl_fragment_shader;
|
return shaderc_glsl_fragment_shader;
|
||||||
case ShaderStage::Compute:
|
case SingleShaderStage::Compute:
|
||||||
return shaderc_glsl_compute_shader;
|
return shaderc_glsl_compute_shader;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -60,7 +60,7 @@ namespace utils {
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
dawn::ShaderModule CreateShaderModule(const dawn::Device& device,
|
dawn::ShaderModule CreateShaderModule(const dawn::Device& device,
|
||||||
ShaderStage stage,
|
SingleShaderStage stage,
|
||||||
const char* source) {
|
const char* source) {
|
||||||
shaderc_shader_kind kind = ShadercShaderKind(stage);
|
shaderc_shader_kind kind = ShadercShaderKind(stage);
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ namespace utils {
|
||||||
dawn::BindGroupLayout MakeBindGroupLayout(
|
dawn::BindGroupLayout MakeBindGroupLayout(
|
||||||
const dawn::Device& device,
|
const dawn::Device& device,
|
||||||
std::initializer_list<dawn::BindGroupLayoutBinding> bindingsInitializer) {
|
std::initializer_list<dawn::BindGroupLayoutBinding> bindingsInitializer) {
|
||||||
constexpr dawn::ShaderStageBit kNoStages{};
|
constexpr dawn::ShaderStage kNoStages{};
|
||||||
|
|
||||||
std::vector<dawn::BindGroupLayoutBinding> bindings;
|
std::vector<dawn::BindGroupLayoutBinding> bindings;
|
||||||
for (const dawn::BindGroupLayoutBinding& binding : bindingsInitializer) {
|
for (const dawn::BindGroupLayoutBinding& binding : bindingsInitializer) {
|
||||||
|
|
|
@ -26,10 +26,10 @@ namespace utils {
|
||||||
|
|
||||||
enum Expectation { Success, Failure };
|
enum Expectation { Success, Failure };
|
||||||
|
|
||||||
enum class ShaderStage { Vertex, Fragment, Compute };
|
enum class SingleShaderStage { Vertex, Fragment, Compute };
|
||||||
|
|
||||||
dawn::ShaderModule CreateShaderModule(const dawn::Device& device,
|
dawn::ShaderModule CreateShaderModule(const dawn::Device& device,
|
||||||
ShaderStage stage,
|
SingleShaderStage stage,
|
||||||
const char* source);
|
const char* source);
|
||||||
dawn::ShaderModule CreateShaderModuleFromASM(const dawn::Device& device, const char* source);
|
dawn::ShaderModule CreateShaderModuleFromASM(const dawn::Device& device, const char* source);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue