mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 15:16:16 +00:00
fix formatting
This commit is contained in:
committed by
Corentin Wallez
parent
084346bd5f
commit
376f1c6a8e
@@ -1,123 +1,123 @@
|
||||
// Copyright 2017 The NXT Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "NullBackend.h"
|
||||
|
||||
#include <spirv-cross/spirv_cross.hpp>
|
||||
|
||||
namespace backend {
|
||||
namespace null {
|
||||
|
||||
nxtProcTable GetNonValidatingProcs();
|
||||
nxtProcTable GetValidatingProcs();
|
||||
|
||||
void Init(nxtProcTable* procs, nxtDevice* device) {
|
||||
*procs = GetValidatingProcs();
|
||||
*device = reinterpret_cast<nxtDevice>(new Device);
|
||||
}
|
||||
|
||||
// Device
|
||||
|
||||
Device::Device() {
|
||||
}
|
||||
|
||||
Device::~Device() {
|
||||
}
|
||||
|
||||
BindGroupBase* Device::CreateBindGroup(BindGroupBuilder* builder) {
|
||||
return new BindGroupBase(builder);
|
||||
}
|
||||
BindGroupLayoutBase* Device::CreateBindGroupLayout(BindGroupLayoutBuilder* builder) {
|
||||
return new BindGroupLayoutBase(builder);
|
||||
}
|
||||
BufferBase* Device::CreateBuffer(BufferBuilder* builder) {
|
||||
return new Buffer(builder);
|
||||
}
|
||||
BufferViewBase* Device::CreateBufferView(BufferViewBuilder* builder) {
|
||||
return new BufferViewBase(builder);
|
||||
}
|
||||
CommandBufferBase* Device::CreateCommandBuffer(CommandBufferBuilder* builder) {
|
||||
return new CommandBufferBase(builder);
|
||||
}
|
||||
DepthStencilStateBase* Device::CreateDepthStencilState(DepthStencilStateBuilder* builder) {
|
||||
return new DepthStencilStateBase(builder);
|
||||
}
|
||||
InputStateBase* Device::CreateInputState(InputStateBuilder* builder) {
|
||||
return new InputStateBase(builder);
|
||||
}
|
||||
FramebufferBase* Device::CreateFramebuffer(FramebufferBuilder* builder) {
|
||||
return new FramebufferBase(builder);
|
||||
}
|
||||
PipelineBase* Device::CreatePipeline(PipelineBuilder* builder) {
|
||||
return new PipelineBase(builder);
|
||||
}
|
||||
PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) {
|
||||
return new PipelineLayoutBase(builder);
|
||||
}
|
||||
QueueBase* Device::CreateQueue(QueueBuilder* builder) {
|
||||
return new Queue(builder);
|
||||
}
|
||||
RenderPassBase* Device::CreateRenderPass(RenderPassBuilder* builder) {
|
||||
return new RenderPassBase(builder);
|
||||
}
|
||||
SamplerBase* Device::CreateSampler(SamplerBuilder* builder) {
|
||||
return new SamplerBase(builder);
|
||||
}
|
||||
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {
|
||||
auto module = new ShaderModuleBase(builder);
|
||||
|
||||
spirv_cross::Compiler compiler(builder->AcquireSpirv());
|
||||
module->ExtractSpirvInfo(compiler);
|
||||
|
||||
return module;
|
||||
}
|
||||
TextureBase* Device::CreateTexture(TextureBuilder* builder) {
|
||||
return new TextureBase(builder);
|
||||
}
|
||||
TextureViewBase* Device::CreateTextureView(TextureViewBuilder* builder) {
|
||||
return new TextureViewBase(builder);
|
||||
}
|
||||
|
||||
void Device::Reference() {
|
||||
}
|
||||
|
||||
void Device::Release() {
|
||||
}
|
||||
|
||||
// Buffer
|
||||
|
||||
Buffer::Buffer(BufferBuilder* builder)
|
||||
: BufferBase(builder) {
|
||||
}
|
||||
|
||||
Buffer::~Buffer() {
|
||||
}
|
||||
|
||||
void Buffer::SetSubDataImpl(uint32_t start, uint32_t count, const uint32_t* data) {
|
||||
}
|
||||
|
||||
// Queue
|
||||
|
||||
Queue::Queue(QueueBuilder* builder)
|
||||
: QueueBase(builder) {
|
||||
}
|
||||
|
||||
Queue::~Queue() {
|
||||
}
|
||||
|
||||
void Queue::Submit(uint32_t numCommands, CommandBuffer* const * commands) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// Copyright 2017 The NXT Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "NullBackend.h"
|
||||
|
||||
#include <spirv-cross/spirv_cross.hpp>
|
||||
|
||||
namespace backend {
|
||||
namespace null {
|
||||
|
||||
nxtProcTable GetNonValidatingProcs();
|
||||
nxtProcTable GetValidatingProcs();
|
||||
|
||||
void Init(nxtProcTable* procs, nxtDevice* device) {
|
||||
*procs = GetValidatingProcs();
|
||||
*device = reinterpret_cast<nxtDevice>(new Device);
|
||||
}
|
||||
|
||||
// Device
|
||||
|
||||
Device::Device() {
|
||||
}
|
||||
|
||||
Device::~Device() {
|
||||
}
|
||||
|
||||
BindGroupBase* Device::CreateBindGroup(BindGroupBuilder* builder) {
|
||||
return new BindGroupBase(builder);
|
||||
}
|
||||
BindGroupLayoutBase* Device::CreateBindGroupLayout(BindGroupLayoutBuilder* builder) {
|
||||
return new BindGroupLayoutBase(builder);
|
||||
}
|
||||
BufferBase* Device::CreateBuffer(BufferBuilder* builder) {
|
||||
return new Buffer(builder);
|
||||
}
|
||||
BufferViewBase* Device::CreateBufferView(BufferViewBuilder* builder) {
|
||||
return new BufferViewBase(builder);
|
||||
}
|
||||
CommandBufferBase* Device::CreateCommandBuffer(CommandBufferBuilder* builder) {
|
||||
return new CommandBufferBase(builder);
|
||||
}
|
||||
DepthStencilStateBase* Device::CreateDepthStencilState(DepthStencilStateBuilder* builder) {
|
||||
return new DepthStencilStateBase(builder);
|
||||
}
|
||||
InputStateBase* Device::CreateInputState(InputStateBuilder* builder) {
|
||||
return new InputStateBase(builder);
|
||||
}
|
||||
FramebufferBase* Device::CreateFramebuffer(FramebufferBuilder* builder) {
|
||||
return new FramebufferBase(builder);
|
||||
}
|
||||
PipelineBase* Device::CreatePipeline(PipelineBuilder* builder) {
|
||||
return new PipelineBase(builder);
|
||||
}
|
||||
PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) {
|
||||
return new PipelineLayoutBase(builder);
|
||||
}
|
||||
QueueBase* Device::CreateQueue(QueueBuilder* builder) {
|
||||
return new Queue(builder);
|
||||
}
|
||||
RenderPassBase* Device::CreateRenderPass(RenderPassBuilder* builder) {
|
||||
return new RenderPassBase(builder);
|
||||
}
|
||||
SamplerBase* Device::CreateSampler(SamplerBuilder* builder) {
|
||||
return new SamplerBase(builder);
|
||||
}
|
||||
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {
|
||||
auto module = new ShaderModuleBase(builder);
|
||||
|
||||
spirv_cross::Compiler compiler(builder->AcquireSpirv());
|
||||
module->ExtractSpirvInfo(compiler);
|
||||
|
||||
return module;
|
||||
}
|
||||
TextureBase* Device::CreateTexture(TextureBuilder* builder) {
|
||||
return new TextureBase(builder);
|
||||
}
|
||||
TextureViewBase* Device::CreateTextureView(TextureViewBuilder* builder) {
|
||||
return new TextureViewBase(builder);
|
||||
}
|
||||
|
||||
void Device::Reference() {
|
||||
}
|
||||
|
||||
void Device::Release() {
|
||||
}
|
||||
|
||||
// Buffer
|
||||
|
||||
Buffer::Buffer(BufferBuilder* builder)
|
||||
: BufferBase(builder) {
|
||||
}
|
||||
|
||||
Buffer::~Buffer() {
|
||||
}
|
||||
|
||||
void Buffer::SetSubDataImpl(uint32_t start, uint32_t count, const uint32_t* data) {
|
||||
}
|
||||
|
||||
// Queue
|
||||
|
||||
Queue::Queue(QueueBuilder* builder)
|
||||
: QueueBase(builder) {
|
||||
}
|
||||
|
||||
Queue::~Queue() {
|
||||
}
|
||||
|
||||
void Queue::Submit(uint32_t numCommands, CommandBuffer* const * commands) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,129 +1,129 @@
|
||||
// Copyright 2017 The NXT Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef BACKEND_NULL_NULLBACKEND_H_
|
||||
#define BACKEND_NULL_NULLBACKEND_H_
|
||||
|
||||
#include "nxt/nxtcpp.h"
|
||||
|
||||
#include "common/Buffer.h"
|
||||
#include "common/BindGroup.h"
|
||||
#include "common/BindGroupLayout.h"
|
||||
#include "common/Device.h"
|
||||
#include "common/CommandBuffer.h"
|
||||
#include "common/DepthStencilState.h"
|
||||
#include "common/InputState.h"
|
||||
#include "common/Framebuffer.h"
|
||||
#include "common/Pipeline.h"
|
||||
#include "common/PipelineLayout.h"
|
||||
#include "common/Queue.h"
|
||||
#include "common/RenderPass.h"
|
||||
#include "common/Sampler.h"
|
||||
#include "common/ShaderModule.h"
|
||||
#include "common/Texture.h"
|
||||
#include "common/ToBackend.h"
|
||||
|
||||
namespace backend {
|
||||
namespace null {
|
||||
|
||||
using BindGroup = BindGroupBase;
|
||||
using BindGroupLayout = BindGroupLayoutBase;
|
||||
class Buffer;
|
||||
using BufferView = BufferViewBase;
|
||||
using CommandBuffer = CommandBufferBase;
|
||||
using DepthStencilState = DepthStencilStateBase;
|
||||
using InputState = InputStateBase;
|
||||
using Framebuffer = FramebufferBase;
|
||||
using Pipeline = PipelineBase;
|
||||
using PipelineLayout = PipelineLayoutBase;
|
||||
class Queue;
|
||||
using RenderPass = RenderPassBase;
|
||||
using Sampler = SamplerBase;
|
||||
using ShaderModule = ShaderModuleBase;
|
||||
using Texture = TextureBase;
|
||||
using TextureView = TextureViewBase;
|
||||
|
||||
struct NullBackendTraits {
|
||||
using BindGroupType = BindGroup;
|
||||
using BindGroupLayoutType = BindGroupLayout;
|
||||
using BufferType = Buffer;
|
||||
using BufferViewType = BufferView;
|
||||
using CommandBufferType = CommandBuffer;
|
||||
using DepthStencilStateType = DepthStencilState;
|
||||
using InputStateType = InputState;
|
||||
using FramebufferType = Framebuffer;
|
||||
using PipelineType = Pipeline;
|
||||
using PipelineLayoutType = PipelineLayout;
|
||||
using QueueType = Queue;
|
||||
using RenderPassType = RenderPass;
|
||||
using SamplerType = Sampler;
|
||||
using ShaderModuleType = ShaderModule;
|
||||
using TextureType = Texture;
|
||||
using TextureViewType = TextureView;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
auto ToBackend(T&& common) -> decltype(ToBackendBase<NullBackendTraits>(common)) {
|
||||
return ToBackendBase<NullBackendTraits>(common);
|
||||
}
|
||||
|
||||
class Device : public DeviceBase {
|
||||
public:
|
||||
Device();
|
||||
~Device();
|
||||
|
||||
BindGroupBase* CreateBindGroup(BindGroupBuilder* builder) override;
|
||||
BindGroupLayoutBase* CreateBindGroupLayout(BindGroupLayoutBuilder* builder) override;
|
||||
BufferBase* CreateBuffer(BufferBuilder* builder) override;
|
||||
BufferViewBase* CreateBufferView(BufferViewBuilder* builder) override;
|
||||
CommandBufferBase* CreateCommandBuffer(CommandBufferBuilder* builder) override;
|
||||
DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override;
|
||||
InputStateBase* CreateInputState(InputStateBuilder* builder) override;
|
||||
FramebufferBase* CreateFramebuffer(FramebufferBuilder* builder) override;
|
||||
PipelineBase* CreatePipeline(PipelineBuilder* builder) override;
|
||||
PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
|
||||
QueueBase* CreateQueue(QueueBuilder* builder) override;
|
||||
RenderPassBase* CreateRenderPass(RenderPassBuilder* builder) override;
|
||||
SamplerBase* CreateSampler(SamplerBuilder* builder) override;
|
||||
ShaderModuleBase* CreateShaderModule(ShaderModuleBuilder* builder) override;
|
||||
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
||||
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
||||
|
||||
// NXT API
|
||||
void Reference();
|
||||
void Release();
|
||||
};
|
||||
|
||||
class Buffer : public BufferBase {
|
||||
public:
|
||||
Buffer(BufferBuilder* builder);
|
||||
~Buffer();
|
||||
|
||||
private:
|
||||
void SetSubDataImpl(uint32_t start, uint32_t count, const uint32_t* data) override;
|
||||
};
|
||||
|
||||
class Queue : public QueueBase {
|
||||
public:
|
||||
Queue(QueueBuilder* builder);
|
||||
~Queue();
|
||||
|
||||
// NXT API
|
||||
void Submit(uint32_t numCommands, CommandBuffer* const * commands);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BACKEND_NULL_NULLBACKEND_H_
|
||||
// Copyright 2017 The NXT Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef BACKEND_NULL_NULLBACKEND_H_
|
||||
#define BACKEND_NULL_NULLBACKEND_H_
|
||||
|
||||
#include "nxt/nxtcpp.h"
|
||||
|
||||
#include "common/Buffer.h"
|
||||
#include "common/BindGroup.h"
|
||||
#include "common/BindGroupLayout.h"
|
||||
#include "common/Device.h"
|
||||
#include "common/CommandBuffer.h"
|
||||
#include "common/DepthStencilState.h"
|
||||
#include "common/InputState.h"
|
||||
#include "common/Framebuffer.h"
|
||||
#include "common/Pipeline.h"
|
||||
#include "common/PipelineLayout.h"
|
||||
#include "common/Queue.h"
|
||||
#include "common/RenderPass.h"
|
||||
#include "common/Sampler.h"
|
||||
#include "common/ShaderModule.h"
|
||||
#include "common/Texture.h"
|
||||
#include "common/ToBackend.h"
|
||||
|
||||
namespace backend {
|
||||
namespace null {
|
||||
|
||||
using BindGroup = BindGroupBase;
|
||||
using BindGroupLayout = BindGroupLayoutBase;
|
||||
class Buffer;
|
||||
using BufferView = BufferViewBase;
|
||||
using CommandBuffer = CommandBufferBase;
|
||||
using DepthStencilState = DepthStencilStateBase;
|
||||
using InputState = InputStateBase;
|
||||
using Framebuffer = FramebufferBase;
|
||||
using Pipeline = PipelineBase;
|
||||
using PipelineLayout = PipelineLayoutBase;
|
||||
class Queue;
|
||||
using RenderPass = RenderPassBase;
|
||||
using Sampler = SamplerBase;
|
||||
using ShaderModule = ShaderModuleBase;
|
||||
using Texture = TextureBase;
|
||||
using TextureView = TextureViewBase;
|
||||
|
||||
struct NullBackendTraits {
|
||||
using BindGroupType = BindGroup;
|
||||
using BindGroupLayoutType = BindGroupLayout;
|
||||
using BufferType = Buffer;
|
||||
using BufferViewType = BufferView;
|
||||
using CommandBufferType = CommandBuffer;
|
||||
using DepthStencilStateType = DepthStencilState;
|
||||
using InputStateType = InputState;
|
||||
using FramebufferType = Framebuffer;
|
||||
using PipelineType = Pipeline;
|
||||
using PipelineLayoutType = PipelineLayout;
|
||||
using QueueType = Queue;
|
||||
using RenderPassType = RenderPass;
|
||||
using SamplerType = Sampler;
|
||||
using ShaderModuleType = ShaderModule;
|
||||
using TextureType = Texture;
|
||||
using TextureViewType = TextureView;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
auto ToBackend(T&& common) -> decltype(ToBackendBase<NullBackendTraits>(common)) {
|
||||
return ToBackendBase<NullBackendTraits>(common);
|
||||
}
|
||||
|
||||
class Device : public DeviceBase {
|
||||
public:
|
||||
Device();
|
||||
~Device();
|
||||
|
||||
BindGroupBase* CreateBindGroup(BindGroupBuilder* builder) override;
|
||||
BindGroupLayoutBase* CreateBindGroupLayout(BindGroupLayoutBuilder* builder) override;
|
||||
BufferBase* CreateBuffer(BufferBuilder* builder) override;
|
||||
BufferViewBase* CreateBufferView(BufferViewBuilder* builder) override;
|
||||
CommandBufferBase* CreateCommandBuffer(CommandBufferBuilder* builder) override;
|
||||
DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override;
|
||||
InputStateBase* CreateInputState(InputStateBuilder* builder) override;
|
||||
FramebufferBase* CreateFramebuffer(FramebufferBuilder* builder) override;
|
||||
PipelineBase* CreatePipeline(PipelineBuilder* builder) override;
|
||||
PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
|
||||
QueueBase* CreateQueue(QueueBuilder* builder) override;
|
||||
RenderPassBase* CreateRenderPass(RenderPassBuilder* builder) override;
|
||||
SamplerBase* CreateSampler(SamplerBuilder* builder) override;
|
||||
ShaderModuleBase* CreateShaderModule(ShaderModuleBuilder* builder) override;
|
||||
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
||||
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
||||
|
||||
// NXT API
|
||||
void Reference();
|
||||
void Release();
|
||||
};
|
||||
|
||||
class Buffer : public BufferBase {
|
||||
public:
|
||||
Buffer(BufferBuilder* builder);
|
||||
~Buffer();
|
||||
|
||||
private:
|
||||
void SetSubDataImpl(uint32_t start, uint32_t count, const uint32_t* data) override;
|
||||
};
|
||||
|
||||
class Queue : public QueueBase {
|
||||
public:
|
||||
Queue(QueueBuilder* builder);
|
||||
~Queue();
|
||||
|
||||
// NXT API
|
||||
void Submit(uint32_t numCommands, CommandBuffer* const * commands);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BACKEND_NULL_NULLBACKEND_H_
|
||||
|
||||
Reference in New Issue
Block a user