Hubris Engine
Dev
A Project to learn and get into Game Engine developement.
Loading...
Searching...
No Matches
Shader.h
Go to the documentation of this file.
1
#pragma once
2
#include "
Core/Graphics/Format.h
"
3
#include "
../../Memory.h
"
4
#define ENUMSHIFT(n) (0x1 << n)
5
6
7
namespace
Hubris::Graphics
{
8
enum class
ShaderStage
{
9
Unknown
,
10
Vertex
=
ENUMSHIFT
(0),
11
Fragment
=
ENUMSHIFT
(1),
12
Geometry
=
ENUMSHIFT
(2),
13
TessellationControl
=
ENUMSHIFT
(3),
14
TessellationEvaluation
=
ENUMSHIFT
(4),
15
Compute
=
ENUMSHIFT
(5),
16
};
17
18
constexpr
const
char
*
VertexStageToString
(
const
Hubris::Graphics::ShaderStage
stage)
noexcept
{
19
switch
(stage)
20
{
21
case
ShaderStage::Vertex
:
22
return
"Vertex"
;
23
case
ShaderStage::Fragment
:
24
return
"Fragment"
;
25
case
ShaderStage::Geometry
:
26
return
"Geometry"
;
27
case
ShaderStage::TessellationControl
:
28
return
"Tessellation Control"
;
29
case
ShaderStage::TessellationEvaluation
:
30
return
"Tessallation Evaluation"
;
31
case
ShaderStage::Compute
:
32
return
"Compute"
;
33
case
ShaderStage::Unknown
:
34
__fallthrough;
35
default
:
36
return
"Error/Unknown"
;
37
}
38
}
39
40
class
Shader
{
41
protected
:
42
ShaderStage
stage
=
ShaderStage::Unknown
;
43
Shader
(
const
ShaderStage
& type) noexcept :
stage
(type) {};
44
public
:
45
virtual
void
Destroy
()noexcept = 0;
49
virtual
bool
Valid
()const noexcept {
50
return
stage
!=
ShaderStage::Unknown
;
51
};
52
static
Handle<Shader>
Create
(
const
std::vector<char>& data,
ShaderStage
type);
53
};
54
55
}
Format.h
Memory.h
ENUMSHIFT
#define ENUMSHIFT(n)
Definition
Shader.h:4
Hubris::Graphics::Shader::Shader
Shader(const ShaderStage &type) noexcept
Definition
Shader.h:43
Hubris::Graphics::Shader::Destroy
virtual void Destroy() noexcept=0
Hubris::Graphics::Shader::stage
ShaderStage stage
Definition
Shader.h:42
Hubris::Graphics::Shader::Valid
virtual bool Valid() const noexcept
Override if you have an implementation specific validation method, this simply checks if the stage is...
Definition
Shader.h:49
Hubris::Graphics::Shader::Create
static Handle< Shader > Create(const std::vector< char > &data, ShaderStage type)
Definition
Shader.cpp:7
Hubris::Graphics
Contains all graphics related classes and structs.
Definition
Format.h:9
Hubris::Graphics::VertexStageToString
constexpr const char * VertexStageToString(const Hubris::Graphics::ShaderStage stage) noexcept
Definition
Shader.h:18
Hubris::Graphics::ShaderStage
ShaderStage
Definition
Shader.h:8
Hubris::Graphics::ShaderStage::Fragment
@ Fragment
Definition
Shader.h:11
Hubris::Graphics::ShaderStage::TessellationEvaluation
@ TessellationEvaluation
Definition
Shader.h:14
Hubris::Graphics::ShaderStage::Unknown
@ Unknown
Definition
Shader.h:9
Hubris::Graphics::ShaderStage::TessellationControl
@ TessellationControl
Definition
Shader.h:13
Hubris::Graphics::ShaderStage::Compute
@ Compute
Definition
Shader.h:15
Hubris::Graphics::ShaderStage::Vertex
@ Vertex
Definition
Shader.h:10
Hubris::Graphics::ShaderStage::Geometry
@ Geometry
Definition
Shader.h:12
Hubris::Graphics::ComponentType::Unknown
@ Unknown
Definition
Format.h:13
Hubris::Graphics::PipelineType::Compute
@ Compute
Definition
Pipeline.h:13
Hubris::Handle
Definition
Memory.h:462
include
Core
Graphics
Shader.h
Generated by
1.13.2