CoriEngine
Loading...
Searching...
No Matches
ShaderProgram.cpp
Go to the documentation of this file.
1#include "ShaderProgram.hpp"
4
5namespace Cori {
6 namespace Graphics {
7 std::shared_ptr<ShaderProgram> ShaderProgram::Create(const std::filesystem::path& vertexPath, const std::filesystem::path& fragmentPath, const std::filesystem::path& geometryPath) {
10 {
11 auto shader = std::make_shared<Internal::OpenGLShaderProgram>(vertexPath, fragmentPath, geometryPath);
12 CORI_CORE_ASSERT(shader, "Failed to create Texture2D for API: {}. Check registrations and API validity.", APIEnumToName(Core::Window::GetCurrentAPI()));
13 return shader;
14 break;
15 }
17 {
18 CORI_CORE_ASSERT(false, "Unsupported Graphics API.");
19 }
21 {
22 break;
23 }
24 }
25
26 return nullptr;
27 }
28
29 std::shared_ptr<ShaderProgram> ShaderProgram::Create(const Descriptor& descriptor) {
30 return Create(descriptor.m_VertexPath, descriptor.m_FragmentPath, descriptor.m_GeometryPath);
31 }
32 }
33}
#define CORI_CORE_ASSERT(x,...)
Definition Logger.hpp:1029
static Graphics::GraphicsAPIs GetCurrentAPI()
Returns the graphical API used by this window.
Definition Window.hpp:63
const std::filesystem::path m_FragmentPath
const std::filesystem::path m_VertexPath
const std::filesystem::path m_GeometryPath
static std::shared_ptr< ShaderProgram > Create(const std::filesystem::path &vertexPath, const std::filesystem::path &fragmentPath, const std::filesystem::path &geometryPath={})
Almost everything connected to graphics is in this namespace.
Definition Window.hpp:7
@ Vulkan
I want to support vulkan, BUT later-later.
@ None
Invalid enumerator.
@ OpenGL
The only one available for now.
static const char * APIEnumToName(const GraphicsAPIs api)
Global engine namespace.