Misc: Swap gsl::span for std::span
This commit is contained in:
@ -68,7 +68,7 @@ public:
|
||||
|
||||
std::unique_ptr<GPUFramebuffer> CreateFramebuffer(GPUTexture* rt_or_ds, GPUTexture* ds = nullptr) override;
|
||||
|
||||
std::unique_ptr<GPUShader> CreateShaderFromBinary(GPUShaderStage stage, gsl::span<const u8> data) override;
|
||||
std::unique_ptr<GPUShader> CreateShaderFromBinary(GPUShaderStage stage, std::span<const u8> data) override;
|
||||
std::unique_ptr<GPUShader> CreateShaderFromSource(GPUShaderStage stage, const std::string_view& source,
|
||||
const char* entry_point, DynamicHeapArray<u8>* binary) override;
|
||||
std::unique_ptr<GPUPipeline> CreatePipeline(const GPUPipeline::GraphicsConfig& config) override;
|
||||
|
||||
@ -51,7 +51,7 @@ void D3D11Shader::SetDebugName(const std::string_view& name)
|
||||
SetD3DDebugObjectName(m_shader.Get(), name);
|
||||
}
|
||||
|
||||
std::unique_ptr<GPUShader> D3D11Device::CreateShaderFromBinary(GPUShaderStage stage, gsl::span<const u8> data)
|
||||
std::unique_ptr<GPUShader> D3D11Device::CreateShaderFromBinary(GPUShaderStage stage, std::span<const u8> data)
|
||||
{
|
||||
ComPtr<ID3D11DeviceChild> shader;
|
||||
std::vector<u8> bytecode;
|
||||
|
||||
@ -88,7 +88,7 @@ public:
|
||||
|
||||
std::unique_ptr<GPUFramebuffer> CreateFramebuffer(GPUTexture* rt_or_ds, GPUTexture* ds = nullptr) override;
|
||||
|
||||
std::unique_ptr<GPUShader> CreateShaderFromBinary(GPUShaderStage stage, gsl::span<const u8> data) override;
|
||||
std::unique_ptr<GPUShader> CreateShaderFromBinary(GPUShaderStage stage, std::span<const u8> data) override;
|
||||
std::unique_ptr<GPUShader> CreateShaderFromSource(GPUShaderStage stage, const std::string_view& source,
|
||||
const char* entry_point, DynamicHeapArray<u8>* out_binary) override;
|
||||
std::unique_ptr<GPUPipeline> CreatePipeline(const GPUPipeline::GraphicsConfig& config) override;
|
||||
|
||||
@ -25,7 +25,7 @@ void D3D12Shader::SetDebugName(const std::string_view& name)
|
||||
{
|
||||
}
|
||||
|
||||
std::unique_ptr<GPUShader> D3D12Device::CreateShaderFromBinary(GPUShaderStage stage, gsl::span<const u8> data)
|
||||
std::unique_ptr<GPUShader> D3D12Device::CreateShaderFromBinary(GPUShaderStage stage, std::span<const u8> data)
|
||||
{
|
||||
// Can't do much at this point.
|
||||
std::vector bytecode(data.begin(), data.end());
|
||||
|
||||
@ -12,10 +12,9 @@
|
||||
#include "common/rectangle.h"
|
||||
#include "common/types.h"
|
||||
|
||||
#include "gsl/span"
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
@ -231,7 +230,7 @@ public:
|
||||
|
||||
struct InputLayout
|
||||
{
|
||||
gsl::span<const VertexAttribute> vertex_attributes;
|
||||
std::span<const VertexAttribute> vertex_attributes;
|
||||
u32 vertex_stride;
|
||||
|
||||
bool operator==(const InputLayout& rhs) const;
|
||||
@ -634,7 +633,7 @@ protected:
|
||||
virtual bool ReadPipelineCache(const std::string& filename);
|
||||
virtual bool GetPipelineCacheData(DynamicHeapArray<u8>* data);
|
||||
|
||||
virtual std::unique_ptr<GPUShader> CreateShaderFromBinary(GPUShaderStage stage, gsl::span<const u8> data) = 0;
|
||||
virtual std::unique_ptr<GPUShader> CreateShaderFromBinary(GPUShaderStage stage, std::span<const u8> data) = 0;
|
||||
virtual std::unique_ptr<GPUShader> CreateShaderFromSource(GPUShaderStage stage, const std::string_view& source,
|
||||
const char* entry_point,
|
||||
DynamicHeapArray<u8>* out_binary) = 0;
|
||||
|
||||
@ -224,7 +224,7 @@ public:
|
||||
|
||||
std::unique_ptr<GPUFramebuffer> CreateFramebuffer(GPUTexture* rt_or_ds, GPUTexture* ds = nullptr) override;
|
||||
|
||||
std::unique_ptr<GPUShader> CreateShaderFromBinary(GPUShaderStage stage, gsl::span<const u8> data) override;
|
||||
std::unique_ptr<GPUShader> CreateShaderFromBinary(GPUShaderStage stage, std::span<const u8> data) override;
|
||||
std::unique_ptr<GPUShader> CreateShaderFromSource(GPUShaderStage stage, const std::string_view& source,
|
||||
const char* entry_point,
|
||||
DynamicHeapArray<u8>* out_binary = nullptr) override;
|
||||
|
||||
@ -637,7 +637,7 @@ std::unique_ptr<GPUShader> MetalDevice::CreateShaderFromMSL(GPUShaderStage stage
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<GPUShader> MetalDevice::CreateShaderFromBinary(GPUShaderStage stage, gsl::span<const u8> data)
|
||||
std::unique_ptr<GPUShader> MetalDevice::CreateShaderFromBinary(GPUShaderStage stage, std::span<const u8> data)
|
||||
{
|
||||
const std::string_view str_data(reinterpret_cast<const char*>(data.data()), data.size());
|
||||
return CreateShaderFromMSL(stage, str_data, "main0");
|
||||
|
||||
@ -68,7 +68,7 @@ public:
|
||||
|
||||
std::unique_ptr<GPUFramebuffer> CreateFramebuffer(GPUTexture* rt_or_ds, GPUTexture* ds = nullptr) override;
|
||||
|
||||
std::unique_ptr<GPUShader> CreateShaderFromBinary(GPUShaderStage stage, gsl::span<const u8> data) override;
|
||||
std::unique_ptr<GPUShader> CreateShaderFromBinary(GPUShaderStage stage, std::span<const u8> data) override;
|
||||
std::unique_ptr<GPUShader> CreateShaderFromSource(GPUShaderStage stage, const std::string_view& source,
|
||||
const char* entry_point, DynamicHeapArray<u8>* out_binary) override;
|
||||
std::unique_ptr<GPUPipeline> CreatePipeline(const GPUPipeline::GraphicsConfig& config) override;
|
||||
@ -111,7 +111,7 @@ public:
|
||||
void UnrefProgram(const OpenGLPipeline::ProgramCacheKey& key);
|
||||
|
||||
GLuint LookupVAOCache(const OpenGLPipeline::VertexArrayCacheKey& key);
|
||||
GLuint CreateVAO(gsl::span<const GPUPipeline::VertexAttribute> attributes, u32 stride);
|
||||
GLuint CreateVAO(std::span<const GPUPipeline::VertexAttribute> attributes, u32 stride);
|
||||
void UnrefVAO(const OpenGLPipeline::VertexArrayCacheKey& key);
|
||||
|
||||
void SetActiveTexture(u32 slot);
|
||||
|
||||
@ -168,7 +168,7 @@ bool OpenGLShader::Compile()
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<GPUShader> OpenGLDevice::CreateShaderFromBinary(GPUShaderStage stage, gsl::span<const u8> data)
|
||||
std::unique_ptr<GPUShader> OpenGLDevice::CreateShaderFromBinary(GPUShaderStage stage, std::span<const u8> data)
|
||||
{
|
||||
// Not supported.. except spir-v maybe? but no point really...
|
||||
return {};
|
||||
@ -455,7 +455,7 @@ GLuint OpenGLDevice::LookupVAOCache(const OpenGLPipeline::VertexArrayCacheKey& k
|
||||
|
||||
OpenGLPipeline::VertexArrayCacheItem item;
|
||||
item.vao_id =
|
||||
CreateVAO(gsl::span<const GPUPipeline::VertexAttribute>(key.vertex_attributes, key.num_vertex_attributes),
|
||||
CreateVAO(std::span<const GPUPipeline::VertexAttribute>(key.vertex_attributes, key.num_vertex_attributes),
|
||||
key.vertex_attribute_stride);
|
||||
if (item.vao_id == 0)
|
||||
return 0;
|
||||
@ -465,7 +465,7 @@ GLuint OpenGLDevice::LookupVAOCache(const OpenGLPipeline::VertexArrayCacheKey& k
|
||||
return item.vao_id;
|
||||
}
|
||||
|
||||
GLuint OpenGLDevice::CreateVAO(gsl::span<const GPUPipeline::VertexAttribute> attributes, u32 stride)
|
||||
GLuint OpenGLDevice::CreateVAO(std::span<const GPUPipeline::VertexAttribute> attributes, u32 stride)
|
||||
{
|
||||
glGetError();
|
||||
GLuint vao;
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
#include "common/types.h"
|
||||
|
||||
#include "fmt/format.h"
|
||||
#include "gsl/span"
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
@ -18,6 +17,7 @@
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
|
||||
@ -173,7 +173,7 @@ std::optional<SPIRVCompiler::SPIRVCodeVector> SPIRVCompiler::CompileShader(GPUSh
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
std::optional<std::string> SPIRVCompiler::CompileSPIRVToMSL(gsl::span<const SPIRVCodeType> spv)
|
||||
std::optional<std::string> SPIRVCompiler::CompileSPIRVToMSL(std::span<const SPIRVCodeType> spv)
|
||||
{
|
||||
spirv_cross::CompilerMSL compiler(spv.data(), spv.size());
|
||||
std::string msl = compiler.compile();
|
||||
|
||||
@ -5,9 +5,8 @@
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
#include "gsl/span"
|
||||
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
@ -43,7 +42,7 @@ std::optional<SPIRVCodeVector> CompileShader(GPUShaderStage stage, std::string_v
|
||||
#ifdef __APPLE__
|
||||
|
||||
// Converts a SPIR-V shader into MSL.
|
||||
std::optional<std::string> CompileSPIRVToMSL(gsl::span<const SPIRVCodeType> spv);
|
||||
std::optional<std::string> CompileSPIRVToMSL(std::span<const SPIRVCodeType> spv);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ public:
|
||||
|
||||
std::unique_ptr<GPUFramebuffer> CreateFramebuffer(GPUTexture* rt_or_ds, GPUTexture* ds = nullptr) override;
|
||||
|
||||
std::unique_ptr<GPUShader> CreateShaderFromBinary(GPUShaderStage stage, gsl::span<const u8> data) override;
|
||||
std::unique_ptr<GPUShader> CreateShaderFromBinary(GPUShaderStage stage, std::span<const u8> data) override;
|
||||
std::unique_ptr<GPUShader> CreateShaderFromSource(GPUShaderStage stage, const std::string_view& source,
|
||||
const char* entry_point, DynamicHeapArray<u8>* out_binary) override;
|
||||
std::unique_ptr<GPUPipeline> CreatePipeline(const GPUPipeline::GraphicsConfig& config) override;
|
||||
|
||||
@ -25,7 +25,7 @@ void VulkanShader::SetDebugName(const std::string_view& name)
|
||||
Vulkan::SetObjectName(VulkanDevice::GetInstance().GetVulkanDevice(), m_module, name);
|
||||
}
|
||||
|
||||
std::unique_ptr<GPUShader> VulkanDevice::CreateShaderFromBinary(GPUShaderStage stage, gsl::span<const u8> data)
|
||||
std::unique_ptr<GPUShader> VulkanDevice::CreateShaderFromBinary(GPUShaderStage stage, std::span<const u8> data)
|
||||
{
|
||||
VkShaderModule mod;
|
||||
|
||||
@ -67,7 +67,7 @@ std::unique_ptr<GPUShader> VulkanDevice::CreateShaderFromSource(GPUShaderStage s
|
||||
std::memcpy(out_binary->data(), spirv->data(), spirv_size);
|
||||
}
|
||||
|
||||
return CreateShaderFromBinary(stage, gsl::span<const u8>(reinterpret_cast<const u8*>(spirv->data()), spirv_size));
|
||||
return CreateShaderFromBinary(stage, std::span<const u8>(reinterpret_cast<const u8*>(spirv->data()), spirv_size));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user