mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
Update naming for vertex state
- VertexInputDescriptor -> VertexStateDescriptor - VertexBufferDescriptor -> VertexBufferLayoutDescriptor - VertexBufferDescriptor.stride -> .arrayStride - VertexAttributeDescriptor.offset no longer optional gpuweb PR: https://github.com/gpuweb/gpuweb/pull/469 Bug: dawn:22 Change-Id: I5431df4ba22cfbdb1bc81e6709e562cd736892a3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13100 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
c3284fa40e
commit
ae1f25fee8
@@ -95,12 +95,12 @@ void init() {
|
||||
pl.bindGroupLayouts = nullptr;
|
||||
descriptor.layout = wgpuDeviceCreatePipelineLayout(device, &pl);
|
||||
|
||||
WGPUVertexInputDescriptor vertexInput;
|
||||
vertexInput.nextInChain = nullptr;
|
||||
vertexInput.indexFormat = WGPUIndexFormat_Uint32;
|
||||
vertexInput.bufferCount = 0;
|
||||
vertexInput.buffers = nullptr;
|
||||
descriptor.vertexInput = &vertexInput;
|
||||
WGPUVertexStateDescriptor vertexState;
|
||||
vertexState.nextInChain = nullptr;
|
||||
vertexState.indexFormat = WGPUIndexFormat_Uint32;
|
||||
vertexState.vertexBufferCount = 0;
|
||||
vertexState.vertexBuffers = nullptr;
|
||||
descriptor.vertexState = &vertexState;
|
||||
|
||||
WGPURasterizationStateDescriptor rasterizationState;
|
||||
rasterizationState.nextInChain = nullptr;
|
||||
|
||||
@@ -125,20 +125,20 @@ void initRender() {
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
|
||||
descriptor.cVertexInput.bufferCount = 2;
|
||||
descriptor.cVertexInput.cBuffers[0].stride = sizeof(Particle);
|
||||
descriptor.cVertexInput.cBuffers[0].stepMode = wgpu::InputStepMode::Instance;
|
||||
descriptor.cVertexInput.cBuffers[0].attributeCount = 2;
|
||||
descriptor.cVertexInput.cAttributes[0].offset = offsetof(Particle, pos);
|
||||
descriptor.cVertexInput.cAttributes[0].format = wgpu::VertexFormat::Float2;
|
||||
descriptor.cVertexInput.cAttributes[1].shaderLocation = 1;
|
||||
descriptor.cVertexInput.cAttributes[1].offset = offsetof(Particle, vel);
|
||||
descriptor.cVertexInput.cAttributes[1].format = wgpu::VertexFormat::Float2;
|
||||
descriptor.cVertexInput.cBuffers[1].stride = sizeof(glm::vec2);
|
||||
descriptor.cVertexInput.cBuffers[1].attributeCount = 1;
|
||||
descriptor.cVertexInput.cBuffers[1].attributes = &descriptor.cVertexInput.cAttributes[2];
|
||||
descriptor.cVertexInput.cAttributes[2].shaderLocation = 2;
|
||||
descriptor.cVertexInput.cAttributes[2].format = wgpu::VertexFormat::Float2;
|
||||
descriptor.cVertexState.vertexBufferCount = 2;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = sizeof(Particle);
|
||||
descriptor.cVertexState.cVertexBuffers[0].stepMode = wgpu::InputStepMode::Instance;
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 2;
|
||||
descriptor.cVertexState.cAttributes[0].offset = offsetof(Particle, pos);
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float2;
|
||||
descriptor.cVertexState.cAttributes[1].shaderLocation = 1;
|
||||
descriptor.cVertexState.cAttributes[1].offset = offsetof(Particle, vel);
|
||||
descriptor.cVertexState.cAttributes[1].format = wgpu::VertexFormat::Float2;
|
||||
descriptor.cVertexState.cVertexBuffers[1].arrayStride = sizeof(glm::vec2);
|
||||
descriptor.cVertexState.cVertexBuffers[1].attributeCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[1].attributes = &descriptor.cVertexState.cAttributes[2];
|
||||
descriptor.cVertexState.cAttributes[2].shaderLocation = 2;
|
||||
descriptor.cVertexState.cAttributes[2].format = wgpu::VertexFormat::Float2;
|
||||
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
||||
descriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
|
||||
|
||||
@@ -129,10 +129,10 @@ void init() {
|
||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.cVertexInput.bufferCount = 1;
|
||||
descriptor.cVertexInput.cBuffers[0].stride = 4 * sizeof(float);
|
||||
descriptor.cVertexInput.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexInput.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
|
||||
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
||||
descriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
|
||||
|
||||
@@ -160,15 +160,15 @@ void init() {
|
||||
fragColor = vec4(mix(f_col, vec3(0.5, 0.5, 0.5), 0.5), 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboVertexInputDescriptor vertexInput;
|
||||
vertexInput.cBuffers[0].attributeCount = 2;
|
||||
vertexInput.cAttributes[0].format = wgpu::VertexFormat::Float3;
|
||||
vertexInput.cAttributes[1].shaderLocation = 1;
|
||||
vertexInput.cAttributes[1].offset = 3 * sizeof(float);
|
||||
vertexInput.cAttributes[1].format = wgpu::VertexFormat::Float3;
|
||||
utils::ComboVertexStateDescriptor vertexState;
|
||||
vertexState.cVertexBuffers[0].attributeCount = 2;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float3;
|
||||
vertexState.cAttributes[1].shaderLocation = 1;
|
||||
vertexState.cAttributes[1].offset = 3 * sizeof(float);
|
||||
vertexState.cAttributes[1].format = wgpu::VertexFormat::Float3;
|
||||
|
||||
vertexInput.bufferCount = 1;
|
||||
vertexInput.cBuffers[0].stride = 6 * sizeof(float);
|
||||
vertexState.vertexBufferCount = 1;
|
||||
vertexState.cVertexBuffers[0].arrayStride = 6 * sizeof(float);
|
||||
|
||||
auto bgl = utils::MakeBindGroupLayout(
|
||||
device, {
|
||||
@@ -207,7 +207,7 @@ void init() {
|
||||
descriptor.layout = pl;
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.vertexInput = &vertexInput;
|
||||
descriptor.vertexState = &vertexState;
|
||||
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
||||
descriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
|
||||
@@ -220,7 +220,7 @@ void init() {
|
||||
pDescriptor.layout = pl;
|
||||
pDescriptor.vertexStage.module = vsModule;
|
||||
pDescriptor.cFragmentStage.module = fsModule;
|
||||
pDescriptor.vertexInput = &vertexInput;
|
||||
pDescriptor.vertexState = &vertexState;
|
||||
pDescriptor.depthStencilState = &pDescriptor.cDepthStencilState;
|
||||
pDescriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
pDescriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
|
||||
@@ -234,7 +234,7 @@ void init() {
|
||||
rfDescriptor.layout = pl;
|
||||
rfDescriptor.vertexStage.module = vsModule;
|
||||
rfDescriptor.cFragmentStage.module = fsReflectionModule;
|
||||
rfDescriptor.vertexInput = &vertexInput;
|
||||
rfDescriptor.vertexState = &vertexState;
|
||||
rfDescriptor.depthStencilState = &rfDescriptor.cDepthStencilState;
|
||||
rfDescriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
rfDescriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat();
|
||||
|
||||
Reference in New Issue
Block a user