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:
Yunchao He
2019-03-28 05:09:01 +00:00
committed by Commit Bot service account
parent 5f4bcbb946
commit 1ba2cb8589
14 changed files with 163 additions and 357 deletions

View File

@@ -111,17 +111,6 @@ void init() {
fragColor = texture(sampler2D(myTexture, mySampler), gl_FragCoord.xy / vec2(640.0, 480.0));
})");
dawn::VertexAttributeDescriptor attribute;
attribute.shaderLocation = 0;
attribute.inputSlot = 0;
attribute.offset = 0;
attribute.format = dawn::VertexFormat::Float4;
dawn::VertexInputDescriptor input;
input.inputSlot = 0;
input.stride = 4 * sizeof(float);
input.stepMode = dawn::InputStepMode::Vertex;
auto bgl = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
@@ -137,9 +126,9 @@ void init() {
descriptor.cVertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cInputState.numAttributes = 1;
descriptor.cInputState.attributes = &attribute;
descriptor.cInputState.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.cInputState.numInputs = 1;
descriptor.cInputState.inputs = &input;
descriptor.cInputState.cInputs[0].stride = 4 * sizeof(float);
descriptor.depthStencilState = &descriptor.cDepthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();