sculpto
render_context.cpp
Go to the documentation of this file.
1/*!****************************************************************//*!*
2 * \file render_context.h
3 * \brief Base, abstract, backend render api independent render
4 * context class implementation module.
5 *
6 * \author Sabitov Kirill
7 * \date 26 June 2022
8 *********************************************************************/
9
10#include "sclpch.h"
11
12#include "render_context.h"
13#include "platform/opengl/gl.h"
14
16{
17 switch (Type)
18 {
20 case scl::shader_variable_type::INT: return 4;
22 case scl::shader_variable_type::INT3: return 12;
23 case scl::shader_variable_type::INT4: return 16;
30 }
31
32 SCL_CORE_ASSERT(0, "Unknown shader variable type!");
33 return u32();
34}
35
37{
38 switch (Type)
39 {
41 case scl::shader_variable_type::INT: return 1;
51 }
52
53 SCL_CORE_ASSERT(0, "Unknown shader variable type!");
54 return u32();
55}
56
58
60{
61 switch (Api)
62 {
63 case scl::render_context_api::OpenGL: return CreateUnique<gl>();
64 case scl::render_context_api::DirectX: SCL_CORE_ASSERT(0, "This API is currently unsupported."); return nullptr;
65 }
66
67 SCL_CORE_ERROR("Unknown render API was selected.");
68 return nullptr;
69}
#define SCL_CORE_ASSERT(expr,...)
Definition: assert.h:69
static unique< render_context > Create()
static u32 GetShaderVariableComponentsCount(shader_variable_type Type)
static u32 GetShaderVariableTypeSize(shader_variable_type Type)
#define SCL_CORE_ERROR(...)
Definition: log.h:44
shader_variable_type
render_context_api
uint32_t u32
Definition: math_common.h:21
std::unique_ptr< T > unique
Definition: smart_ptr.h:25
Base, abstract, backend render api independent render context class implementation module.
Sculpto library prehompiled header. Defines common definitions, includes commonly used modules.