mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +00:00
Update samples to the new RenderPipelineDescriptor
Also does some updates for the new BindGroupLayoutEntry and VertexFormats that were missed previously. Bug: chromium:1177501 Change-Id: Icb336590673158538a1586a1f8d5ace398fb381e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45282 Reviewed-by: Brandon Jones <bajones@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
8ce8271c34
commit
9895c273d6
@@ -311,8 +311,8 @@ int main(int argc, const char* argv[]) {
|
||||
queue = device.GetQueue();
|
||||
|
||||
// The hacky pipeline to render a triangle.
|
||||
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
||||
pipelineDesc.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
||||
pipelineDesc.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||
@@ -324,16 +324,15 @@ int main(int argc, const char* argv[]) {
|
||||
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
||||
return;
|
||||
})");
|
||||
pipelineDesc.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDesc.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
})");
|
||||
pipelineDesc.colorStateCount = 1;
|
||||
// BGRA shouldn't be hardcoded. Consider having a map[format -> pipeline].
|
||||
pipelineDesc.cColorStates[0].format = wgpu::TextureFormat::BGRA8Unorm;
|
||||
trianglePipeline = device.CreateRenderPipeline(&pipelineDesc);
|
||||
pipelineDesc.cTargets[0].format = wgpu::TextureFormat::BGRA8Unorm;
|
||||
trianglePipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
||||
|
||||
// Craete the first window, since the example exits when there are no windows.
|
||||
AddWindow();
|
||||
|
||||
Reference in New Issue
Block a user