mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 09:55:26 +00:00
Removed deprecated CreateRenderPipeline path
Renames all the RenderPipeline*2 stuff to simple RenderPipeline* but keeps *2 definitionas around as typedefs and wrappers so that users can migrate away from it. Bug: dawn:22 Change-Id: If301d81a829bba0646c3a61068f2279932b191e0 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51764 Commit-Queue: Brandon Jones <bajones@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
4589de61a0
commit
41c87d973a
@@ -21,10 +21,7 @@ namespace utils {
|
||||
// For creating deprecated render pipeline descriptors
|
||||
|
||||
ComboVertexStateDescriptor::ComboVertexStateDescriptor() {
|
||||
wgpu::VertexStateDescriptor* descriptor = this;
|
||||
|
||||
descriptor->indexFormat = wgpu::IndexFormat::Undefined;
|
||||
descriptor->vertexBufferCount = 0;
|
||||
vertexBufferCount = 0;
|
||||
|
||||
// Fill the default values for vertexBuffers and vertexAttributes in buffers.
|
||||
wgpu::VertexAttributeDescriptor vertexAttribute;
|
||||
@@ -46,79 +43,11 @@ namespace utils {
|
||||
// &cAttributes[2]. Likewise, if cVertexBuffers[1] has 3 attributes, then
|
||||
// cVertexBuffers[2].attributes should point to &cAttributes[5].
|
||||
cVertexBuffers[0].attributes = &cAttributes[0];
|
||||
descriptor->vertexBuffers = &cVertexBuffers[0];
|
||||
}
|
||||
|
||||
ComboRenderPipelineDescriptor::ComboRenderPipelineDescriptor(const wgpu::Device& device) {
|
||||
ComboRenderPipelineDescriptor::ComboRenderPipelineDescriptor() {
|
||||
wgpu::RenderPipelineDescriptor* descriptor = this;
|
||||
|
||||
descriptor->primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor->sampleCount = 1;
|
||||
|
||||
// Set defaults for the vertex stage descriptor.
|
||||
{ vertexStage.entryPoint = "main"; }
|
||||
|
||||
// Set defaults for the fragment stage desriptor.
|
||||
{
|
||||
descriptor->fragmentStage = &cFragmentStage;
|
||||
cFragmentStage.entryPoint = "main";
|
||||
}
|
||||
|
||||
// Set defaults for the input state descriptors.
|
||||
descriptor->vertexState = &cVertexState;
|
||||
|
||||
// Set defaults for the rasterization state descriptor.
|
||||
{
|
||||
cRasterizationState.frontFace = wgpu::FrontFace::CCW;
|
||||
cRasterizationState.cullMode = wgpu::CullMode::None;
|
||||
|
||||
cRasterizationState.depthBias = 0;
|
||||
cRasterizationState.depthBiasSlopeScale = 0.0;
|
||||
cRasterizationState.depthBiasClamp = 0.0;
|
||||
descriptor->rasterizationState = &cRasterizationState;
|
||||
}
|
||||
|
||||
// Set defaults for the color state descriptors.
|
||||
{
|
||||
descriptor->colorStateCount = 1;
|
||||
descriptor->colorStates = cColorStates.data();
|
||||
|
||||
wgpu::BlendDescriptor blend;
|
||||
blend.operation = wgpu::BlendOperation::Add;
|
||||
blend.srcFactor = wgpu::BlendFactor::One;
|
||||
blend.dstFactor = wgpu::BlendFactor::Zero;
|
||||
wgpu::ColorStateDescriptor colorStateDescriptor;
|
||||
colorStateDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
colorStateDescriptor.alphaBlend = blend;
|
||||
colorStateDescriptor.colorBlend = blend;
|
||||
colorStateDescriptor.writeMask = wgpu::ColorWriteMask::All;
|
||||
for (uint32_t i = 0; i < kMaxColorAttachments; ++i) {
|
||||
cColorStates[i] = colorStateDescriptor;
|
||||
}
|
||||
}
|
||||
|
||||
// Set defaults for the depth stencil state descriptors.
|
||||
{
|
||||
wgpu::StencilStateFaceDescriptor stencilFace;
|
||||
stencilFace.compare = wgpu::CompareFunction::Always;
|
||||
stencilFace.failOp = wgpu::StencilOperation::Keep;
|
||||
stencilFace.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
stencilFace.passOp = wgpu::StencilOperation::Keep;
|
||||
|
||||
cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
cDepthStencilState.depthWriteEnabled = false;
|
||||
cDepthStencilState.depthCompare = wgpu::CompareFunction::Always;
|
||||
cDepthStencilState.stencilBack = stencilFace;
|
||||
cDepthStencilState.stencilFront = stencilFace;
|
||||
cDepthStencilState.stencilReadMask = 0xff;
|
||||
cDepthStencilState.stencilWriteMask = 0xff;
|
||||
descriptor->depthStencilState = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ComboRenderPipelineDescriptor2::ComboRenderPipelineDescriptor2() {
|
||||
wgpu::RenderPipelineDescriptor2* descriptor = this;
|
||||
|
||||
// Set defaults for the vertex state.
|
||||
{
|
||||
wgpu::VertexState* vertex = &descriptor->vertex;
|
||||
@@ -208,7 +137,7 @@ namespace utils {
|
||||
}
|
||||
}
|
||||
|
||||
wgpu::DepthStencilState* ComboRenderPipelineDescriptor2::EnableDepthStencil(
|
||||
wgpu::DepthStencilState* ComboRenderPipelineDescriptor::EnableDepthStencil(
|
||||
wgpu::TextureFormat format) {
|
||||
this->depthStencil = &cDepthStencil;
|
||||
cDepthStencil.format = format;
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
// For creating deprecated render pipeline descriptors
|
||||
class ComboVertexStateDescriptor : public wgpu::VertexStateDescriptor {
|
||||
class ComboVertexStateDescriptor {
|
||||
public:
|
||||
ComboVertexStateDescriptor();
|
||||
|
||||
@@ -33,37 +32,21 @@ namespace utils {
|
||||
ComboVertexStateDescriptor(ComboVertexStateDescriptor&&) = delete;
|
||||
ComboVertexStateDescriptor& operator=(ComboVertexStateDescriptor&&) = delete;
|
||||
|
||||
uint32_t vertexBufferCount;
|
||||
std::array<wgpu::VertexBufferLayoutDescriptor, kMaxVertexBuffers> cVertexBuffers;
|
||||
std::array<wgpu::VertexAttributeDescriptor, kMaxVertexAttributes> cAttributes;
|
||||
};
|
||||
|
||||
// For creating the new style of render pipeline descriptors
|
||||
class ComboRenderPipelineDescriptor : public wgpu::RenderPipelineDescriptor {
|
||||
public:
|
||||
ComboRenderPipelineDescriptor(const wgpu::Device& device);
|
||||
ComboRenderPipelineDescriptor();
|
||||
|
||||
ComboRenderPipelineDescriptor(const ComboRenderPipelineDescriptor&) = delete;
|
||||
ComboRenderPipelineDescriptor& operator=(const ComboRenderPipelineDescriptor&) = delete;
|
||||
ComboRenderPipelineDescriptor(ComboRenderPipelineDescriptor&&) = delete;
|
||||
ComboRenderPipelineDescriptor& operator=(ComboRenderPipelineDescriptor&&) = delete;
|
||||
|
||||
wgpu::ProgrammableStageDescriptor cFragmentStage;
|
||||
|
||||
ComboVertexStateDescriptor cVertexState;
|
||||
wgpu::RasterizationStateDescriptor cRasterizationState;
|
||||
std::array<wgpu::ColorStateDescriptor, kMaxColorAttachments> cColorStates;
|
||||
wgpu::DepthStencilStateDescriptor cDepthStencilState;
|
||||
};
|
||||
|
||||
// For creating the new style of render pipeline descriptors
|
||||
class ComboRenderPipelineDescriptor2 : public wgpu::RenderPipelineDescriptor2 {
|
||||
public:
|
||||
ComboRenderPipelineDescriptor2();
|
||||
|
||||
ComboRenderPipelineDescriptor2(const ComboRenderPipelineDescriptor2&) = delete;
|
||||
ComboRenderPipelineDescriptor2& operator=(const ComboRenderPipelineDescriptor2&) = delete;
|
||||
ComboRenderPipelineDescriptor2(ComboRenderPipelineDescriptor2&&) = delete;
|
||||
ComboRenderPipelineDescriptor2& operator=(ComboRenderPipelineDescriptor2&&) = delete;
|
||||
|
||||
wgpu::DepthStencilState* EnableDepthStencil(
|
||||
wgpu::TextureFormat format = wgpu::TextureFormat::Depth24PlusStencil8);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user