Sitelet https://github.com/webatintel/aquarium/commit/6b6452150604b546db99837149d09db58eace8dd
Skip to content

Commit 6b64521

Browse files
committed
Rebase Dawn
1.Add Vulkan validation layers on Windows https://dawn-review.googlesource.com/c/dawn/+/11120 Vulkan validation layer is defaultly enabled on Windows, to disable Vulkan validation layer, pass args "dawn_enable_vulkan_validation_layers=false" 2.Update naming for vertex state gpuweb/gpuweb#469 https://dawn-review.googlesource.com/c/dawn/+/13100
1 parent edbc834 commit 6b64521

20 files changed

Lines changed: 294 additions & 254 deletions

‎DEPS‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ vars = {
88
'chromium_git': 'https://chromium.googlesource.com',
99
'github_git': 'https://github.com',
1010
'dawn_git': 'https://dawn.googlesource.com',
11-
'dawn_revision': '6df81ebf1dcf133c6bac7d2c208401b2c072b06d',
11+
'dawn_revision': '600a26d50a04d82cade2f52c79a2d7ad9e71b89b',
1212
'imgui_git': 'https://github.com/ocornut',
1313
'imgui_revision': 'e16564e67a2e88d4cbe3afa6594650712790fba3',
1414
'angle_root': 'third_party/angle',
@@ -22,6 +22,8 @@ vars = {
2222
'shaderc_revision': '65adcb504d024bb29f0ad8279b6a215d5f679832',
2323
'jsoncpp_revision': '571788934b5ee8643d53e5d054534abbe6006168',
2424
'jsoncpp_source_revision': '645250b6690785be60ab6780ce4b58698d884d11',
25+
'vulkan-headers_revision':'5b44df19e040fca0048ab30c553a8c2d2cb9623e',
26+
'vulkan-validation-layers_revision':'9fba37afae13a11bd49ae942bf82e5bf1098e381',
2527
}
2628

2729
deps = {
@@ -66,10 +68,10 @@ deps = {
6668
'third_party/angle': {
6769
'url': '{chromium_git}/angle/angle.git@{angle_revision}',
6870
},
69-
'third_party/spirv-tools': {
71+
'third_party/SPIRV-Tools': {
7072
'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Tools@{spirv_tools_revision}',
7173
},
72-
'third_party/spirv-headers': {
74+
'third_party/SPIRV-Headers': {
7375
'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Headers@{spirv_headers_revision}',
7476
},
7577
'third_party/imgui': {
@@ -87,6 +89,14 @@ deps = {
8789
'url' : '{chromium_git}/external/github.com/open-source-parsers/jsoncpp@{jsoncpp_source_revision}',
8890
'condition': 'dawn_standalone',
8991
},
92+
'third_party/vulkan-headers': {
93+
'url': '{chromium_git}/external/github.com/KhronosGroup/Vulkan-Headers@{vulkan-headers_revision}',
94+
'condition': 'dawn_standalone',
95+
},
96+
'third_party/vulkan-validation-layers': {
97+
'url': '{chromium_git}/external/github.com/KhronosGroup/Vulkan-ValidationLayers@{vulkan-validation-layers_revision}',
98+
'condition': 'dawn_standalone',
99+
},
90100
}
91101

92102
hooks = [

‎build_overrides/dawn.gni‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ dawn_jinja2_dir = "//third_party/dawn/third_party/jinja2"
99
dawn_googletest_dir = "//third_party/dawn/third_party/googletest"
1010
dawn_shaderc_dir = "//third_party/dawn/third_party/shaderc"
1111
dawn_spirv_cross_dir = "//third_party/dawn/third_party/spirv-cross"
12-
dawn_spirv_tools_dir = "//third_party/spirv-tools"
12+
dawn_spirv_tools_dir = "//third_party/SPIRV-Tools"
13+
dawn_vulkan_validation_layers_dir = "//third_party/vulkan-validation-layers"

‎build_overrides/glslang.gni‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
# found in the LICENSE file.
55
#
66

7-
glslang_spirv_tools_dir = "//third_party/spirv-tools"
7+
glslang_spirv_tools_dir = "//third_party/SPIRV-Tools"

‎build_overrides/shaderc.gni‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
#
66

77
shaderc_glslang_dir = "//third_party/glslang"
8-
shaderc_spirv_tools_dir = "//third_party/spirv-tools"
8+
shaderc_spirv_tools_dir = "//third_party/SPIRV-Tools"
99
shaderc_spirv_cross_dir = "//third_party/dawn/third_party/"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# Copyright (c) 2019 The Aquarium Project Authors. All rights reserved.
3+
# Use of this source code is governed by a BSD-style license that can be
4+
# found in the LICENSE file.
5+
#
6+
7+
vulkan_headers_dir = "//third_party/vulkan-headers"
8+
vvl_spirv_tools_dir = "//third_party/SPIRV-Tools"
9+
vvl_glslang_dir = "//third_party/glslang"
10+
11+
# Subdirectories for generated files
12+
vulkan_data_subdir = "vulkandata"
13+
vulkan_gen_subdir = ""
14+
15+

‎src/aquarium-optimized/dawn/ContextDawn.cpp‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ bool ContextDawn::initialize(
180180
glfwGetFramebufferSize(mWindow, &mClientWidth, &mClientHeight);
181181

182182
mInstance = std::make_unique<dawn_native::Instance>();
183+
184+
// Enable debug layer in Debug mode
185+
#if defined(_DEBUG)
186+
mInstance->EnableBackendValidation(true);
187+
#endif
188+
183189
utils::DiscoverAdapter(mInstance.get(), mWindow, backendType);
184190

185191
dawn_native::Adapter backendAdapter;
@@ -414,7 +420,7 @@ wgpu::PipelineLayout ContextDawn::MakeBasicPipelineLayout(
414420
wgpu::RenderPipeline ContextDawn::createRenderPipeline(
415421
wgpu::PipelineLayout mPipelineLayout,
416422
ProgramDawn *mProgramDawn,
417-
const wgpu::VertexInputDescriptor &mVertexInputDescriptor,
423+
const wgpu::VertexStateDescriptor &mVertexStateDescriptor,
418424
bool enableBlend) const
419425
{
420426
const wgpu::ShaderModule &mVsModule = mProgramDawn->getVSModule();
@@ -451,7 +457,7 @@ wgpu::RenderPipeline ContextDawn::createRenderPipeline(
451457
descriptor.layout = mPipelineLayout;
452458
descriptor.vertexStage.module = mVsModule;
453459
descriptor.cFragmentStage.module = mFsModule;
454-
descriptor.vertexInput = &mVertexInputDescriptor;
460+
descriptor.vertexState = &mVertexStateDescriptor;
455461
descriptor.depthStencilState = &descriptor.cDepthStencilState;
456462
descriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
457463
descriptor.colorStateCount = 1;

‎src/aquarium-optimized/dawn/ContextDawn.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class ContextDawn : public Context
8484
wgpu::RenderPipeline createRenderPipeline(
8585
wgpu::PipelineLayout mPipelineLayout,
8686
ProgramDawn *mProgramDawn,
87-
const wgpu::VertexInputDescriptor &mVertexInputDescriptor,
87+
const wgpu::VertexStateDescriptor &mVertexInputDescriptor,
8888
bool enableBlend) const;
8989
wgpu::TextureView createMultisampledRenderTargetView() const;
9090
wgpu::TextureView createDepthStencilView() const;

‎src/aquarium-optimized/dawn/FishModelDawn.cpp‎

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -50,38 +50,38 @@ void FishModelDawn::init()
5050
mBiNormalBuffer = static_cast<BufferDawn *>(bufferMap["binormal"]);
5151
mIndicesBuffer = static_cast<BufferDawn *>(bufferMap["indices"]);
5252

53-
mVertexInputDescriptor.cBuffers[0].attributeCount = 1;
54-
mVertexInputDescriptor.cBuffers[0].stride = mPositionBuffer->getDataSize();
55-
mVertexInputDescriptor.cAttributes[0].format = wgpu::VertexFormat::Float3;
56-
mVertexInputDescriptor.cAttributes[0].shaderLocation = 0;
57-
mVertexInputDescriptor.cAttributes[0].offset = 0;
58-
mVertexInputDescriptor.cBuffers[0].attributes = &mVertexInputDescriptor.cAttributes[0];
59-
mVertexInputDescriptor.cBuffers[1].attributeCount = 1;
60-
mVertexInputDescriptor.cBuffers[1].stride = mNormalBuffer->getDataSize();
61-
mVertexInputDescriptor.cAttributes[1].format = wgpu::VertexFormat::Float3;
62-
mVertexInputDescriptor.cAttributes[1].shaderLocation = 1;
63-
mVertexInputDescriptor.cAttributes[1].offset = 0;
64-
mVertexInputDescriptor.cBuffers[1].attributes = &mVertexInputDescriptor.cAttributes[1];
65-
mVertexInputDescriptor.cBuffers[2].attributeCount = 1;
66-
mVertexInputDescriptor.cBuffers[2].stride = mTexCoordBuffer->getDataSize();
67-
mVertexInputDescriptor.cAttributes[2].format = wgpu::VertexFormat::Float2;
68-
mVertexInputDescriptor.cAttributes[2].shaderLocation = 2;
69-
mVertexInputDescriptor.cAttributes[2].offset = 0;
70-
mVertexInputDescriptor.cBuffers[2].attributes = &mVertexInputDescriptor.cAttributes[2];
71-
mVertexInputDescriptor.cBuffers[3].attributeCount = 1;
72-
mVertexInputDescriptor.cBuffers[3].stride = mTangentBuffer->getDataSize();
73-
mVertexInputDescriptor.cAttributes[3].format = wgpu::VertexFormat::Float3;
74-
mVertexInputDescriptor.cAttributes[3].shaderLocation = 3;
75-
mVertexInputDescriptor.cAttributes[3].offset = 0;
76-
mVertexInputDescriptor.cBuffers[3].attributes = &mVertexInputDescriptor.cAttributes[3];
77-
mVertexInputDescriptor.cBuffers[4].attributeCount = 1;
78-
mVertexInputDescriptor.cBuffers[4].stride = mBiNormalBuffer->getDataSize();
79-
mVertexInputDescriptor.cAttributes[4].format = wgpu::VertexFormat::Float3;
80-
mVertexInputDescriptor.cAttributes[4].shaderLocation = 4;
81-
mVertexInputDescriptor.cAttributes[4].offset = 0;
82-
mVertexInputDescriptor.cBuffers[4].attributes = &mVertexInputDescriptor.cAttributes[4];
83-
mVertexInputDescriptor.bufferCount = 5;
84-
mVertexInputDescriptor.indexFormat = wgpu::IndexFormat::Uint16;
53+
mVertexStateDescriptor.cVertexBuffers[0].attributeCount = 1;
54+
mVertexStateDescriptor.cVertexBuffers[0].arrayStride = mPositionBuffer->getDataSize();
55+
mVertexStateDescriptor.cAttributes[0].format = wgpu::VertexFormat::Float3;
56+
mVertexStateDescriptor.cAttributes[0].shaderLocation = 0;
57+
mVertexStateDescriptor.cAttributes[0].offset = 0;
58+
mVertexStateDescriptor.cVertexBuffers[0].attributes = &mVertexStateDescriptor.cAttributes[0];
59+
mVertexStateDescriptor.cVertexBuffers[1].attributeCount = 1;
60+
mVertexStateDescriptor.cVertexBuffers[1].arrayStride = mNormalBuffer->getDataSize();
61+
mVertexStateDescriptor.cAttributes[1].format = wgpu::VertexFormat::Float3;
62+
mVertexStateDescriptor.cAttributes[1].shaderLocation = 1;
63+
mVertexStateDescriptor.cAttributes[1].offset = 0;
64+
mVertexStateDescriptor.cVertexBuffers[1].attributes = &mVertexStateDescriptor.cAttributes[1];
65+
mVertexStateDescriptor.cVertexBuffers[2].attributeCount = 1;
66+
mVertexStateDescriptor.cVertexBuffers[2].arrayStride = mTexCoordBuffer->getDataSize();
67+
mVertexStateDescriptor.cAttributes[2].format = wgpu::VertexFormat::Float2;
68+
mVertexStateDescriptor.cAttributes[2].shaderLocation = 2;
69+
mVertexStateDescriptor.cAttributes[2].offset = 0;
70+
mVertexStateDescriptor.cVertexBuffers[2].attributes = &mVertexStateDescriptor.cAttributes[2];
71+
mVertexStateDescriptor.cVertexBuffers[3].attributeCount = 1;
72+
mVertexStateDescriptor.cVertexBuffers[3].arrayStride = mTangentBuffer->getDataSize();
73+
mVertexStateDescriptor.cAttributes[3].format = wgpu::VertexFormat::Float3;
74+
mVertexStateDescriptor.cAttributes[3].shaderLocation = 3;
75+
mVertexStateDescriptor.cAttributes[3].offset = 0;
76+
mVertexStateDescriptor.cVertexBuffers[3].attributes = &mVertexStateDescriptor.cAttributes[3];
77+
mVertexStateDescriptor.cVertexBuffers[4].attributeCount = 1;
78+
mVertexStateDescriptor.cVertexBuffers[4].arrayStride = mBiNormalBuffer->getDataSize();
79+
mVertexStateDescriptor.cAttributes[4].format = wgpu::VertexFormat::Float3;
80+
mVertexStateDescriptor.cAttributes[4].shaderLocation = 4;
81+
mVertexStateDescriptor.cAttributes[4].offset = 0;
82+
mVertexStateDescriptor.cVertexBuffers[4].attributes = &mVertexStateDescriptor.cAttributes[4];
83+
mVertexStateDescriptor.vertexBufferCount = 5;
84+
mVertexStateDescriptor.indexFormat = wgpu::IndexFormat::Uint16;
8585

8686
if (mSkyboxTexture && mReflectionTexture)
8787
{
@@ -121,7 +121,7 @@ void FishModelDawn::init()
121121
});
122122

123123
mPipeline = mContextDawn->createRenderPipeline(mPipelineLayout, mProgramDawn,
124-
mVertexInputDescriptor, mBlend);
124+
mVertexStateDescriptor, mBlend);
125125

126126
mFishVertexBuffer =
127127
mContextDawn->createBufferFromData(&mFishVertexUniforms, sizeof(FishVertexUniforms),

‎src/aquarium-optimized/dawn/FishModelDawn.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class FishModelDawn : public FishModel
7070
BufferDawn *mIndicesBuffer;
7171

7272
private:
73-
utils::ComboVertexInputDescriptor mVertexInputDescriptor;
73+
utils::ComboVertexStateDescriptor mVertexStateDescriptor;
7474
wgpu::RenderPipeline mPipeline;
7575

7676
wgpu::BindGroupLayout mGroupLayoutModel;

‎src/aquarium-optimized/dawn/FishModelInstancedDrawDawn.cpp‎

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -51,54 +51,54 @@ void FishModelInstancedDrawDawn::init()
5151
mFishPersBuffer = mContextDawn->createBuffer(
5252
sizeof(FishPer) * instance, wgpu::BufferUsage::Vertex | wgpu::BufferUsage::CopyDst);
5353

54-
mVertexInputDescriptor.cBuffers[0].attributeCount = 1;
55-
mVertexInputDescriptor.cBuffers[0].stride = mPositionBuffer->getDataSize();
56-
mVertexInputDescriptor.cAttributes[0].format = wgpu::VertexFormat::Float3;
57-
mVertexInputDescriptor.cAttributes[0].shaderLocation = 0;
58-
mVertexInputDescriptor.cAttributes[0].offset = 0;
59-
mVertexInputDescriptor.cBuffers[0].attributes = &mVertexInputDescriptor.cAttributes[0];
60-
mVertexInputDescriptor.cBuffers[1].attributeCount = 1;
61-
mVertexInputDescriptor.cBuffers[1].stride = mNormalBuffer->getDataSize();
62-
mVertexInputDescriptor.cAttributes[1].format = wgpu::VertexFormat::Float3;
63-
mVertexInputDescriptor.cAttributes[1].shaderLocation = 1;
64-
mVertexInputDescriptor.cAttributes[1].offset = 0;
65-
mVertexInputDescriptor.cBuffers[1].attributes = &mVertexInputDescriptor.cAttributes[1];
66-
mVertexInputDescriptor.cBuffers[2].attributeCount = 1;
67-
mVertexInputDescriptor.cBuffers[2].stride = mTexCoordBuffer->getDataSize();
68-
mVertexInputDescriptor.cAttributes[2].format = wgpu::VertexFormat::Float2;
69-
mVertexInputDescriptor.cAttributes[2].shaderLocation = 2;
70-
mVertexInputDescriptor.cAttributes[2].offset = 0;
71-
mVertexInputDescriptor.cBuffers[2].attributes = &mVertexInputDescriptor.cAttributes[2];
72-
mVertexInputDescriptor.cBuffers[3].attributeCount = 1;
73-
mVertexInputDescriptor.cBuffers[3].stride = mTangentBuffer->getDataSize();
74-
mVertexInputDescriptor.cAttributes[3].format = wgpu::VertexFormat::Float3;
75-
mVertexInputDescriptor.cAttributes[3].shaderLocation = 3;
76-
mVertexInputDescriptor.cAttributes[3].offset = 0;
77-
mVertexInputDescriptor.cBuffers[3].attributes = &mVertexInputDescriptor.cAttributes[3];
78-
mVertexInputDescriptor.cBuffers[4].attributeCount = 1;
79-
mVertexInputDescriptor.cBuffers[4].stride = mBiNormalBuffer->getDataSize();
80-
mVertexInputDescriptor.cAttributes[4].format = wgpu::VertexFormat::Float3;
81-
mVertexInputDescriptor.cAttributes[4].shaderLocation = 4;
82-
mVertexInputDescriptor.cAttributes[4].offset = offsetof(FishPer, worldPosition);
83-
mVertexInputDescriptor.cBuffers[4].attributes = &mVertexInputDescriptor.cAttributes[4];
84-
mVertexInputDescriptor.cBuffers[5].attributeCount = 4;
85-
mVertexInputDescriptor.cBuffers[5].stride = sizeof(FishPer);
86-
mVertexInputDescriptor.cAttributes[5].format = wgpu::VertexFormat::Float3;
87-
mVertexInputDescriptor.cAttributes[5].shaderLocation = 5;
88-
mVertexInputDescriptor.cAttributes[5].offset = 0;
89-
mVertexInputDescriptor.cAttributes[6].format = wgpu::VertexFormat::Float;
90-
mVertexInputDescriptor.cAttributes[6].shaderLocation = 6;
91-
mVertexInputDescriptor.cAttributes[6].offset = offsetof(FishPer, scale);
92-
mVertexInputDescriptor.cAttributes[7].format = wgpu::VertexFormat::Float3;
93-
mVertexInputDescriptor.cAttributes[7].shaderLocation = 7;
94-
mVertexInputDescriptor.cAttributes[7].offset = offsetof(FishPer, nextPosition);
95-
mVertexInputDescriptor.cAttributes[8].format = wgpu::VertexFormat::Float;
96-
mVertexInputDescriptor.cAttributes[8].shaderLocation = 8;
97-
mVertexInputDescriptor.cAttributes[9].offset = offsetof(FishPer, time);
98-
mVertexInputDescriptor.cBuffers[5].attributes = &mVertexInputDescriptor.cAttributes[5];
99-
mVertexInputDescriptor.cBuffers[5].stepMode = wgpu::InputStepMode::Instance;
100-
mVertexInputDescriptor.bufferCount = 6;
101-
mVertexInputDescriptor.indexFormat = wgpu::IndexFormat::Uint16;
54+
mVertexStateDescriptor.cVertexBuffers[0].attributeCount = 1;
55+
mVertexStateDescriptor.cVertexBuffers[0].arrayStride = mPositionBuffer->getDataSize();
56+
mVertexStateDescriptor.cAttributes[0].format = wgpu::VertexFormat::Float3;
57+
mVertexStateDescriptor.cAttributes[0].shaderLocation = 0;
58+
mVertexStateDescriptor.cAttributes[0].offset = 0;
59+
mVertexStateDescriptor.cVertexBuffers[0].attributes = &mVertexStateDescriptor.cAttributes[0];
60+
mVertexStateDescriptor.cVertexBuffers[1].attributeCount = 1;
61+
mVertexStateDescriptor.cVertexBuffers[1].arrayStride = mNormalBuffer->getDataSize();
62+
mVertexStateDescriptor.cAttributes[1].format = wgpu::VertexFormat::Float3;
63+
mVertexStateDescriptor.cAttributes[1].shaderLocation = 1;
64+
mVertexStateDescriptor.cAttributes[1].offset = 0;
65+
mVertexStateDescriptor.cVertexBuffers[1].attributes = &mVertexStateDescriptor.cAttributes[1];
66+
mVertexStateDescriptor.cVertexBuffers[2].attributeCount = 1;
67+
mVertexStateDescriptor.cVertexBuffers[2].arrayStride = mTexCoordBuffer->getDataSize();
68+
mVertexStateDescriptor.cAttributes[2].format = wgpu::VertexFormat::Float2;
69+
mVertexStateDescriptor.cAttributes[2].shaderLocation = 2;
70+
mVertexStateDescriptor.cAttributes[2].offset = 0;
71+
mVertexStateDescriptor.cVertexBuffers[2].attributes = &mVertexStateDescriptor.cAttributes[2];
72+
mVertexStateDescriptor.cVertexBuffers[3].attributeCount = 1;
73+
mVertexStateDescriptor.cVertexBuffers[3].arrayStride = mTangentBuffer->getDataSize();
74+
mVertexStateDescriptor.cAttributes[3].format = wgpu::VertexFormat::Float3;
75+
mVertexStateDescriptor.cAttributes[3].shaderLocation = 3;
76+
mVertexStateDescriptor.cAttributes[3].offset = 0;
77+
mVertexStateDescriptor.cVertexBuffers[3].attributes = &mVertexStateDescriptor.cAttributes[3];
78+
mVertexStateDescriptor.cVertexBuffers[4].attributeCount = 1;
79+
mVertexStateDescriptor.cVertexBuffers[4].arrayStride = mBiNormalBuffer->getDataSize();
80+
mVertexStateDescriptor.cAttributes[4].format = wgpu::VertexFormat::Float3;
81+
mVertexStateDescriptor.cAttributes[4].shaderLocation = 4;
82+
mVertexStateDescriptor.cAttributes[4].offset = offsetof(FishPer, worldPosition);
83+
mVertexStateDescriptor.cVertexBuffers[4].attributes = &mVertexStateDescriptor.cAttributes[4];
84+
mVertexStateDescriptor.cVertexBuffers[5].attributeCount = 4;
85+
mVertexStateDescriptor.cVertexBuffers[5].arrayStride = sizeof(FishPer);
86+
mVertexStateDescriptor.cAttributes[5].format = wgpu::VertexFormat::Float3;
87+
mVertexStateDescriptor.cAttributes[5].shaderLocation = 5;
88+
mVertexStateDescriptor.cAttributes[5].offset = 0;
89+
mVertexStateDescriptor.cAttributes[6].format = wgpu::VertexFormat::Float;
90+
mVertexStateDescriptor.cAttributes[6].shaderLocation = 6;
91+
mVertexStateDescriptor.cAttributes[6].offset = offsetof(FishPer, scale);
92+
mVertexStateDescriptor.cAttributes[7].format = wgpu::VertexFormat::Float3;
93+
mVertexStateDescriptor.cAttributes[7].shaderLocation = 7;
94+
mVertexStateDescriptor.cAttributes[7].offset = offsetof(FishPer, nextPosition);
95+
mVertexStateDescriptor.cAttributes[8].format = wgpu::VertexFormat::Float;
96+
mVertexStateDescriptor.cAttributes[8].shaderLocation = 8;
97+
mVertexStateDescriptor.cAttributes[9].offset = offsetof(FishPer, time);
98+
mVertexStateDescriptor.cVertexBuffers[5].attributes = &mVertexStateDescriptor.cAttributes[5];
99+
mVertexStateDescriptor.cVertexBuffers[5].stepMode = wgpu::InputStepMode::Instance;
100+
mVertexStateDescriptor.vertexBufferCount = 6;
101+
mVertexStateDescriptor.indexFormat = wgpu::IndexFormat::Uint16;
102102

103103
if (mSkyboxTexture && mReflectionTexture)
104104
{
@@ -142,7 +142,7 @@ void FishModelInstancedDrawDawn::init()
142142
});
143143

144144
mPipeline = mContextDawn->createRenderPipeline(mPipelineLayout, mProgramDawn,
145-
mVertexInputDescriptor, mBlend);
145+
mVertexStateDescriptor, mBlend);
146146

147147
mFishVertexBuffer =
148148
mContextDawn->createBufferFromData(&mFishVertexUniforms, sizeof(FishVertexUniforms),

0 commit comments

Comments
 (0)