Files
LifeProject/LifeGraphics/shaders/IShaderGraphCompiler.h
T
2025-05-13 02:46:21 +03:00

70 lines
1.1 KiB
C++

#ifndef IShaderGraphCompiler_h__
#define IShaderGraphCompiler_h__
#include "shaders/IShaderGraphNode.h"
namespace LifeGraphics
{
enum IShaderCompilerFlags
{
SCF_NONE = 0,
SCF_SKINNING = 1,
};
static int ShaderTypeToChannelCount(IShaderDataType t)
{
switch(t)
{
case DT_ANY:
return 0;
case DT_FLOAT:
return 1;
case DT_FLOAT2:
return 2;
case DT_FLOAT3:
return 3;
case DT_FLOAT4:
return 4;
}
return 0;
}
static IShaderDataType MaxType(IShaderDataType t1, IShaderDataType t2)
{
return ShaderTypeToChannelCount(t1) > ShaderTypeToChannelCount(t2) ? t1 : t2;
}
struct ShaderTextureMapping
{
int reg;
int nodeId;
String name;
};
struct ShaderConstantMapping
{
String name;
IShaderDataType DataType;
int size;
int offset;
};
struct ShaderConstantTable
{
};
struct ShaderInputInfo
{
std::vector<ShaderTextureMapping> Textures;
void Clear()
{
Textures.clear();
}
};
class IShaderGraphCompiler
{
public:
virtual void CompileNode(IShaderGraphNode* rootNode, int flags, String& ps, String& vs, ShaderInputInfo* info) = 0;
};
}
#endif // IShaderGraphCompiler_h__