mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +00:00
Construct ComboInputStateDescriptor to simplify tests and examples
Bug=dawn:107 Change-Id: I900de454cacf9f62ae97213161a98ce6d4254eab Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6020 Commit-Queue: Yunchao He <yunchao.he@intel.com> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
5f4bcbb946
commit
1ba2cb8589
@@ -18,6 +18,33 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
ComboInputStateDescriptor::ComboInputStateDescriptor() {
|
||||
dawn::InputStateDescriptor* descriptor = this;
|
||||
|
||||
// Fill the default values for vertexInput.
|
||||
descriptor->numInputs = 0;
|
||||
dawn::VertexInputDescriptor vertexInput;
|
||||
vertexInput.inputSlot = 0;
|
||||
vertexInput.stride = 0;
|
||||
vertexInput.stepMode = dawn::InputStepMode::Vertex;
|
||||
for (uint32_t i = 0; i < kMaxVertexInputs; ++i) {
|
||||
cInputs[i] = vertexInput;
|
||||
}
|
||||
descriptor->inputs = &cInputs[0];
|
||||
|
||||
// Fill the default values for vertexAttribute.
|
||||
descriptor->numAttributes = 0;
|
||||
dawn::VertexAttributeDescriptor vertexAttribute;
|
||||
vertexAttribute.shaderLocation = 0;
|
||||
vertexAttribute.inputSlot = 0;
|
||||
vertexAttribute.offset = 0;
|
||||
vertexAttribute.format = dawn::VertexFormat::Float;
|
||||
for (uint32_t i = 0; i < kMaxVertexAttributes; ++i) {
|
||||
cAttributes[i] = vertexAttribute;
|
||||
}
|
||||
descriptor->attributes = &cAttributes[0];
|
||||
}
|
||||
|
||||
ComboRenderPipelineDescriptor::ComboRenderPipelineDescriptor(const dawn::Device& device) {
|
||||
dawn::RenderPipelineDescriptor* descriptor = this;
|
||||
|
||||
@@ -38,13 +65,7 @@ namespace utils {
|
||||
}
|
||||
|
||||
// Set defaults for the input state descriptors.
|
||||
{
|
||||
descriptor->inputState = &cInputState;
|
||||
cInputState.numInputs = 0;
|
||||
cInputState.inputs = nullptr;
|
||||
cInputState.numAttributes = 0;
|
||||
cInputState.attributes = nullptr;
|
||||
}
|
||||
descriptor->inputState = &cInputState;
|
||||
|
||||
// Set defaults for the color state descriptors.
|
||||
{
|
||||
|
||||
@@ -23,6 +23,14 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
class ComboInputStateDescriptor : public dawn::InputStateDescriptor {
|
||||
public:
|
||||
ComboInputStateDescriptor();
|
||||
|
||||
std::array<dawn::VertexInputDescriptor, kMaxVertexInputs> cInputs;
|
||||
std::array<dawn::VertexAttributeDescriptor, kMaxVertexAttributes> cAttributes;
|
||||
};
|
||||
|
||||
class ComboRenderPipelineDescriptor : public dawn::RenderPipelineDescriptor {
|
||||
public:
|
||||
ComboRenderPipelineDescriptor(const dawn::Device& device);
|
||||
@@ -30,7 +38,7 @@ namespace utils {
|
||||
dawn::PipelineStageDescriptor cVertexStage;
|
||||
dawn::PipelineStageDescriptor cFragmentStage;
|
||||
|
||||
dawn::InputStateDescriptor cInputState;
|
||||
ComboInputStateDescriptor cInputState;
|
||||
std::array<dawn::ColorStateDescriptor*, kMaxColorAttachments> cColorStates;
|
||||
dawn::DepthStencilStateDescriptor cDepthStencilState;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user