fixing compilation issues

This commit is contained in:
Kbz-8
2024-09-14 09:55:19 +02:00
parent 77bfe4ff11
commit f50dd2d946
26 changed files with 1036 additions and 1241 deletions

View File

@@ -5,7 +5,7 @@
#include <Renderer/Vertex.h>
#include <Core/EventBus.h>
namespace Scop
namespace mlx
{
void GraphicPipeline::Init(const GraphicPipelineDescriptor& descriptor)
{
@@ -39,7 +39,7 @@ namespace Scop
kvfGPipelineBuilderSetCullMode(builder, VK_CULL_MODE_NONE, VK_FRONT_FACE_CLOCKWISE);
kvfGPipelineBuilderEnableAlphaBlending(builder);
if(p_depth)
kvfGPipelineBuilderEnableDepthTest(builder, (descriptor.depth_test_equal ? VK_COMPARE_OP_EQUAL : VK_COMPARE_OP_LESS), true);
kvfGPipelineBuilderEnableDepthTest(builder, VK_COMPARE_OP_LESS, true);
else
kvfGPipelineBuilderDisableDepthTest(builder);
kvfGPipelineBuilderSetPolygonMode(builder, VK_POLYGON_MODE_FILL, 1.0f);
@@ -80,7 +80,7 @@ namespace Scop
scissor.extent = fb_extent;
vkCmdSetScissor(command_buffer, 0, 1, &scissor);
for(int i = 0; i < m_clears.size(); i++)
for(std::size_t i = 0; i < m_clears.size(); i++)
{
m_clears[i].color.float32[0] = clear[0];
m_clears[i].color.float32[1] = clear[1];

View File

@@ -2,9 +2,9 @@
#include <Renderer/Pipelines/Shader.h>
#include <Renderer/RenderCore.h>
namespace Scop
namespace mlx
{
Shader::Shader(const std::vector<std::uint8_t>& bytecode, ShaderType type, ShaderLayout layout) : m_bytecode(bytecode), m_layout(std::move(layout))
Shader::Shader(const std::vector<std::uint8_t>& bytecode, ShaderType type, ShaderLayout layout) : m_layout(std::move(layout)), m_bytecode(bytecode)
{
switch(type)
{
@@ -14,7 +14,7 @@ namespace Scop
default : FatalError("wtf"); break;
}
m_module = kvfCreateShaderModule(RenderCore::Get().GetDevice(), m_bytecode.data(), m_bytecode.size() * 4);
m_module = kvfCreateShaderModule(RenderCore::Get().GetDevice(), reinterpret_cast<std::uint32_t*>(m_bytecode.data()), m_bytecode.size() * 4);
DebugLog("Vulkan : shader module created");
GeneratePipelineLayout(m_layout);
@@ -63,21 +63,4 @@ namespace Scop
DebugLog("Vulkan : descriptor set layout destroyed");
}
}
std::shared_ptr<Shader> LoadShaderFromFile(const std::filesystem::path& filepath, ShaderType type, ShaderLayout layout)
{
std::ifstream stream(filepath, std::ios::binary);
if(!stream.is_open())
FatalError("Renderer : unable to open a spirv shader file, %", filepath);
std::vector<std::uint32_t> data;
stream.seekg(0);
std::uint32_t part = 0;
while(stream.read(reinterpret_cast<char*>(&part), sizeof(part)))
data.push_back(part);
stream.close();
std::shared_ptr<Shader> shader = std::make_shared<Shader>(data, type, layout);
DebugLog("Vulkan : shader loaded %", filepath);
return shader;
}
}