Some warning fixes

This commit is contained in:
2023-10-29 09:20:23 +01:00
parent 1ca861459c
commit 7773c55e1a
10 changed files with 66 additions and 16 deletions
+2 -2
View File
@@ -124,7 +124,7 @@ if(MSVC)
Seele.natvis
DESTINATION .)
else()
target_compile_options(Engine PUBLIC -g -Wall -Wextra -Wno-delete-incomplete -pedantic -fcoroutines)
target_compile_options(Engine PUBLIC -g -Wall -Wextra -Wno-delete-incomplete -pedantic -std=c++20)
endif()
add_subdirectory(src/)
@@ -189,4 +189,4 @@ install(
${CMAKE_SOURCE_DIR}/res
DESTINATION
${CMAKE_INSTALL_PREFIX}
)
)
+1
View File
@@ -0,0 +1 @@
bin/compile_commands.json
+2 -2
View File
@@ -196,7 +196,7 @@ public:
, comp(comp)
{
}
constexpr explicit Map(const Allocator& alloc) noexcept(noexcept(Compare))
constexpr explicit Map(const Allocator& alloc) noexcept(noexcept(Compare()))
: nodeContainer(alloc)
, root(SIZE_MAX)
, beginIt(SIZE_MAX)
@@ -662,4 +662,4 @@ private:
return !comp(a, b) && !comp(b, a);
}
};
} // namespace Seele
} // namespace Seele
+2 -2
View File
@@ -40,8 +40,8 @@ bool UniformBuffer::updateContents(const BulkResourceData& resourceData)
ShaderBuffer::ShaderBuffer(QueueFamilyMapping mapping, uint32 stride, uint32 numElements, const BulkResourceData& resourceData)
: Buffer(mapping, resourceData.owner)
, contents(resourceData.size)
, stride(stride)
, numElements(numElements)
, stride(stride)
{
if (resourceData.data != nullptr)
{
@@ -88,4 +88,4 @@ IndexBuffer::IndexBuffer(QueueFamilyMapping mapping, uint64 size, Gfx::SeIndexTy
}
IndexBuffer::~IndexBuffer()
{
}
}
+21 -2
View File
@@ -18,6 +18,17 @@ public:
: binding(other.binding), descriptorType(other.descriptorType), descriptorCount(other.descriptorCount), shaderStages(other.shaderStages)
{
}
DescriptorBinding& operator=(const DescriptorBinding& other)
{
if(this != &other)
{
binding = other.binding;
descriptorType = other.descriptorType;
descriptorCount = other.descriptorCount;
shaderStages = other.shaderStages;
}
return *this;
}
uint32 binding;
SeDescriptorType descriptorType;
uint32 descriptorCount;
@@ -64,7 +75,14 @@ public:
, name(name)
{
}
virtual ~DescriptorLayout() {}
DescriptorLayout(const DescriptorLayout& other)
{
descriptorBindings.resize(other.descriptorBindings.size());
for(uint32 i = 0; i < descriptorBindings.size(); ++i)
{
descriptorBindings[i] = other.descriptorBindings[i];
}
}
DescriptorLayout& operator=(const DescriptorLayout& other)
{
if (this != &other)
@@ -77,6 +95,7 @@ public:
}
return *this;
}
virtual ~DescriptorLayout() {}
virtual void create() = 0;
virtual void addDescriptorBinding(uint32 binding, SeDescriptorType type, uint32 arrayCount = 1, SeDescriptorBindingFlags bindingFlags = 0, SeShaderStageFlags shaderStages = SeShaderStageFlagBits::SE_SHADER_STAGE_ALL);
virtual void reset();
@@ -119,4 +138,4 @@ protected:
};
DEFINE_REF(PipelineLayout)
}
}
}
@@ -6,6 +6,7 @@ extern List<VertexData*> vertexDataList;
StaticMeshVertexData::StaticMeshVertexData(Gfx::PGraphics graphics)
: VertexData(graphics)
, head(0)
{
vertexDataList.add(this);
}
@@ -13,3 +14,10 @@ StaticMeshVertexData::StaticMeshVertexData(Gfx::PGraphics graphics)
StaticMeshVertexData::~StaticMeshVertexData()
{}
MeshId StaticMeshVertexData::allocateVertexData(uint64 numVertices)
{
MeshId res{idCounter++};
meshOffsets[res] = head;
head += numVertices;
return res;
}
+20 -1
View File
@@ -1,3 +1,4 @@
#pragma once
#include "VertexData.h"
namespace Seele
@@ -7,6 +8,24 @@ class StaticMeshVertexData : public VertexData
public:
StaticMeshVertexData(Gfx::PGraphics graphics);
virtual ~StaticMeshVertexData();
virtual MeshId allocateVertexData(uint64 numVertices) override;
void loadPositions(MeshId id, const Array<Vector>& data);
void loadTexCoords(MeshId id, const Array<Vector2>& data);
void loadNormals(MeshId id, const Array<Vector>& data);
void loadTangents(MeshId id, const Array<Vector>& data);
void loadBiTangents(MeshId id, const Array<Vector>& data);
private:
Gfx::PShaderBuffer positions;
Array<Vector> positionData;
Gfx::PShaderBuffer texCoords;
Array<Vector2> texCoordsData;
Gfx::PShaderBuffer normals;
Array<Vector> normalData;
Gfx::PShaderBuffer tangents;
Array<Vector> tangentData;
Gfx::PShaderBuffer biTangents;
Array<Vector> biTangentData;
Map<MeshId, uint64_t> meshOffsets;
uint64 head;
};
}
}
+2 -1
View File
@@ -76,6 +76,7 @@ List<VertexData*> VertexData::getList()
VertexData::VertexData(Gfx::PGraphics graphics)
: graphics(graphics)
, idCounter(0)
{
instanceDataLayout = graphics->createDescriptorLayout("VertexDataInstanceLayout");
instanceDataLayout->addDescriptorBinding(0, Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER);
@@ -94,4 +95,4 @@ VertexData::VertexData(Gfx::PGraphics graphics)
});
}
instanceDataLayout->create();
}
}
+3 -1
View File
@@ -48,6 +48,7 @@ public:
void resetMeshData();
void updateMesh(const Component::Transform& transform, const Component::Mesh& mesh);
void createDescriptors();
virtual MeshId allocateVertexData(uint64 numVertices) = 0;
virtual void bindBuffers(Gfx::PRenderCommand command) = 0;
virtual Gfx::PDescriptorLayout getVertexDataLayout() = 0;
virtual Gfx::PDescriptorSet getVertexDataSet() = 0;
@@ -82,5 +83,6 @@ protected:
// for legacy pipeline
Gfx::PIndexBuffer indexBuffer;
VertexData(Gfx::PGraphics graphics);
uint64 idCounter;
};
}
}
+5 -5
View File
@@ -104,14 +104,14 @@ class RefPtr
{
public:
constexpr RefPtr() noexcept
: object(nullptr)
{
object = nullptr;
}
constexpr RefPtr(nullptr_t) noexcept
constexpr RefPtr(std::nullptr_t) noexcept
: object(nullptr)
{
object = nullptr;
}
constexpr RefPtr(T *ptr, Deleter deleter = Deleter())
RefPtr(T *ptr, Deleter deleter = Deleter())
{
std::scoped_lock l(getRegisteredObjectLock());
auto registeredObj = getRegisteredObjects().find(ptr);
@@ -270,7 +270,7 @@ public:
: handle(nullptr)
{
}
UniquePtr(nullptr_t)
UniquePtr(std::nullptr_t)
: handle(nullptr)
{
}