Implement common pipeline state abstraction

This commit is contained in:
baldurk
2016-10-04 19:54:32 +02:00
parent 0b6b6b3e86
commit 39bfe99ae5
9 changed files with 1508 additions and 8 deletions
+25
View File
@@ -265,6 +265,31 @@ struct ShaderReflection
struct BindpointMap
{
#ifdef __cplusplus
BindpointMap()
{
bindset = 0;
bind = 0;
used = false;
arraySize = 1;
}
BindpointMap(int32_t s, int32_t b)
{
bindset = s;
bind = b;
used = false;
arraySize = 1;
}
bool operator<(const BindpointMap &o) const
{
if(bindset != o.bindset)
return bindset < o.bindset;
return bind < o.bind;
}
#endif
int32_t bindset;
int32_t bind;
bool32 used;
+2 -2
View File
@@ -170,7 +170,7 @@ void MakeShaderReflection(DXBC::DXBCFile *dxbc, ShaderReflection *refl,
cb.byteSize = dxbc->m_CBuffers[i].descriptor.byteSize;
cb.bindPoint = (uint32_t)c;
BindpointMap map = {};
BindpointMap map;
map.arraySize = 1;
map.bind = (int32_t)i;
map.used = true;
@@ -305,7 +305,7 @@ void MakeShaderReflection(DXBC::DXBCFile *dxbc, ShaderReflection *refl,
res.bindPoint = IsReadWrite ? rwidx : roidx;
BindpointMap map = {};
BindpointMap map;
map.arraySize = 1;
map.bind = r.bindPoint;
map.used = true;
@@ -4020,7 +4020,7 @@ void SPVModule::MakeReflection(const string &entryPoint, ShaderReflection *refle
cblock.name = StringFormat::Fmt("uniforms%u", inst->id);
cblock.bufferBacked = !pushConst;
BindpointMap bindmap = {0};
BindpointMap bindmap;
// set can be implicitly 0, but the binding must be set explicitly.
// If no binding is found, we set -1 and sort to the end of the resources
// list as it's not bound anywhere (most likely, declared but not used)
@@ -4182,7 +4182,7 @@ void SPVModule::MakeReflection(const string &entryPoint, ShaderReflection *refle
res.variableType.descriptor.rowMajorStorage = false;
res.variableType.descriptor.rowMajorStorage = false;
BindpointMap bindmap = {0};
BindpointMap bindmap;
// set can be implicitly 0, but the binding must be set explicitly.
// If no binding is found, we set -1 and sort to the end of the resources
// list as it's not bound anywhere (most likely, declared but not used)
@@ -4243,7 +4243,7 @@ void SPVModule::MakeReflection(const string &entryPoint, ShaderReflection *refle
cblock.bufferBacked = false;
cblock.byteSize = 0;
BindpointMap bindmap = {0};
BindpointMap bindmap;
// set something crazy so this doesn't overlap with a real buffer binding
// also identify this as specialization constant data