mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-11 06:27:54 +00:00
Rename the nxt namespace to dawn
This commit is contained in:
committed by
Corentin Wallez
parent
05c90ee4cb
commit
ae79c03d45
@@ -17,7 +17,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace nxt {
|
||||
namespace dawn {
|
||||
|
||||
// std::underlying_type doesn't work in old GLIBC still used in Chrome
|
||||
#define CR_GLIBCXX_4_7_0 20120322
|
||||
@@ -157,6 +157,6 @@ namespace nxt {
|
||||
l = l ^ r;
|
||||
return l;
|
||||
}
|
||||
} // namespace nxt
|
||||
} // namespace dawn
|
||||
|
||||
#endif // NXT_ENUM_CLASS_BITMASKS_H_
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace detail {
|
||||
class Expectation;
|
||||
}
|
||||
|
||||
namespace nxt { namespace wire {
|
||||
namespace dawn { namespace wire {
|
||||
class CommandHandler;
|
||||
class TerribleCommandBuffer;
|
||||
}} // namespace dawn::wire
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "dawn/EnumClassBitmasks.h"
|
||||
|
||||
namespace nxt {
|
||||
namespace dawn {
|
||||
|
||||
enum class Color : uint32_t {
|
||||
R = 1,
|
||||
@@ -90,4 +90,4 @@ namespace nxt {
|
||||
ASSERT_FALSE(HasZeroOrOneBits(static_cast<Color>(Color::B | Color::A)));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace dawn
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "wire/Wire.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace nxt::wire;
|
||||
using namespace dawn::wire;
|
||||
|
||||
// Definition of a "Lambda predicate matcher" for GMock to allow checking deep structures
|
||||
// are passed correctly by the wire.
|
||||
|
||||
@@ -25,21 +25,21 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
void FillShaderModuleBuilder(const nxt::ShaderModuleBuilder& builder,
|
||||
nxt::ShaderStage stage,
|
||||
void FillShaderModuleBuilder(const dawn::ShaderModuleBuilder& builder,
|
||||
dawn::ShaderStage stage,
|
||||
const char* source) {
|
||||
shaderc::Compiler compiler;
|
||||
shaderc::CompileOptions options;
|
||||
|
||||
shaderc_shader_kind kind;
|
||||
switch (stage) {
|
||||
case nxt::ShaderStage::Vertex:
|
||||
case dawn::ShaderStage::Vertex:
|
||||
kind = shaderc_glsl_vertex_shader;
|
||||
break;
|
||||
case nxt::ShaderStage::Fragment:
|
||||
case dawn::ShaderStage::Fragment:
|
||||
kind = shaderc_glsl_fragment_shader;
|
||||
break;
|
||||
case nxt::ShaderStage::Compute:
|
||||
case dawn::ShaderStage::Compute:
|
||||
kind = shaderc_glsl_compute_shader;
|
||||
break;
|
||||
default:
|
||||
@@ -89,67 +89,67 @@ namespace utils {
|
||||
#endif
|
||||
}
|
||||
|
||||
nxt::ShaderModule CreateShaderModule(const nxt::Device& device,
|
||||
nxt::ShaderStage stage,
|
||||
const char* source) {
|
||||
nxt::ShaderModuleBuilder builder = device.CreateShaderModuleBuilder();
|
||||
dawn::ShaderModule CreateShaderModule(const dawn::Device& device,
|
||||
dawn::ShaderStage stage,
|
||||
const char* source) {
|
||||
dawn::ShaderModuleBuilder builder = device.CreateShaderModuleBuilder();
|
||||
FillShaderModuleBuilder(builder, stage, source);
|
||||
return builder.GetResult();
|
||||
}
|
||||
|
||||
nxt::Buffer CreateBufferFromData(const nxt::Device& device,
|
||||
const void* data,
|
||||
uint32_t size,
|
||||
nxt::BufferUsageBit usage) {
|
||||
nxt::Buffer buffer = device.CreateBufferBuilder()
|
||||
.SetAllowedUsage(nxt::BufferUsageBit::TransferDst | usage)
|
||||
.SetSize(size)
|
||||
.GetResult();
|
||||
dawn::Buffer CreateBufferFromData(const dawn::Device& device,
|
||||
const void* data,
|
||||
uint32_t size,
|
||||
dawn::BufferUsageBit usage) {
|
||||
dawn::Buffer buffer = device.CreateBufferBuilder()
|
||||
.SetAllowedUsage(dawn::BufferUsageBit::TransferDst | usage)
|
||||
.SetSize(size)
|
||||
.GetResult();
|
||||
buffer.SetSubData(0, size, reinterpret_cast<const uint8_t*>(data));
|
||||
return buffer;
|
||||
}
|
||||
|
||||
BasicRenderPass CreateBasicRenderPass(const nxt::Device& device,
|
||||
BasicRenderPass CreateBasicRenderPass(const dawn::Device& device,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
BasicRenderPass result;
|
||||
result.width = width;
|
||||
result.height = height;
|
||||
|
||||
result.colorFormat = nxt::TextureFormat::R8G8B8A8Unorm;
|
||||
result.colorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
result.color = device.CreateTextureBuilder()
|
||||
.SetDimension(nxt::TextureDimension::e2D)
|
||||
.SetDimension(dawn::TextureDimension::e2D)
|
||||
.SetExtent(width, height, 1)
|
||||
.SetFormat(result.colorFormat)
|
||||
.SetMipLevels(1)
|
||||
.SetAllowedUsage(nxt::TextureUsageBit::OutputAttachment |
|
||||
nxt::TextureUsageBit::TransferSrc)
|
||||
.SetAllowedUsage(dawn::TextureUsageBit::OutputAttachment |
|
||||
dawn::TextureUsageBit::TransferSrc)
|
||||
.GetResult();
|
||||
|
||||
nxt::TextureView colorView = result.color.CreateTextureViewBuilder().GetResult();
|
||||
dawn::TextureView colorView = result.color.CreateTextureViewBuilder().GetResult();
|
||||
result.renderPassInfo = device.CreateRenderPassDescriptorBuilder()
|
||||
.SetColorAttachment(0, colorView, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(0, colorView, dawn::LoadOp::Clear)
|
||||
.GetResult();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
nxt::SamplerDescriptor GetDefaultSamplerDescriptor() {
|
||||
nxt::SamplerDescriptor desc;
|
||||
dawn::SamplerDescriptor GetDefaultSamplerDescriptor() {
|
||||
dawn::SamplerDescriptor desc;
|
||||
|
||||
desc.minFilter = nxt::FilterMode::Linear;
|
||||
desc.magFilter = nxt::FilterMode::Linear;
|
||||
desc.mipmapFilter = nxt::FilterMode::Linear;
|
||||
desc.addressModeU = nxt::AddressMode::Repeat;
|
||||
desc.addressModeV = nxt::AddressMode::Repeat;
|
||||
desc.addressModeW = nxt::AddressMode::Repeat;
|
||||
desc.minFilter = dawn::FilterMode::Linear;
|
||||
desc.magFilter = dawn::FilterMode::Linear;
|
||||
desc.mipmapFilter = dawn::FilterMode::Linear;
|
||||
desc.addressModeU = dawn::AddressMode::Repeat;
|
||||
desc.addressModeV = dawn::AddressMode::Repeat;
|
||||
desc.addressModeW = dawn::AddressMode::Repeat;
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
nxt::PipelineLayout MakeBasicPipelineLayout(const nxt::Device& device,
|
||||
const nxt::BindGroupLayout* bindGroupLayout) {
|
||||
nxt::PipelineLayoutDescriptor descriptor;
|
||||
dawn::PipelineLayout MakeBasicPipelineLayout(const dawn::Device& device,
|
||||
const dawn::BindGroupLayout* bindGroupLayout) {
|
||||
dawn::PipelineLayoutDescriptor descriptor;
|
||||
if (bindGroupLayout) {
|
||||
descriptor.numBindGroupLayouts = 1;
|
||||
descriptor.bindGroupLayouts = bindGroupLayout;
|
||||
@@ -160,18 +160,18 @@ namespace utils {
|
||||
return device.CreatePipelineLayout(&descriptor);
|
||||
}
|
||||
|
||||
nxt::BindGroupLayout MakeBindGroupLayout(
|
||||
const nxt::Device& device,
|
||||
std::initializer_list<nxt::BindGroupBinding> bindingsInitializer) {
|
||||
std::vector<nxt::BindGroupBinding> bindings;
|
||||
nxt::ShaderStageBit kNoStages{};
|
||||
for (const nxt::BindGroupBinding& binding : bindingsInitializer) {
|
||||
dawn::BindGroupLayout MakeBindGroupLayout(
|
||||
const dawn::Device& device,
|
||||
std::initializer_list<dawn::BindGroupBinding> bindingsInitializer) {
|
||||
std::vector<dawn::BindGroupBinding> bindings;
|
||||
dawn::ShaderStageBit kNoStages{};
|
||||
for (const dawn::BindGroupBinding& binding : bindingsInitializer) {
|
||||
if (binding.visibility != kNoStages) {
|
||||
bindings.push_back(binding);
|
||||
}
|
||||
}
|
||||
|
||||
nxt::BindGroupLayoutDescriptor descriptor;
|
||||
dawn::BindGroupLayoutDescriptor descriptor;
|
||||
descriptor.numBindings = static_cast<uint32_t>(bindings.size());
|
||||
descriptor.bindings = bindings.data();
|
||||
return device.CreateBindGroupLayout(&descriptor);
|
||||
|
||||
@@ -18,40 +18,40 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
void FillShaderModuleBuilder(const nxt::ShaderModuleBuilder& builder,
|
||||
nxt::ShaderStage stage,
|
||||
void FillShaderModuleBuilder(const dawn::ShaderModuleBuilder& builder,
|
||||
dawn::ShaderStage stage,
|
||||
const char* source);
|
||||
nxt::ShaderModule CreateShaderModule(const nxt::Device& device,
|
||||
nxt::ShaderStage stage,
|
||||
const char* source);
|
||||
nxt::Buffer CreateBufferFromData(const nxt::Device& device,
|
||||
const void* data,
|
||||
uint32_t size,
|
||||
nxt::BufferUsageBit usage);
|
||||
dawn::ShaderModule CreateShaderModule(const dawn::Device& device,
|
||||
dawn::ShaderStage stage,
|
||||
const char* source);
|
||||
dawn::Buffer CreateBufferFromData(const dawn::Device& device,
|
||||
const void* data,
|
||||
uint32_t size,
|
||||
dawn::BufferUsageBit usage);
|
||||
|
||||
template <typename T>
|
||||
nxt::Buffer CreateBufferFromData(const nxt::Device& device,
|
||||
nxt::BufferUsageBit usage,
|
||||
std::initializer_list<T> data) {
|
||||
dawn::Buffer CreateBufferFromData(const dawn::Device& device,
|
||||
dawn::BufferUsageBit usage,
|
||||
std::initializer_list<T> data) {
|
||||
return CreateBufferFromData(device, data.begin(), uint32_t(sizeof(T) * data.size()), usage);
|
||||
}
|
||||
|
||||
struct BasicRenderPass {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
nxt::Texture color;
|
||||
nxt::TextureFormat colorFormat;
|
||||
nxt::RenderPassDescriptor renderPassInfo;
|
||||
dawn::Texture color;
|
||||
dawn::TextureFormat colorFormat;
|
||||
dawn::RenderPassDescriptor renderPassInfo;
|
||||
};
|
||||
BasicRenderPass CreateBasicRenderPass(const nxt::Device& device,
|
||||
BasicRenderPass CreateBasicRenderPass(const dawn::Device& device,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
|
||||
nxt::SamplerDescriptor GetDefaultSamplerDescriptor();
|
||||
nxt::PipelineLayout MakeBasicPipelineLayout(const nxt::Device& device,
|
||||
const nxt::BindGroupLayout* bindGroupLayout);
|
||||
nxt::BindGroupLayout MakeBindGroupLayout(
|
||||
const nxt::Device& device,
|
||||
std::initializer_list<nxt::BindGroupBinding> bindingsInitializer);
|
||||
dawn::SamplerDescriptor GetDefaultSamplerDescriptor();
|
||||
dawn::PipelineLayout MakeBasicPipelineLayout(const dawn::Device& device,
|
||||
const dawn::BindGroupLayout* bindGroupLayout);
|
||||
dawn::BindGroupLayout MakeBindGroupLayout(
|
||||
const dawn::Device& device,
|
||||
std::initializer_list<dawn::BindGroupBinding> bindingsInitializer);
|
||||
|
||||
} // namespace utils
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "common/Assert.h"
|
||||
|
||||
namespace nxt { namespace wire {
|
||||
namespace dawn { namespace wire {
|
||||
|
||||
TerribleCommandBuffer::TerribleCommandBuffer() {
|
||||
}
|
||||
@@ -56,4 +56,4 @@ namespace nxt { namespace wire {
|
||||
return success;
|
||||
}
|
||||
|
||||
}} // namespace nxt::wire
|
||||
}} // namespace dawn::wire
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "wire/Wire.h"
|
||||
|
||||
namespace nxt { namespace wire {
|
||||
namespace dawn { namespace wire {
|
||||
|
||||
class TerribleCommandBuffer : public CommandSerializer {
|
||||
public:
|
||||
@@ -37,6 +37,6 @@ namespace nxt { namespace wire {
|
||||
char mBuffer[10000000];
|
||||
};
|
||||
|
||||
}} // namespace nxt::wire
|
||||
}} // namespace dawn::wire
|
||||
|
||||
#endif // WIRE_TERRIBLE_COMMAND_BUFFER_H_
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "dawn/dawn.h"
|
||||
|
||||
namespace nxt { namespace wire {
|
||||
namespace dawn { namespace wire {
|
||||
|
||||
class CommandSerializer {
|
||||
public:
|
||||
@@ -41,6 +41,6 @@ namespace nxt { namespace wire {
|
||||
const nxtProcTable& procs,
|
||||
CommandSerializer* serializer);
|
||||
|
||||
}} // namespace nxt::wire
|
||||
}} // namespace dawn::wire
|
||||
|
||||
#endif // WIRE_WIRE_H_
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "wire/WireCmd_autogen.h"
|
||||
|
||||
namespace nxt { namespace wire {
|
||||
namespace dawn { namespace wire {
|
||||
|
||||
struct ReturnDeviceErrorCallbackCmd {
|
||||
wire::ReturnWireCmd commandId = ReturnWireCmd::DeviceErrorCallback;
|
||||
@@ -63,6 +63,6 @@ namespace nxt { namespace wire {
|
||||
uint32_t dataLength;
|
||||
};
|
||||
|
||||
}} // namespace nxt::wire
|
||||
}} // namespace dawn::wire
|
||||
|
||||
#endif // WIRE_WIRECMD_H_
|
||||
|
||||
Reference in New Issue
Block a user