Apple anything is horrendous

This commit is contained in:
Dynamitos
2024-03-18 15:28:56 +01:00
parent a74def0ab0
commit 1ff45b5207
104 changed files with 27779 additions and 184 deletions
+4 -1
View File
@@ -56,4 +56,7 @@ target_sources(Engine
Window.h)
add_subdirectory(RenderPass/)
add_subdirectory(Vulkan/)
add_subdirectory(Vulkan/)
if(APPLE)
add_subdirectory(Metal/)
endif()
+4
View File
@@ -0,0 +1,4 @@
target_sources(Engine
PRIVATE
Graphics.h
Graphics.cpp)
+153
View File
@@ -0,0 +1,153 @@
#include "Graphics.h"
#define NS_PRIVATE_IMPLEMENTATION
#define CA_PRIVATE_IMPLEMENTATION
#define MTL_PRIVATE_IMPLEMENTATION
#include "Foundation/Foundation.hpp"
#include "Metal/Metal.hpp"
#include "QuartzCore/QuartzCore.hpp"
using namespace Seele;
using namespace Seele::Metal;
Graphics::Graphics()
{
}
Graphics::~Graphics()
{
}
void Graphics::init(GraphicsInitializer initializer)
{
}
Gfx::OWindow Graphics::createWindow(const WindowCreateInfo &createInfo)
{
}
Gfx::OViewport Graphics::createViewport(Gfx::PWindow owner, const ViewportCreateInfo &createInfo)
{
}
Gfx::ORenderPass Graphics::createRenderPass(Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, Gfx::PViewport renderArea)
{
}
void Graphics::beginRenderPass(Gfx::PRenderPass renderPass)
{
}
void Graphics::endRenderPass()
{
}
void Graphics::waitDeviceIdle()
{
}
void Graphics::executeCommands(const Array<Gfx::PRenderCommand>& commands)
{
}
void Graphics::executeCommands(const Array<Gfx::PComputeCommand>& commands)
{
}
Gfx::OTexture2D Graphics::createTexture2D(const TextureCreateInfo &createInfo)
{
}
Gfx::OTexture3D Graphics::createTexture3D(const TextureCreateInfo &createInfo)
{
}
Gfx::OTextureCube Graphics::createTextureCube(const TextureCreateInfo &createInfo)
{
}
Gfx::OUniformBuffer Graphics::createUniformBuffer(const UniformBufferCreateInfo &bulkData)
{
}
Gfx::OShaderBuffer Graphics::createShaderBuffer(const ShaderBufferCreateInfo &bulkData)
{
}
Gfx::OVertexBuffer Graphics::createVertexBuffer(const VertexBufferCreateInfo &bulkData)
{
}
Gfx::OIndexBuffer Graphics::createIndexBuffer(const IndexBufferCreateInfo &bulkData)
{
}
Gfx::PRenderCommand Graphics::createRenderCommand(const std::string& name)
{
}
Gfx::PComputeCommand Graphics::createComputeCommand(const std::string& name)
{
}
Gfx::OVertexShader Graphics::createVertexShader(const ShaderCreateInfo& createInfo)
{
}
Gfx::OFragmentShader Graphics::createFragmentShader(const ShaderCreateInfo& createInfo)
{
}
Gfx::OComputeShader Graphics::createComputeShader(const ShaderCreateInfo& createInfo)
{
}
Gfx::OMeshShader Graphics::createMeshShader(const ShaderCreateInfo& createInfo)
{
}
Gfx::OTaskShader Graphics::createTaskShader(const ShaderCreateInfo& createInfo)
{
}
Gfx::PGraphicsPipeline Graphics::createGraphicsPipeline(Gfx::LegacyPipelineCreateInfo createInfo)
{
}
Gfx::PGraphicsPipeline Graphics::createGraphicsPipeline(Gfx::MeshPipelineCreateInfo createInfo)
{
}
Gfx::PComputePipeline Graphics::createComputePipeline(Gfx::ComputePipelineCreateInfo createInfo)
{
}
Gfx::OSampler Graphics::createSampler(const SamplerCreateInfo& createInfo)
{
}
Gfx::ODescriptorLayout Graphics::createDescriptorLayout(const std::string& name)
{
}
Gfx::OPipelineLayout Graphics::createPipelineLayout(Gfx::PPipelineLayout baseLayout)
{
}
Gfx::OVertexInput Graphics::createVertexInput(VertexInputStateCreateInfo createInfo)
{
}
void Graphics::resolveTexture(Gfx::PTexture source, Gfx::PTexture destination)
{
}
+60
View File
@@ -0,0 +1,60 @@
#pragma once
#include "Foundation/Foundation.hpp"
#include "Metal/Metal.hpp"
#include "Graphics/Graphics.h"
namespace Seele
{
namespace Metal
{
class Graphics : public Gfx::Graphics
{
public:
Graphics();
virtual ~Graphics();
virtual void init(GraphicsInitializer initializer) = 0;
virtual Gfx::OWindow createWindow(const WindowCreateInfo &createInfo) = 0;
virtual Gfx::OViewport createViewport(Gfx::PWindow owner, const ViewportCreateInfo &createInfo) = 0;
virtual Gfx::ORenderPass createRenderPass(Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, Gfx::PViewport renderArea) = 0;
virtual void beginRenderPass(Gfx::PRenderPass renderPass) = 0;
virtual void endRenderPass() = 0;
virtual void waitDeviceIdle() = 0;
virtual void executeCommands(const Array<Gfx::PRenderCommand>& commands) = 0;
virtual void executeCommands(const Array<Gfx::PComputeCommand>& commands) = 0;
virtual Gfx::OTexture2D createTexture2D(const TextureCreateInfo &createInfo) = 0;
virtual Gfx::OTexture3D createTexture3D(const TextureCreateInfo &createInfo) = 0;
virtual Gfx::OTextureCube createTextureCube(const TextureCreateInfo &createInfo) = 0;
virtual Gfx::OUniformBuffer createUniformBuffer(const UniformBufferCreateInfo &bulkData) = 0;
virtual Gfx::OShaderBuffer createShaderBuffer(const ShaderBufferCreateInfo &bulkData) = 0;
virtual Gfx::OVertexBuffer createVertexBuffer(const VertexBufferCreateInfo &bulkData) = 0;
virtual Gfx::OIndexBuffer createIndexBuffer(const IndexBufferCreateInfo &bulkData) = 0;
virtual Gfx::PRenderCommand createRenderCommand(const std::string& name = "") = 0;
virtual Gfx::PComputeCommand createComputeCommand(const std::string& name = "") = 0;
virtual Gfx::OVertexShader createVertexShader(const ShaderCreateInfo& createInfo) = 0;
virtual Gfx::OFragmentShader createFragmentShader(const ShaderCreateInfo& createInfo) = 0;
virtual Gfx::OComputeShader createComputeShader(const ShaderCreateInfo& createInfo) = 0;
virtual Gfx::OMeshShader createMeshShader(const ShaderCreateInfo& createInfo) = 0;
virtual Gfx::OTaskShader createTaskShader(const ShaderCreateInfo& createInfo) = 0;
virtual Gfx::PGraphicsPipeline createGraphicsPipeline(Gfx::LegacyPipelineCreateInfo createInfo) = 0;
virtual Gfx::PGraphicsPipeline createGraphicsPipeline(Gfx::MeshPipelineCreateInfo createInfo) = 0;
virtual Gfx::PComputePipeline createComputePipeline(Gfx::ComputePipelineCreateInfo createInfo) = 0;
virtual Gfx::OSampler createSampler(const SamplerCreateInfo& createInfo) = 0;
virtual Gfx::ODescriptorLayout createDescriptorLayout(const std::string& name = "") = 0;
virtual Gfx::OPipelineLayout createPipelineLayout(Gfx::PPipelineLayout baseLayout = nullptr) = 0;
virtual Gfx::OVertexInput createVertexInput(VertexInputStateCreateInfo createInfo) = 0;
virtual void resolveTexture(Gfx::PTexture source, Gfx::PTexture destination) = 0;
protected:
MTL::Device* device;
NS::Application* app;
};
} // namespace Metal
} // namespace Seele
+1 -1
View File
@@ -197,7 +197,7 @@ void BasePass::publishOutputs()
void BasePass::createRenderPass()
{
depthAttachment = resources->requestRenderTarget("DEPTHPREPASS_DEPTH");
depthAttachment.setLoadOp(Gfx::SE_ATTACHMENT_LOAD_OP_LOAD);
depthAttachment.setLoadOp(Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR);
depthAttachment.setInitialLayout(Gfx::SE_IMAGE_LAYOUT_GENERAL);
depthAttachment.setFinalLayout(Gfx::SE_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
Gfx::RenderTargetLayout layout = Gfx::RenderTargetLayout{
@@ -129,7 +129,7 @@ void DepthPrepass::render()
commands.add(command);
}
}
//graphics->executeCommands(commands);
graphics->executeCommands(commands);
graphics->endRenderPass();
}