mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Remove custom span and use std::span
With C++20 the custom container PS:span, which was a backport of std::span is no longer needed. Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
parent
2daa5385a8
commit
2cedb48de2
62 changed files with 108 additions and 218 deletions
|
|
@ -33,7 +33,6 @@
|
|||
#include "maths/Vector2D.h"
|
||||
#include "ps/CStrIntern.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "ps/containers/StaticVector.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/backend/Format.h"
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
#include "lib/types.h"
|
||||
#include "maths/Vector3D.h"
|
||||
#include "maths/Vector4D.h"
|
||||
#include "ps/containers/Span.h"
|
||||
|
||||
#include <span>
|
||||
#include <cstddef>
|
||||
|
||||
class CStr8;
|
||||
|
|
@ -71,7 +71,7 @@ struct CColor
|
|||
}
|
||||
|
||||
// For passing to uniform as vec3/vec4.
|
||||
PS::span<const float> AsFloatArray() const
|
||||
std::span<const float> AsFloatArray() const
|
||||
{
|
||||
// Additional check to prevent a weird compiler has a different
|
||||
// alignement for an array and a class members.
|
||||
|
|
@ -82,7 +82,7 @@ struct CColor
|
|||
offsetof(CColor, b) == sizeof(float) * 2u &&
|
||||
offsetof(CColor, a) == sizeof(float) * 3u,
|
||||
"CColor should be properly layouted to use AsFloatArray");
|
||||
return PS::span(&r, 4);
|
||||
return std::span(&r, 4);
|
||||
}
|
||||
|
||||
// For passing to CRenderer:
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include "ps/CLogger.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/Profiler2.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/backend/IDevice.h"
|
||||
#include "renderer/backend/IDeviceCommandContext.h"
|
||||
|
|
@ -38,6 +37,7 @@
|
|||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <numeric>
|
||||
#include <span>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
|
@ -528,7 +528,7 @@ void CFont::BlendGlyphBitmapToTextureRGBA(const FT_Bitmap& bitmap, int targetX,
|
|||
|
||||
for (uint x{0}; x != bitmap.width; ++x)
|
||||
{
|
||||
const PS::span<u8> tempDstRow{dstRow + x * m_TextureFormatStride, 4};
|
||||
const std::span<u8> tempDstRow{dstRow + x * m_TextureFormatStride, 4};
|
||||
u8 alpha{srcRow[x]};
|
||||
|
||||
const float srcAlpha{m_StrokeWidth > 0 ? (*m_GammaCorrectionLUT)[alpha] : alpha/255.0f};
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include "ps/CStrIntern.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
#include "renderer/TimeManager.h"
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@
|
|||
#include "ps/Profile.h"
|
||||
#include "ps/World.h"
|
||||
#include "ps/XML/Xeromyces.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/SceneRenderer.h"
|
||||
#include "renderer/WaterManager.h"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include "lib/sysdep/compiler.h"
|
||||
#include "maths/Vector2D.h"
|
||||
#include "ps/FileIo.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/VertexArray.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include "maths/Matrix3D.h"
|
||||
#include "ps/CStrIntern.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/Scene.h"
|
||||
#include "renderer/SceneRenderer.h"
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ that of Atlas depending on commandline parameters.
|
|||
#include "ps/UserReport.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "ps/XML/Xeromyces.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "rlinterface/RLInterface.h"
|
||||
#include "scriptinterface/JSON.h"
|
||||
|
|
@ -104,6 +103,7 @@ that of Atlas depending on commandline parameters.
|
|||
#include <js/Value.h>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
|
@ -553,7 +553,7 @@ static std::optional<DAP::Interface> CreateDAPInterface(const CmdLineArgs& args)
|
|||
|
||||
// moved into a helper function to ensure args is destroyed before
|
||||
// exit(), which may result in a memory leak.
|
||||
static void RunGameOrAtlas(const PS::span<const char* const> argv)
|
||||
static void RunGameOrAtlas(const std::span<const char* const> argv)
|
||||
{
|
||||
const CmdLineArgs args(argv);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
#include "maths/Vector3D.h"
|
||||
#include "maths/Vector4D.h"
|
||||
#include "ps/containers/Span.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
|
||||
class CQuaternion;
|
||||
|
||||
|
|
@ -334,7 +334,7 @@ public:
|
|||
CVector3D RotateTransposed(const CVector3D& vector) const;
|
||||
|
||||
// Returns 16 element array of floats, e.g. for mat4 uniforms.
|
||||
PS::span<const float> AsFloatArray() const
|
||||
std::span<const float> AsFloatArray() const
|
||||
{
|
||||
// Additional check to prevent a weird compiler has a different
|
||||
// alignement for an array and a class members.
|
||||
|
|
@ -344,7 +344,7 @@ public:
|
|||
offsetof(CMatrix3D, _11) == 0 &&
|
||||
offsetof(CMatrix3D, _44) == sizeof(float) * 15u,
|
||||
"CMatrix3D should be properly layouted to use AsFloatArray");
|
||||
return PS::span<const float>(_data, 16);
|
||||
return std::span<const float>(_data, 16);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,9 @@
|
|||
#ifndef INCLUDED_VECTOR2D
|
||||
#define INCLUDED_VECTOR2D
|
||||
|
||||
#include "ps/containers/Span.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
|
||||
class CSize2D;
|
||||
|
||||
|
|
@ -165,7 +164,7 @@ public:
|
|||
void operator-=(const CSize2D& size);
|
||||
|
||||
// Returns 2 element array of floats, e.g. for vec2 uniforms.
|
||||
PS::span<const float> AsFloatArray() const
|
||||
std::span<const float> AsFloatArray() const
|
||||
{
|
||||
// Additional check to prevent a weird compiler having a different
|
||||
// alignement for an array and a class members.
|
||||
|
|
@ -174,7 +173,7 @@ public:
|
|||
offsetof(CVector2D, X) == 0 &&
|
||||
offsetof(CVector2D, Y) == sizeof(float),
|
||||
"Vector2D should be properly layouted to use AsFloatArray");
|
||||
return PS::span<const float>(&X, 2);
|
||||
return std::span<const float>(&X, 2);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -23,9 +23,8 @@
|
|||
#ifndef INCLUDED_VECTOR3D
|
||||
#define INCLUDED_VECTOR3D
|
||||
|
||||
#include "ps/containers/Span.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
|
||||
class CFixedVector3D;
|
||||
|
||||
|
|
@ -125,7 +124,7 @@ class CVector3D
|
|||
CVector3D Normalized() const;
|
||||
|
||||
// Returns 3 element array of floats, e.g. for vec3 uniforms.
|
||||
PS::span<const float> AsFloatArray() const
|
||||
std::span<const float> AsFloatArray() const
|
||||
{
|
||||
// Additional check to prevent a weird compiler has a different
|
||||
// alignement for an array and a class members.
|
||||
|
|
@ -135,7 +134,7 @@ class CVector3D
|
|||
offsetof(CVector3D, Y) == sizeof(float) &&
|
||||
offsetof(CVector3D, Z) == sizeof(float) * 2u,
|
||||
"Vector3D should be properly layouted to use AsFloatArray");
|
||||
return PS::span<const float>(&X, 3);
|
||||
return std::span<const float>(&X, 3);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,8 @@
|
|||
#ifndef INCLUDED_VECTOR4D
|
||||
#define INCLUDED_VECTOR4D
|
||||
|
||||
#include "ps/containers/Span.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
|
||||
class CVector4D
|
||||
{
|
||||
|
|
@ -127,7 +126,7 @@ public:
|
|||
}
|
||||
|
||||
// Returns 4 element array of floats, e.g. for vec4 uniforms.
|
||||
PS::span<const float> AsFloatArray() const
|
||||
std::span<const float> AsFloatArray() const
|
||||
{
|
||||
// Additional check to prevent a weird compiler has a different
|
||||
// alignement for an array and a class members.
|
||||
|
|
@ -136,7 +135,7 @@ public:
|
|||
offsetof(CVector4D, X) == 0 &&
|
||||
offsetof(CVector4D, W) == sizeof(float) * 3u,
|
||||
"CVector4D should be properly layouted to use AsFloatArray");
|
||||
return PS::span<const float>(&X, 4);
|
||||
return std::span<const float>(&X, 4);
|
||||
}
|
||||
|
||||
float X, Y, Z, W;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2023 Wildfire Games.
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
#include "NetEnet.h"
|
||||
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include <span>
|
||||
|
||||
namespace PS
|
||||
{
|
||||
|
|
@ -49,7 +49,7 @@ ENetHost* CreateHost(const ENetAddress* address, size_t peerCount, size_t channe
|
|||
// Public ENet API doesn't offer a means to change MTU, so do it in a
|
||||
// way least likely to break with ENet updates.
|
||||
host->mtu = g_ConfigDB.Get("network.enetmtu", HOST_DEFAULT_MTU);
|
||||
for (ENetPeer& p : PS::span{host->peers, host->peerCount})
|
||||
for (ENetPeer& p : std::span{host->peers, host->peerCount})
|
||||
enet_peer_reset(&p);
|
||||
|
||||
return host;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
#include "CmdLineArgs.h"
|
||||
|
||||
#include "lib/sysdep/sysdep.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "scriptinterface/Object.h"
|
||||
#include "scriptinterface/ScriptConversions.h"
|
||||
#include "scriptinterface/ScriptRequest.h"
|
||||
|
|
@ -55,7 +54,7 @@ private:
|
|||
|
||||
} // namespace
|
||||
|
||||
CmdLineArgs::CmdLineArgs(const PS::span<const char* const> argv)
|
||||
CmdLineArgs::CmdLineArgs(const std::span<const char* const> argv)
|
||||
{
|
||||
if (argv.empty())
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "lib/os_path.h"
|
||||
#include "ps/CStr.h"
|
||||
|
||||
#include <span>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -40,7 +41,7 @@ public:
|
|||
*
|
||||
* @param argv span of arguments; argv[0] should be the program's name
|
||||
*/
|
||||
CmdLineArgs(const PS::span<const char* const> argv);
|
||||
CmdLineArgs(const std::span<const char* const> argv);
|
||||
|
||||
/**
|
||||
* Test whether the given name was specified, as either <tt>-name</tt> or
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@
|
|||
#include "lib/sysdep/os.h"
|
||||
#include "ps/CStr.h"
|
||||
#include "ps/GameSetup/CmdLineArgs.h"
|
||||
#include "ps/containers/Span.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
class TestCmdLineArgs : public CxxTest::TestSuite
|
||||
|
|
@ -96,7 +96,7 @@ public:
|
|||
CmdLineArgs c(argv);
|
||||
TS_ASSERT_WSTR_EQUALS(c.GetArg0().string(), L"program");
|
||||
|
||||
CmdLineArgs c2(PS::span<const char* const>{});
|
||||
CmdLineArgs c2(std::span<const char* const>{});
|
||||
TS_ASSERT_WSTR_EQUALS(c2.GetArg0().string(), L"");
|
||||
|
||||
const std::array<const char*, 1> argv3 = { "ab/cd/ef/gh/../ij" };
|
||||
|
|
|
|||
|
|
@ -1,89 +0,0 @@
|
|||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 0 A.D. is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_PS_SPAN
|
||||
#define INCLUDED_PS_SPAN
|
||||
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace PS
|
||||
{
|
||||
|
||||
/**
|
||||
* Simplifed version of std::span (C++20) as we don't support the original one
|
||||
* yet. The naming intentionally follows the STL version to make the future
|
||||
* replacement easier with less blame changing.
|
||||
* It supports only very basic subset of std::span functionality.
|
||||
* TODO: remove as soon as std::span become available.
|
||||
*/
|
||||
template<typename T>
|
||||
class span
|
||||
{
|
||||
public:
|
||||
using element_type = T;
|
||||
using value_type = std::remove_cv_t<T>;
|
||||
using size_type = size_t;
|
||||
using pointer = T*;
|
||||
using reference = T&;
|
||||
using iterator = pointer;
|
||||
|
||||
constexpr span()
|
||||
: m_Pointer(nullptr), m_Extent(0) {}
|
||||
|
||||
constexpr span(iterator first, size_type extent)
|
||||
: m_Pointer(first), m_Extent(extent) {}
|
||||
|
||||
constexpr span(iterator first, iterator last)
|
||||
: m_Pointer(first), m_Extent(static_cast<size_type>(last - first)) {}
|
||||
|
||||
template<typename OtherT, size_t N>
|
||||
constexpr span(const std::array<OtherT, N>& arr)
|
||||
: m_Pointer(arr.data()), m_Extent(arr.size()) {}
|
||||
|
||||
template<typename ContinuousRange>
|
||||
constexpr span(ContinuousRange& range)
|
||||
: m_Pointer(range.data()), m_Extent(range.size()) {}
|
||||
|
||||
constexpr span(const span& other) = default;
|
||||
|
||||
constexpr span& operator=(const span& other) = default;
|
||||
|
||||
~span() = default;
|
||||
|
||||
constexpr size_type size() const { return m_Extent; }
|
||||
constexpr bool empty() const { return size() == 0; }
|
||||
constexpr reference operator[](size_type index) const { return *(m_Pointer + index); }
|
||||
constexpr pointer data() const { return m_Pointer; }
|
||||
|
||||
constexpr iterator begin() const { return m_Pointer; }
|
||||
constexpr iterator end() const { return m_Pointer + m_Extent; }
|
||||
|
||||
constexpr span subspan(size_type offset) const { return {m_Pointer + offset, m_Extent - offset}; }
|
||||
|
||||
private:
|
||||
pointer m_Pointer;
|
||||
size_type m_Extent;
|
||||
};
|
||||
|
||||
template<typename T, size_t N>
|
||||
span(const std::array<T, N>&) -> span<const T>;
|
||||
|
||||
} // namespace PS
|
||||
|
||||
#endif // INCLUDED_PS_SPAN
|
||||
|
|
@ -24,7 +24,6 @@
|
|||
#include "graphics/ModelDef.h"
|
||||
#include "graphics/RenderableObject.h"
|
||||
#include "lib/debug.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "ps/containers/StaticVector.h"
|
||||
#include "renderer/ModelRenderer.h"
|
||||
#include "renderer/Renderer.h"
|
||||
|
|
@ -195,7 +194,7 @@ CModelRData* CPUSkinnedModelVertexRenderer::CreateModelData(const void* key, CMo
|
|||
}
|
||||
|
||||
void CPUSkinnedModelVertexRenderer::UpdateModelsData(Renderer::Backend::IDeviceCommandContext*,
|
||||
PS::span<CModel*> models)
|
||||
std::span<CModel*> models)
|
||||
{
|
||||
for (CModel* model : models)
|
||||
{
|
||||
|
|
@ -226,7 +225,7 @@ void CPUSkinnedModelVertexRenderer::UpdateModelData(CModel* model, CModelRData*
|
|||
|
||||
void CPUSkinnedModelVertexRenderer::UploadModelsData(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
PS::span<CModel*> models)
|
||||
std::span<CModel*> models)
|
||||
{
|
||||
for (CModel* model : models)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "renderer/ModelVertexRenderer.h"
|
||||
|
||||
#include <memory>
|
||||
#include <span>
|
||||
|
||||
class CModel;
|
||||
class CModelRData;
|
||||
|
|
@ -41,11 +42,11 @@ public:
|
|||
CModelRData* CreateModelData(const void* key, CModel* model) override;
|
||||
void UpdateModelsData(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
PS::span<CModel*> models) override;
|
||||
std::span<CModel*> models) override;
|
||||
|
||||
void UploadModelsData(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
PS::span<CModel*> models) override;
|
||||
std::span<CModel*> models) override;
|
||||
|
||||
void PrepareModelDef(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include "maths/Matrix3D.h"
|
||||
#include "maths/Vector3D.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/SceneRenderer.h"
|
||||
#include "renderer/backend/Format.h"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@
|
|||
#include "ps/CStrIntern.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/TerrainRenderer.h"
|
||||
#include "renderer/VertexBuffer.h"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#include "ps/CLogger.h"
|
||||
#include "ps/CStrIntern.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "ps/containers/StaticVector.h"
|
||||
#include "renderer/ModelRenderer.h"
|
||||
#include "renderer/Renderer.h"
|
||||
|
|
@ -366,7 +365,7 @@ CModelRData* GPUSkinnedModelModelRenderer::CreateModelData(const void* key, CMod
|
|||
|
||||
void GPUSkinnedModelModelRenderer::UpdateModelsData(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
PS::span<CModel*> models)
|
||||
std::span<CModel*> models)
|
||||
{
|
||||
if (models.empty())
|
||||
return;
|
||||
|
|
@ -434,7 +433,7 @@ void GPUSkinnedModelModelRenderer::UpdateModelData(
|
|||
// Add 1 to NumBones because of the special 'root' bone.
|
||||
deviceCommandContext->SetUniform(
|
||||
shaderProgram->GetBindingSlot(str_skinBlendMatrices),
|
||||
PS::span<const float>(
|
||||
std::span<const float>(
|
||||
model->GetAnimatedBoneMatrices()[0]._data,
|
||||
model->GetAnimatedBoneMatrices()[0].AsFloatArray().size() * (modelDef->GetNumBones() + 1)));
|
||||
|
||||
|
|
@ -455,7 +454,7 @@ void GPUSkinnedModelModelRenderer::UpdateModelData(
|
|||
}
|
||||
|
||||
void GPUSkinnedModelModelRenderer::UploadModelsData(Renderer::Backend::IDeviceCommandContext*,
|
||||
PS::span<CModel*>)
|
||||
std::span<CModel*>)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "renderer/ModelVertexRenderer.h"
|
||||
|
||||
#include <memory>
|
||||
#include <span>
|
||||
|
||||
class CModel;
|
||||
class CModelRData;
|
||||
|
|
@ -43,11 +44,11 @@ public:
|
|||
|
||||
void UpdateModelsData(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
PS::span<CModel*> models) override;
|
||||
std::span<CModel*> models) override;
|
||||
|
||||
void UploadModelsData(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
PS::span<CModel*> models) override;
|
||||
std::span<CModel*> models) override;
|
||||
|
||||
void PrepareModelDef(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
#include "lib/types.h"
|
||||
#include "maths/Vector3D.h"
|
||||
#include "maths/Vector4D.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "ps/containers/StaticVector.h"
|
||||
#include "renderer/ModelRenderer.h"
|
||||
#include "renderer/Renderer.h"
|
||||
|
|
@ -267,13 +266,13 @@ CModelRData* InstancingModelRenderer::CreateModelData(const void* key, CModel* m
|
|||
}
|
||||
|
||||
void InstancingModelRenderer::UpdateModelsData(Renderer::Backend::IDeviceCommandContext*,
|
||||
PS::span<CModel*>)
|
||||
std::span<CModel*>)
|
||||
{
|
||||
// We have no per-CModel data
|
||||
}
|
||||
|
||||
void InstancingModelRenderer::UploadModelsData(Renderer::Backend::IDeviceCommandContext*,
|
||||
PS::span<CModel*>)
|
||||
std::span<CModel*>)
|
||||
{
|
||||
// Data uploaded once during creation as we don't update it dynamically.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2024 Wildfire Games.
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "renderer/ModelVertexRenderer.h"
|
||||
|
||||
#include <span>
|
||||
|
||||
struct InstancingModelRendererInternals;
|
||||
|
||||
/**
|
||||
|
|
@ -42,11 +44,11 @@ public:
|
|||
CModelRData* CreateModelData(const void* key, CModel* model) override;
|
||||
void UpdateModelsData(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
PS::span<CModel*> models) override;
|
||||
std::span<CModel*> models) override;
|
||||
|
||||
void UploadModelsData(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
PS::span<CModel*> models) override;
|
||||
std::span<CModel*> models) override;
|
||||
|
||||
void PrepareModelDef(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
#include "ps/CStrIntern.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/MikktspaceWrap.h"
|
||||
#include "renderer/ModelRenderer.h"
|
||||
#include "renderer/ModelVertexRenderer.h"
|
||||
|
|
@ -60,6 +59,7 @@
|
|||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
|
@ -364,7 +364,7 @@ struct SMRMaterialBucketKeyHash
|
|||
struct SMRTechBucket
|
||||
{
|
||||
CShaderTechniquePtr tech;
|
||||
PS::span<CModel*> models;
|
||||
std::span<CModel*> models;
|
||||
|
||||
// Model list is stored as pointers, not as a std::vector,
|
||||
// so that sorting lists of this struct is fast
|
||||
|
|
|
|||
|
|
@ -25,10 +25,11 @@
|
|||
|
||||
#include "graphics/MeshManager.h"
|
||||
|
||||
#include <span>
|
||||
|
||||
class CModel;
|
||||
class CModelDef;
|
||||
class CModelRData;
|
||||
namespace PS { template <typename T> class span; }
|
||||
namespace Renderer::Backend { class IDeviceCommandContext; }
|
||||
namespace Renderer::Backend { class IShaderProgram; }
|
||||
|
||||
|
|
@ -84,7 +85,7 @@ public:
|
|||
*/
|
||||
virtual void UpdateModelsData(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
PS::span<CModel*> models) = 0;
|
||||
std::span<CModel*> models) = 0;
|
||||
|
||||
/**
|
||||
* Upload per-model data to backend.
|
||||
|
|
@ -100,7 +101,7 @@ public:
|
|||
*/
|
||||
virtual void UploadModelsData(
|
||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext,
|
||||
PS::span<CModel*> models) = 0;
|
||||
std::span<CModel*> models) = 0;
|
||||
|
||||
/**
|
||||
* PrepareModelDef: Setup backend state for rendering of models that
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@
|
|||
#include "ps/CStrIntern.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/DebugRenderer.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/Scene.h"
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@
|
|||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/Game.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/AlphaMapCalculator.h"
|
||||
#include "renderer/BlendShapes.h"
|
||||
#include "renderer/DebugRenderer.h"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#include "ps/Filesystem.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/World.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
#include "renderer/backend/Backend.h"
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@
|
|||
#include "ps/Util.h"
|
||||
#include "ps/VideoMode.h"
|
||||
#include "ps/World.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/DebugRenderer.h"
|
||||
#include "renderer/ModelRenderer.h"
|
||||
#include "renderer/PostprocManager.h"
|
||||
|
|
@ -923,7 +922,7 @@ Renderer::Backend::IDeviceCommandContext* CRenderer::GetDeviceCommandContext()
|
|||
}
|
||||
|
||||
Renderer::Backend::IVertexInputLayout* CRenderer::GetVertexInputLayout(
|
||||
const PS::span<const Renderer::Backend::SVertexAttributeFormat> attributes)
|
||||
const std::span<const Renderer::Backend::SVertexAttributeFormat> attributes)
|
||||
{
|
||||
const auto [it, inserted] = m->vertexInputLayouts.emplace(
|
||||
std::vector<Renderer::Backend::SVertexAttributeFormat>{attributes.begin(), attributes.end()}, nullptr);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
|
||||
class CDebugRenderer;
|
||||
class CFontManager;
|
||||
|
|
@ -32,7 +33,6 @@ class CShaderManager;
|
|||
class CTextureManager;
|
||||
class CTimeManager;
|
||||
class CVertexBufferManager;
|
||||
namespace PS { template <typename T> class span; }
|
||||
namespace Renderer::Backend { class IDevice; }
|
||||
namespace Renderer::Backend { class IDeviceCommandContext; }
|
||||
namespace Renderer::Backend { class IVertexInputLayout; }
|
||||
|
|
@ -142,7 +142,7 @@ public:
|
|||
* TODO: we need to make VertexArray less error prone by passing layout.
|
||||
*/
|
||||
Renderer::Backend::IVertexInputLayout* GetVertexInputLayout(
|
||||
const PS::span<const Renderer::Backend::SVertexAttributeFormat> attributes);
|
||||
const std::span<const Renderer::Backend::SVertexAttributeFormat> attributes);
|
||||
|
||||
protected:
|
||||
friend class CDecalRData;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#include "ps/CStrIntern.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/DebugRenderer.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
|
|
@ -54,6 +53,7 @@
|
|||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
|
|
@ -694,12 +694,12 @@ void ShadowMap::BindTo(
|
|||
}
|
||||
deviceCommandContext->SetUniform(
|
||||
shader->GetBindingSlot(str_shadowTransform),
|
||||
PS::span<const float>(
|
||||
std::span<const float>(
|
||||
shadowTransforms[0]._data,
|
||||
shadowTransforms[0].AsFloatArray().size() * GetCascadeCount()));
|
||||
deviceCommandContext->SetUniform(
|
||||
shader->GetBindingSlot(str_shadowDistance),
|
||||
PS::span<const float>(shadowDistances.data(), shadowDistances.size()));
|
||||
std::span<const float>(shadowDistances.data(), shadowDistances.size()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
#include "ps/CStrIntern.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/DebugRenderer.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/Scene.h"
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/SceneRenderer.h"
|
||||
#include "renderer/backend/Format.h"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#include "ps/Game.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/World.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/SceneRenderer.h"
|
||||
#include "renderer/TerrainRenderer.h"
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
#include "ps/CStrIntern.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/DecalRData.h"
|
||||
#include "renderer/PatchRData.h"
|
||||
#include "renderer/PostprocManager.h"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include "maths/Quaternion.h"
|
||||
#include "ps/CStrIntern.h"
|
||||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/OverlayRenderer.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/VertexBuffer.h"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@
|
|||
#include "ps/CStrInternStatic.h"
|
||||
#include "ps/Game.h"
|
||||
#include "ps/World.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/PostprocManager.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@
|
|||
#include <cstdint>
|
||||
#include <js/TypeDecls.h>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class CShaderDefines;
|
||||
class CStr;
|
||||
class ScriptRequest;
|
||||
namespace PS { template <typename T> class span; }
|
||||
namespace Renderer::Backend { class IComputePipelineState; }
|
||||
namespace Renderer::Backend { class IDeviceCommandContext; }
|
||||
namespace Renderer::Backend { class IFramebuffer; }
|
||||
|
|
@ -109,7 +109,7 @@ public:
|
|||
* layouts as posible.
|
||||
*/
|
||||
virtual std::unique_ptr<IVertexInputLayout> CreateVertexInputLayout(
|
||||
const PS::span<const SVertexAttributeFormat> attributes) = 0;
|
||||
const std::span<const SVertexAttributeFormat> attributes) = 0;
|
||||
|
||||
virtual std::unique_ptr<ITexture> CreateTexture(
|
||||
const char* name, const ITexture::Type type, const uint32_t usage,
|
||||
|
|
|
|||
|
|
@ -21,11 +21,12 @@
|
|||
#include "lib/types.h"
|
||||
|
||||
#include "renderer/backend/IDeviceObject.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <span>
|
||||
|
||||
namespace PS { template <typename T> class span; }
|
||||
namespace Renderer::Backend { class IComputePipelineState; }
|
||||
namespace Renderer::Backend { class IGraphicsPipelineState; }
|
||||
namespace Renderer::Backend { class IVertexInputLayout; }
|
||||
|
|
@ -223,7 +224,7 @@ public:
|
|||
const float valueX, const float valueY,
|
||||
const float valueZ, const float valueW) = 0;
|
||||
virtual void SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values) = 0;
|
||||
const int32_t bindingSlot, std::span<const float> values) = 0;
|
||||
|
||||
/**
|
||||
* Insert a timestamp query which can be later requested via IDevice.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "Device.h"
|
||||
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/backend/Format.h"
|
||||
#include "renderer/backend/IFramebuffer.h"
|
||||
#include "renderer/backend/dummy/Buffer.h"
|
||||
|
|
@ -90,7 +89,7 @@ std::unique_ptr<IComputePipelineState> CDevice::CreateComputePipelineState(
|
|||
}
|
||||
|
||||
std::unique_ptr<IVertexInputLayout> CDevice::CreateVertexInputLayout(
|
||||
const PS::span<const SVertexAttributeFormat>)
|
||||
const std::span<const SVertexAttributeFormat>)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <cstdint>
|
||||
#include <js/TypeDecls.h>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -65,7 +66,7 @@ public:
|
|||
const SComputePipelineStateDesc& pipelineStateDesc) override;
|
||||
|
||||
std::unique_ptr<IVertexInputLayout> CreateVertexInputLayout(
|
||||
const PS::span<const SVertexAttributeFormat> attributes) override;
|
||||
const std::span<const SVertexAttributeFormat> attributes) override;
|
||||
|
||||
std::unique_ptr<ITexture> CreateTexture(
|
||||
const char* name, const ITexture::Type type, const uint32_t usage,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "DeviceCommandContext.h"
|
||||
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/backend/dummy/Device.h"
|
||||
|
||||
namespace Renderer
|
||||
|
|
@ -238,7 +237,7 @@ void CDeviceCommandContext::SetUniform(
|
|||
{
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetUniform(const int32_t, PS::span<const float>)
|
||||
void CDeviceCommandContext::SetUniform(const int32_t, std::span<const float>)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
|
||||
namespace Renderer::Backend::Dummy { class CDevice; }
|
||||
|
||||
|
|
@ -142,7 +143,7 @@ public:
|
|||
const float valueX, const float valueY,
|
||||
const float valueZ, const float valueW) override;
|
||||
void SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values) override;
|
||||
const int32_t bindingSlot, std::span<const float> values) override;
|
||||
|
||||
void InsertTimestampQuery(const uint32_t handle, const bool isScopeBegin) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include "ps/CLogger.h"
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/backend/Format.h"
|
||||
#include "renderer/backend/gl/Buffer.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
|
|
@ -919,7 +918,7 @@ std::unique_ptr<IComputePipelineState> CDevice::CreateComputePipelineState(
|
|||
}
|
||||
|
||||
std::unique_ptr<IVertexInputLayout> CDevice::CreateVertexInputLayout(
|
||||
const PS::span<const SVertexAttributeFormat> attributes)
|
||||
const std::span<const SVertexAttributeFormat> attributes)
|
||||
{
|
||||
return std::make_unique<CVertexInputLayout>(this, attributes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include <cstdint>
|
||||
#include <js/TypeDecls.h>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <unordered_map>
|
||||
|
|
@ -79,7 +80,7 @@ public:
|
|||
const SComputePipelineStateDesc& pipelineStateDesc) override;
|
||||
|
||||
std::unique_ptr<IVertexInputLayout> CreateVertexInputLayout(
|
||||
const PS::span<const SVertexAttributeFormat> attributes) override;
|
||||
const std::span<const SVertexAttributeFormat> attributes) override;
|
||||
|
||||
CDeviceCommandContext* GetActiveCommandContext() { return m_ActiveCommandContext; }
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include "lib/config2.h"
|
||||
#include "lib/debug.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/backend/Barrier.h"
|
||||
#include "renderer/backend/Format.h"
|
||||
#include "renderer/backend/IFramebuffer.h"
|
||||
|
|
@ -1421,7 +1420,7 @@ void CDeviceCommandContext::SetUniform(
|
|||
}
|
||||
|
||||
void CDeviceCommandContext::SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values)
|
||||
const int32_t bindingSlot, std::span<const float> values)
|
||||
{
|
||||
ENSURE(m_ShaderProgram);
|
||||
m_ShaderProgram->SetUniform(bindingSlot, values);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <utility>
|
||||
|
||||
namespace Renderer::Backend { enum class Format; }
|
||||
|
|
@ -157,7 +158,7 @@ public:
|
|||
const float valueX, const float valueY,
|
||||
const float valueZ, const float valueW) override;
|
||||
void SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values) override;
|
||||
const int32_t bindingSlot, std::span<const float> values) override;
|
||||
|
||||
void InsertTimestampQuery(const uint32_t handle, const bool isScopeBegin) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ public:
|
|||
}
|
||||
|
||||
void SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values) override
|
||||
const int32_t bindingSlot, std::span<const float> values) override
|
||||
{
|
||||
if (bindingSlot < 0 || bindingSlot >= static_cast<int32_t>(m_BindingSlots.size()))
|
||||
return;
|
||||
|
|
@ -619,7 +619,7 @@ private:
|
|||
}
|
||||
|
||||
void SetUniformMatrix(
|
||||
const BindingSlot& bindingSlot, PS::span<const float> values)
|
||||
const BindingSlot& bindingSlot, std::span<const float> values)
|
||||
{
|
||||
const size_t mat4ElementCount = 16;
|
||||
ENSURE(values.size() == mat4ElementCount);
|
||||
|
|
@ -628,7 +628,7 @@ private:
|
|||
}
|
||||
|
||||
void SetUniformMatrix(
|
||||
const GLenum target, const int location, PS::span<const float> values)
|
||||
const GLenum target, const int location, std::span<const float> values)
|
||||
{
|
||||
if (location >= 0)
|
||||
{
|
||||
|
|
@ -661,7 +661,7 @@ class CShaderProgramGLSL final : public CShaderProgram
|
|||
public:
|
||||
CShaderProgramGLSL(
|
||||
CDevice* device, const CStr& name,
|
||||
const VfsPath& programPath, PS::span<const std::tuple<VfsPath, GLenum>> shaderStages,
|
||||
const VfsPath& programPath, std::span<const std::tuple<VfsPath, GLenum>> shaderStages,
|
||||
const CShaderDefines& defines,
|
||||
const std::map<CStrIntern, int>& vertexAttribs,
|
||||
int streamflags) :
|
||||
|
|
@ -1201,7 +1201,7 @@ public:
|
|||
}
|
||||
|
||||
void SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values) override
|
||||
const int32_t bindingSlot, std::span<const float> values) override
|
||||
{
|
||||
if (bindingSlot < 0 || bindingSlot >= static_cast<int32_t>(m_BindingSlots.size()))
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@
|
|||
#include "lib/debug.h"
|
||||
#include "lib/ogl.h"
|
||||
#include "ps/CStr.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/backend/Format.h"
|
||||
#include "renderer/backend/IShaderProgram.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
class CShaderDefines;
|
||||
|
|
@ -46,7 +46,7 @@ namespace GL
|
|||
class CVertexInputLayout : public IVertexInputLayout
|
||||
{
|
||||
public:
|
||||
CVertexInputLayout(CDevice* device, const PS::span<const SVertexAttributeFormat> attributes)
|
||||
CVertexInputLayout(CDevice* device, const std::span<const SVertexAttributeFormat> attributes)
|
||||
: m_Device(device), m_Attributes(attributes.begin(), attributes.end())
|
||||
{
|
||||
for (const SVertexAttributeFormat& attribute : m_Attributes)
|
||||
|
|
@ -130,7 +130,7 @@ public:
|
|||
const float valueX, const float valueY,
|
||||
const float valueZ, const float valueW) = 0;
|
||||
virtual void SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values) = 0;
|
||||
const int32_t bindingSlot, std::span<const float> values) = 0;
|
||||
|
||||
// Vertex attribute pointers (equivalent to glVertexPointer etc).
|
||||
virtual void VertexAttribPointer(
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include "graphics/Color.h"
|
||||
#include "lib/config2.h"
|
||||
#include "lib/debug.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/backend/Sampler.h"
|
||||
#include "renderer/backend/gl/Device.h"
|
||||
#include "renderer/backend/gl/DeviceCommandContext.h"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include "ps/CLogger.h"
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "ps/containers/StaticVector.h"
|
||||
#include "renderer/backend/Format.h"
|
||||
#include "renderer/backend/vulkan/Buffer.h"
|
||||
|
|
@ -747,7 +746,7 @@ std::unique_ptr<IComputePipelineState> CDevice::CreateComputePipelineState(
|
|||
}
|
||||
|
||||
std::unique_ptr<IVertexInputLayout> CDevice::CreateVertexInputLayout(
|
||||
const PS::span<const SVertexAttributeFormat> attributes)
|
||||
const std::span<const SVertexAttributeFormat> attributes)
|
||||
{
|
||||
return std::make_unique<CVertexInputLayout>(this, attributes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include <limits>
|
||||
#include <memory>
|
||||
#include <queue>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
|
@ -90,7 +91,7 @@ public:
|
|||
const SComputePipelineStateDesc& pipelineStateDesc) override;
|
||||
|
||||
std::unique_ptr<IVertexInputLayout> CreateVertexInputLayout(
|
||||
const PS::span<const SVertexAttributeFormat> attributes) override;
|
||||
const std::span<const SVertexAttributeFormat> attributes) override;
|
||||
|
||||
std::unique_ptr<ITexture> CreateTexture(
|
||||
const char* name, const ITexture::Type type, const uint32_t usage,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include "lib/debug.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "ps/containers/StaticVector.h"
|
||||
#include "renderer/backend/Format.h"
|
||||
#include "renderer/backend/IBuffer.h"
|
||||
|
|
@ -112,7 +111,7 @@ class ScopedImageLayoutTransition
|
|||
{
|
||||
public:
|
||||
ScopedImageLayoutTransition(
|
||||
CRingCommandContext& commandContext, const PS::span<CTexture* const> textures,
|
||||
CRingCommandContext& commandContext, const std::span<CTexture* const> textures,
|
||||
const VkImageLayout layout, const VkAccessFlags accessMask, const VkPipelineStageFlags stageMask)
|
||||
: m_CommandContext(commandContext), m_Textures(textures), m_Layout(layout),
|
||||
m_AccessMask(accessMask), m_StageMask(stageMask)
|
||||
|
|
@ -147,7 +146,7 @@ public:
|
|||
|
||||
private:
|
||||
CRingCommandContext& m_CommandContext;
|
||||
const PS::span<CTexture* const> m_Textures;
|
||||
const std::span<CTexture* const> m_Textures;
|
||||
const VkImageLayout m_Layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
const VkAccessFlags m_AccessMask = 0;
|
||||
const VkPipelineStageFlags m_StageMask = 0;
|
||||
|
|
@ -215,7 +214,7 @@ public:
|
|||
CBuffer* GetBuffer() { return m_Buffer.get(); }
|
||||
|
||||
uint32_t ScheduleUpload(
|
||||
VkCommandBuffer commandBuffer, const PS::span<const std::byte> data,
|
||||
VkCommandBuffer commandBuffer, const std::span<const std::byte> data,
|
||||
const uint32_t alignment);
|
||||
|
||||
void ExecuteUploads(VkCommandBuffer commandBuffer);
|
||||
|
|
@ -271,7 +270,7 @@ void CDeviceCommandContext::CUploadRing::ResizeIfNeeded(
|
|||
}
|
||||
|
||||
uint32_t CDeviceCommandContext::CUploadRing::ScheduleUpload(
|
||||
VkCommandBuffer commandBuffer, const PS::span<const std::byte> data,
|
||||
VkCommandBuffer commandBuffer, const std::span<const std::byte> data,
|
||||
const uint32_t alignment)
|
||||
{
|
||||
ENSURE(data.size() > 0);
|
||||
|
|
@ -820,7 +819,7 @@ void CDeviceCommandContext::SetVertexBufferData(
|
|||
|
||||
const uint32_t offset = m_VertexUploadRing->ScheduleUpload(
|
||||
m_PrependCommandContext->GetCommandBuffer(),
|
||||
PS::span<const std::byte>{static_cast<const std::byte*>(data), dataSize}, ALIGNMENT);
|
||||
std::span<const std::byte>{static_cast<const std::byte*>(data), dataSize}, ALIGNMENT);
|
||||
BindVertexBuffer(bindingSlot, m_VertexUploadRing->GetBuffer(), offset);
|
||||
}
|
||||
|
||||
|
|
@ -837,7 +836,7 @@ void CDeviceCommandContext::SetIndexBufferData(
|
|||
|
||||
const uint32_t offset = m_IndexUploadRing->ScheduleUpload(
|
||||
m_PrependCommandContext->GetCommandBuffer(),
|
||||
PS::span<const std::byte>{static_cast<const std::byte*>(data), dataSize}, ALIGNMENT);
|
||||
std::span<const std::byte>{static_cast<const std::byte*>(data), dataSize}, ALIGNMENT);
|
||||
BindIndexBuffer(m_IndexUploadRing->GetBuffer(), offset);
|
||||
}
|
||||
|
||||
|
|
@ -1017,7 +1016,7 @@ void CDeviceCommandContext::SetUniform(
|
|||
}
|
||||
|
||||
void CDeviceCommandContext::SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values)
|
||||
const int32_t bindingSlot, std::span<const float> values)
|
||||
{
|
||||
ENSURE(m_InsidePass || m_InsideComputePass);
|
||||
m_ShaderProgram->SetUniform(bindingSlot, values);
|
||||
|
|
@ -1158,7 +1157,7 @@ void CDeviceCommandContext::UpdateOutdatedConstants()
|
|||
std::max(static_cast<VkDeviceSize>(16), m_Device->GetChoosenPhysicalDevice().properties.limits.minUniformBufferOffsetAlignment);
|
||||
const uint32_t offset = m_UniformUploadRing->ScheduleUpload(
|
||||
m_PrependCommandContext->GetCommandBuffer(),
|
||||
PS::span<const std::byte>{
|
||||
std::span<const std::byte>{
|
||||
m_ShaderProgram->GetMaterialConstantsData(),
|
||||
m_ShaderProgram->GetMaterialConstantsDataSize()}, alignment);
|
||||
m_ShaderProgram->UpdateMaterialConstantsData();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <cstdint>
|
||||
#include <glad/vulkan.h>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
|
|
@ -149,7 +150,7 @@ public:
|
|||
const float valueX, const float valueY,
|
||||
const float valueZ, const float valueW) override;
|
||||
void SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values) override;
|
||||
const int32_t bindingSlot, std::span<const float> values) override;
|
||||
|
||||
void InsertTimestampQuery(const uint32_t handle, const bool isScopeBegin) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -793,7 +793,7 @@ void CShaderProgram::SetUniform(
|
|||
const float value)
|
||||
{
|
||||
const float values[1] = {value};
|
||||
SetUniform(bindingSlot, PS::span<const float>(values, values + 1));
|
||||
SetUniform(bindingSlot, std::span<const float>(values, values + 1));
|
||||
}
|
||||
|
||||
void CShaderProgram::SetUniform(
|
||||
|
|
@ -801,7 +801,7 @@ void CShaderProgram::SetUniform(
|
|||
const float valueX, const float valueY)
|
||||
{
|
||||
const float values[2] = {valueX, valueY};
|
||||
SetUniform(bindingSlot, PS::span<const float>(values, values + 2));
|
||||
SetUniform(bindingSlot, std::span<const float>(values, values + 2));
|
||||
}
|
||||
|
||||
void CShaderProgram::SetUniform(
|
||||
|
|
@ -810,7 +810,7 @@ void CShaderProgram::SetUniform(
|
|||
const float valueZ)
|
||||
{
|
||||
const float values[3] = {valueX, valueY, valueZ};
|
||||
SetUniform(bindingSlot, PS::span<const float>(values, values + 3));
|
||||
SetUniform(bindingSlot, std::span<const float>(values, values + 3));
|
||||
}
|
||||
|
||||
void CShaderProgram::SetUniform(
|
||||
|
|
@ -819,10 +819,10 @@ void CShaderProgram::SetUniform(
|
|||
const float valueZ, const float valueW)
|
||||
{
|
||||
const float values[4] = {valueX, valueY, valueZ, valueW};
|
||||
SetUniform(bindingSlot, PS::span<const float>(values, values + 4));
|
||||
SetUniform(bindingSlot, std::span<const float>(values, values + 4));
|
||||
}
|
||||
|
||||
void CShaderProgram::SetUniform(const int32_t bindingSlot, PS::span<const float> values)
|
||||
void CShaderProgram::SetUniform(const int32_t bindingSlot, std::span<const float> values)
|
||||
{
|
||||
if (bindingSlot < 0)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include "lib/file/vfs/vfs_path.h"
|
||||
#include "ps/CStr.h"
|
||||
#include "ps/CStrIntern.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "renderer/backend/Format.h"
|
||||
#include "renderer/backend/IShaderProgram.h"
|
||||
#include "renderer/backend/vulkan/DescriptorManager.h"
|
||||
|
|
@ -33,6 +32,7 @@
|
|||
#include <glad/vulkan.h>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
|
@ -56,7 +56,7 @@ namespace Vulkan
|
|||
class CVertexInputLayout : public IVertexInputLayout
|
||||
{
|
||||
public:
|
||||
CVertexInputLayout(CDevice* device, const PS::span<const SVertexAttributeFormat> attributes)
|
||||
CVertexInputLayout(CDevice* device, const std::span<const SVertexAttributeFormat> attributes)
|
||||
: m_Device(device), m_Attributes(attributes.begin(), attributes.end())
|
||||
{
|
||||
static uint32_t m_LastAvailableUID = 1;
|
||||
|
|
@ -125,7 +125,7 @@ public:
|
|||
const float valueX, const float valueY,
|
||||
const float valueZ, const float valueW);
|
||||
void SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values);
|
||||
const int32_t bindingSlot, std::span<const float> values);
|
||||
|
||||
void SetTexture(const int32_t bindingSlot, CTexture* texture);
|
||||
void SetStorageTexture(const int32_t bindingSlot, CTexture* texture);
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@
|
|||
#include "lib/types.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "soundmanager/SoundManager.h"
|
||||
#include "soundmanager/data/ogg.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
/*
|
||||
|
|
@ -128,7 +128,7 @@ int COggData::FetchDataIntoBuffer(int count, ALuint* buffers)
|
|||
for (int i{0}; i < count && !m_FileFinished; ++i)
|
||||
{
|
||||
std::fill(PCMOut.begin(), PCMOut.end(), 0);
|
||||
const size_t totalRet{m_Stream->GetNextChunk(PS::span<u8>(PCMOut))};
|
||||
const size_t totalRet{m_Stream->GetNextChunk(std::span<u8>(PCMOut))};
|
||||
m_FileFinished = m_Stream->AtFileEOF();
|
||||
if (totalRet == 0)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#include "lib/posix/posix_types.h"
|
||||
#include "maths/MathUtil.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/containers/Span.h"
|
||||
|
||||
#include <AL/al.h>
|
||||
#include <algorithm>
|
||||
|
|
@ -187,7 +186,7 @@ public:
|
|||
return INFO::OK;
|
||||
}
|
||||
|
||||
virtual size_t GetNextChunk(PS::span<u8> buffer)
|
||||
virtual size_t GetNextChunk(std::span<u8> buffer)
|
||||
{
|
||||
// We may have to call ov_read multiple times because it
|
||||
// treats the buffer size "as a limit and not a request".
|
||||
|
|
|
|||
|
|
@ -29,8 +29,7 @@
|
|||
#include <AL/al.h>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
|
||||
namespace PS { template <typename T> class span; }
|
||||
#include <span>
|
||||
|
||||
class OggStream
|
||||
{
|
||||
|
|
@ -41,7 +40,7 @@ public:
|
|||
virtual bool AtFileEOF() = 0;
|
||||
virtual Status ResetFile() = 0;
|
||||
|
||||
virtual size_t GetNextChunk(PS::span<u8> buffer) = 0;
|
||||
virtual size_t GetNextChunk(std::span<u8> buffer) = 0;
|
||||
};
|
||||
|
||||
using OggStreamPtr = std::shared_ptr<OggStream>;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include "lib/path.h"
|
||||
#include "lib/timer.h"
|
||||
#include "maths/Vector3D.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "soundmanager/ISoundManager.h"
|
||||
#include "soundmanager/SoundManager.h"
|
||||
#include "soundmanager/data/SoundData.h"
|
||||
|
|
|
|||
Loading…
Reference in a new issue