Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
83 lines (71 sloc) 1.71 KB
#pragma once
#include "stdafx.h"
#include <vector>
#include <map>
//this is in it's own file so that unless you want to manually
//create a Material Definition, you don't need to know about any of
//the enums / structs required to load a material.
namespace Material
{
enum class ShaderStage : uint8_t
{
VERTEX,
FRAGMENT,
MAX
};
enum class InputType : uint8_t
{
UNIFORM,
SAMPLER,
MAX
};
struct BlockMember
{
char name[32];
uint32_t size;
uint32_t offset;
char defaultValue[64];
};
struct PushConstantBlock
{
uint32_t sizeBytes;
std::vector<ShaderStage> owningStages;
std::vector<BlockMember> blockMembers;
};
struct DescriptorSetBinding
{
InputType type;
uint32_t set;
uint32_t binding;
uint32_t sizeBytes;
char name[32];
char defaultValue[64];
std::vector<ShaderStage> owningStages;
std::vector<BlockMember> blockMembers;
};
struct ShaderStageDefinition
{
ShaderStage stage;
char shaderPath[256];
};
struct Definition
{
PushConstantBlock pcBlock;
std::vector<ShaderStageDefinition> stages;
std::map<uint32_t, std::vector<DescriptorSetBinding>> descSets;
std::vector<uint32_t> dynamicSets;
std::vector<uint32_t> staticSets;
std::vector<uint32_t> globalSets;
uint32_t numStaticUniforms;
uint32_t numStaticTextures;
uint32_t numDynamicUniforms;
uint32_t numDynamicTextures;
uint32_t staticSetsSize;
uint32_t dynamicSetsSize;
};
//if you're manually specifying a material definition instead of loading it,
//you need to manually request a key from Material Storage with reserve()
//since we don't have a path to hash to use as the (potential) map key
void make(uint32_t matId, Material::Definition def);
Definition load(const char* assetPath);
}