demotool/shaders.hh

57 lines
1 KiB
C++
Raw Normal View History

2017-10-03 13:53:50 +02:00
#pragma once
#include "utilities.hh"
/*= INPUT FILES ==============================================================*/
// Type of input chunk
enum class E_ShaderInputChunk {
CODE ,
INCLUDE
};
// Input chunk data
struct T_ShaderInputChunk
{
E_ShaderInputChunk type;
std::string text;
uint32_t lines;
T_ShaderInputChunk( ) = default;
T_ShaderInputChunk(
__rd__ const E_ShaderInputChunk type ,
__rd__ std::string text ,
__rd__ const uint32_t lines )
: type( type ) , text( std::move( text ) ) , lines( lines )
{ }
};
// Input file type
enum class E_ShaderInput {
CHUNK , // Chunk that may be repeated
LIBRARY , // Library (will only be loaded once)
// "Main" shader source files
VERTEX , FRAGMENT ,
};
// Preprocessing errors
struct T_ShaderInputError
{
uint32_t line;
std::string error;
};
// Source file
struct T_ShaderInput
{
E_ShaderInput type = E_ShaderInput::CHUNK;
std::vector< T_ShaderInputChunk > chunks;
std::vector< T_ShaderInputError > errors;
bool load( __rd__ std::string const& path );
};
//void testLoadShaderFile( );