mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-15 03:41:34 +00:00
Format: src/backend/null
This commit is contained in:
parent
f58d84d488
commit
1aa4d5604f
@ -18,8 +18,7 @@
|
||||
|
||||
#include <spirv-cross/spirv_cross.hpp>
|
||||
|
||||
namespace backend {
|
||||
namespace null {
|
||||
namespace backend { namespace null {
|
||||
|
||||
nxtProcTable GetNonValidatingProcs();
|
||||
nxtProcTable GetValidatingProcs();
|
||||
@ -122,9 +121,9 @@ namespace null {
|
||||
uint32_t serial;
|
||||
};
|
||||
|
||||
Buffer::Buffer(BufferBuilder* builder)
|
||||
: BufferBase(builder) {
|
||||
if (GetAllowedUsage() & (nxt::BufferUsageBit::TransferDst | nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::MapWrite)) {
|
||||
Buffer::Buffer(BufferBuilder* builder) : BufferBase(builder) {
|
||||
if (GetAllowedUsage() & (nxt::BufferUsageBit::TransferDst | nxt::BufferUsageBit::MapRead |
|
||||
nxt::BufferUsageBit::MapWrite)) {
|
||||
mBackingData = std::unique_ptr<char[]>(new char[GetSize()]);
|
||||
}
|
||||
}
|
||||
@ -174,18 +173,16 @@ namespace null {
|
||||
Command type;
|
||||
while (mCommands.NextCommandId(&type)) {
|
||||
switch (type) {
|
||||
case Command::TransitionBufferUsage:
|
||||
{
|
||||
TransitionBufferUsageCmd* cmd = mCommands.NextCommand<TransitionBufferUsageCmd>();
|
||||
case Command::TransitionBufferUsage: {
|
||||
TransitionBufferUsageCmd* cmd =
|
||||
mCommands.NextCommand<TransitionBufferUsageCmd>();
|
||||
cmd->buffer->UpdateUsageInternal(cmd->usage);
|
||||
}
|
||||
break;
|
||||
case Command::TransitionTextureUsage:
|
||||
{
|
||||
TransitionTextureUsageCmd* cmd = mCommands.NextCommand<TransitionTextureUsageCmd>();
|
||||
} break;
|
||||
case Command::TransitionTextureUsage: {
|
||||
TransitionTextureUsageCmd* cmd =
|
||||
mCommands.NextCommand<TransitionTextureUsageCmd>();
|
||||
cmd->texture->UpdateUsageInternal(cmd->usage);
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
default:
|
||||
SkipCommand(&mCommands, type);
|
||||
break;
|
||||
@ -195,8 +192,7 @@ namespace null {
|
||||
|
||||
// Queue
|
||||
|
||||
Queue::Queue(QueueBuilder* builder)
|
||||
: QueueBase(builder) {
|
||||
Queue::Queue(QueueBuilder* builder) : QueueBase(builder) {
|
||||
}
|
||||
|
||||
Queue::~Queue() {
|
||||
@ -218,8 +214,7 @@ namespace null {
|
||||
|
||||
// Texture
|
||||
|
||||
Texture::Texture(TextureBuilder* builder)
|
||||
: TextureBase(builder) {
|
||||
Texture::Texture(TextureBuilder* builder) : TextureBase(builder) {
|
||||
}
|
||||
|
||||
Texture::~Texture() {
|
||||
@ -230,8 +225,7 @@ namespace null {
|
||||
|
||||
// SwapChain
|
||||
|
||||
SwapChain::SwapChain(SwapChainBuilder* builder)
|
||||
: SwapChainBase(builder) {
|
||||
SwapChain::SwapChain(SwapChainBuilder* builder) : SwapChainBase(builder) {
|
||||
const auto& im = GetImplementation();
|
||||
im.Init(im.userData, nullptr);
|
||||
}
|
||||
@ -242,5 +236,4 @@ namespace null {
|
||||
TextureBase* SwapChain::GetNextTextureImpl(TextureBuilder* builder) {
|
||||
return GetDevice()->CreateTexture(builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}} // namespace backend::null
|
||||
|
@ -17,14 +17,14 @@
|
||||
|
||||
#include "nxt/nxtcpp.h"
|
||||
|
||||
#include "backend/Buffer.h"
|
||||
#include "backend/BindGroup.h"
|
||||
#include "backend/BindGroupLayout.h"
|
||||
#include "backend/BlendState.h"
|
||||
#include "backend/Device.h"
|
||||
#include "backend/Buffer.h"
|
||||
#include "backend/CommandBuffer.h"
|
||||
#include "backend/ComputePipeline.h"
|
||||
#include "backend/DepthStencilState.h"
|
||||
#include "backend/Device.h"
|
||||
#include "backend/Framebuffer.h"
|
||||
#include "backend/InputState.h"
|
||||
#include "backend/PipelineLayout.h"
|
||||
@ -37,8 +37,7 @@
|
||||
#include "backend/Texture.h"
|
||||
#include "backend/ToBackend.h"
|
||||
|
||||
namespace backend {
|
||||
namespace null {
|
||||
namespace backend { namespace null {
|
||||
|
||||
using BindGroup = BindGroupBase;
|
||||
using BindGroupLayout = BindGroupLayoutBase;
|
||||
@ -84,7 +83,7 @@ namespace null {
|
||||
using TextureViewType = TextureView;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
auto ToBackend(T&& common) -> decltype(ToBackendBase<NullBackendTraits>(common)) {
|
||||
return ToBackendBase<NullBackendTraits>(common);
|
||||
}
|
||||
@ -139,7 +138,8 @@ namespace null {
|
||||
void SetSubDataImpl(uint32_t start, uint32_t count, const uint32_t* data) override;
|
||||
void MapReadAsyncImpl(uint32_t serial, uint32_t start, uint32_t count) override;
|
||||
void UnmapImpl() override;
|
||||
void TransitionUsageImpl(nxt::BufferUsageBit currentUsage, nxt::BufferUsageBit targetUsage) override;
|
||||
void TransitionUsageImpl(nxt::BufferUsageBit currentUsage,
|
||||
nxt::BufferUsageBit targetUsage) override;
|
||||
|
||||
std::unique_ptr<char[]> mBackingData;
|
||||
};
|
||||
@ -161,7 +161,7 @@ namespace null {
|
||||
~Queue();
|
||||
|
||||
// NXT API
|
||||
void Submit(uint32_t numCommands, CommandBuffer* const * commands);
|
||||
void Submit(uint32_t numCommands, CommandBuffer* const* commands);
|
||||
};
|
||||
|
||||
class Texture : public TextureBase {
|
||||
@ -169,7 +169,8 @@ namespace null {
|
||||
Texture(TextureBuilder* builder);
|
||||
~Texture();
|
||||
|
||||
void TransitionUsageImpl(nxt::TextureUsageBit currentUsage, nxt::TextureUsageBit targetUsage) override;
|
||||
void TransitionUsageImpl(nxt::TextureUsageBit currentUsage,
|
||||
nxt::TextureUsageBit targetUsage) override;
|
||||
};
|
||||
|
||||
class SwapChain : public SwapChainBase {
|
||||
@ -181,7 +182,6 @@ namespace null {
|
||||
TextureBase* GetNextTextureImpl(TextureBuilder* builder) override;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}} // namespace backend::null
|
||||
|
||||
#endif // BACKEND_NULL_NULLBACKEND_H_
|
||||
|
Loading…
x
Reference in New Issue
Block a user