mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +00:00
Capitalize C types dawn -> Dawn
This is to match Chromium style. Change-Id: Ic97cc03e2291c653ade9662ba3d5e629872b10ad Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5482 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
97ffc1a8aa
commit
45f9730855
@@ -17,24 +17,24 @@
|
||||
#include "utils/DawnHelpers.h"
|
||||
#include "utils/SystemUtils.h"
|
||||
|
||||
dawnDevice device;
|
||||
dawnQueue queue;
|
||||
dawnSwapChain swapchain;
|
||||
dawnRenderPipeline pipeline;
|
||||
DawnDevice device;
|
||||
DawnQueue queue;
|
||||
DawnSwapChain swapchain;
|
||||
DawnRenderPipeline pipeline;
|
||||
|
||||
dawnTextureFormat swapChainFormat;
|
||||
DawnTextureFormat swapChainFormat;
|
||||
|
||||
void init() {
|
||||
device = CreateCppDawnDevice().Release();
|
||||
queue = dawnDeviceCreateQueue(device);
|
||||
|
||||
{
|
||||
dawnSwapChainDescriptor descriptor;
|
||||
DawnSwapChainDescriptor descriptor;
|
||||
descriptor.nextInChain = nullptr;
|
||||
descriptor.implementation = GetSwapChainImplementation();
|
||||
swapchain = dawnDeviceCreateSwapChain(device, &descriptor);
|
||||
}
|
||||
swapChainFormat = static_cast<dawnTextureFormat>(GetPreferredSwapChainTextureFormat());
|
||||
swapChainFormat = static_cast<DawnTextureFormat>(GetPreferredSwapChainTextureFormat());
|
||||
dawnSwapChainConfigure(swapchain, swapChainFormat, DAWN_TEXTURE_USAGE_BIT_OUTPUT_ATTACHMENT, 640,
|
||||
480);
|
||||
|
||||
@@ -44,7 +44,7 @@ void init() {
|
||||
"void main() {\n"
|
||||
" gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n"
|
||||
"}\n";
|
||||
dawnShaderModule vsModule = utils::CreateShaderModule(dawn::Device(device), dawn::ShaderStage::Vertex, vs).Release();
|
||||
DawnShaderModule vsModule = utils::CreateShaderModule(dawn::Device(device), dawn::ShaderStage::Vertex, vs).Release();
|
||||
|
||||
const char* fs =
|
||||
"#version 450\n"
|
||||
@@ -52,19 +52,19 @@ void init() {
|
||||
"void main() {\n"
|
||||
" fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
|
||||
"}\n";
|
||||
dawnShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, fs).Release();
|
||||
DawnShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, fs).Release();
|
||||
|
||||
{
|
||||
dawnRenderPipelineDescriptor descriptor;
|
||||
DawnRenderPipelineDescriptor descriptor;
|
||||
descriptor.nextInChain = nullptr;
|
||||
|
||||
dawnPipelineStageDescriptor vertexStage;
|
||||
DawnPipelineStageDescriptor vertexStage;
|
||||
vertexStage.nextInChain = nullptr;
|
||||
vertexStage.module = vsModule;
|
||||
vertexStage.entryPoint = "main";
|
||||
descriptor.vertexStage = &vertexStage;
|
||||
|
||||
dawnPipelineStageDescriptor fragmentStage;
|
||||
DawnPipelineStageDescriptor fragmentStage;
|
||||
fragmentStage.nextInChain = nullptr;
|
||||
fragmentStage.module = fsModule;
|
||||
fragmentStage.entryPoint = "main";
|
||||
@@ -72,11 +72,11 @@ void init() {
|
||||
|
||||
descriptor.sampleCount = 1;
|
||||
|
||||
dawnBlendDescriptor blendDescriptor;
|
||||
DawnBlendDescriptor blendDescriptor;
|
||||
blendDescriptor.operation = DAWN_BLEND_OPERATION_ADD;
|
||||
blendDescriptor.srcFactor = DAWN_BLEND_FACTOR_ONE;
|
||||
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
||||
dawnColorStateDescriptor colorStateDescriptor;
|
||||
DawnColorStateDescriptor colorStateDescriptor;
|
||||
colorStateDescriptor.nextInChain = nullptr;
|
||||
colorStateDescriptor.format = swapChainFormat;
|
||||
colorStateDescriptor.alphaBlend = blendDescriptor;
|
||||
@@ -84,16 +84,16 @@ void init() {
|
||||
colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL;
|
||||
|
||||
descriptor.colorStateCount = 1;
|
||||
dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
|
||||
DawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
|
||||
descriptor.colorStates = colorStatesPtr;
|
||||
|
||||
dawnPipelineLayoutDescriptor pl;
|
||||
DawnPipelineLayoutDescriptor pl;
|
||||
pl.nextInChain = nullptr;
|
||||
pl.bindGroupLayoutCount = 0;
|
||||
pl.bindGroupLayouts = nullptr;
|
||||
descriptor.layout = dawnDeviceCreatePipelineLayout(device, &pl);
|
||||
|
||||
dawnInputStateBuilder inputStateBuilder = dawnDeviceCreateInputStateBuilder(device);
|
||||
DawnInputStateBuilder inputStateBuilder = dawnDeviceCreateInputStateBuilder(device);
|
||||
descriptor.inputState = dawnInputStateBuilderGetResult(inputStateBuilder);
|
||||
dawnInputStateBuilderRelease(inputStateBuilder);
|
||||
|
||||
@@ -112,14 +112,14 @@ void init() {
|
||||
}
|
||||
|
||||
void frame() {
|
||||
dawnTexture backbuffer = dawnSwapChainGetNextTexture(swapchain);
|
||||
dawnTextureView backbufferView;
|
||||
DawnTexture backbuffer = dawnSwapChainGetNextTexture(swapchain);
|
||||
DawnTextureView backbufferView;
|
||||
{
|
||||
backbufferView = dawnTextureCreateDefaultTextureView(backbuffer);
|
||||
}
|
||||
dawnRenderPassDescriptor renderpassInfo;
|
||||
dawnRenderPassColorAttachmentDescriptor colorAttachment;
|
||||
dawnRenderPassColorAttachmentDescriptor* colorAttachments = {&colorAttachment};
|
||||
DawnRenderPassDescriptor renderpassInfo;
|
||||
DawnRenderPassColorAttachmentDescriptor colorAttachment;
|
||||
DawnRenderPassColorAttachmentDescriptor* colorAttachments = {&colorAttachment};
|
||||
{
|
||||
colorAttachment.attachment = backbufferView;
|
||||
colorAttachment.resolveTarget = nullptr;
|
||||
@@ -130,11 +130,11 @@ void frame() {
|
||||
renderpassInfo.colorAttachments = &colorAttachments;
|
||||
renderpassInfo.depthStencilAttachment = nullptr;
|
||||
}
|
||||
dawnCommandBuffer commands;
|
||||
DawnCommandBuffer commands;
|
||||
{
|
||||
dawnCommandEncoder encoder = dawnDeviceCreateCommandEncoder(device);
|
||||
DawnCommandEncoder encoder = dawnDeviceCreateCommandEncoder(device);
|
||||
|
||||
dawnRenderPassEncoder pass = dawnCommandEncoderBeginRenderPass(encoder, &renderpassInfo);
|
||||
DawnRenderPassEncoder pass = dawnCommandEncoderBeginRenderPass(encoder, &renderpassInfo);
|
||||
dawnRenderPassEncoderSetPipeline(pass, pipeline);
|
||||
dawnRenderPassEncoderDraw(pass, 3, 1, 0, 0);
|
||||
dawnRenderPassEncoderEndPass(pass);
|
||||
|
||||
Reference in New Issue
Block a user