|
@@ -355,17 +355,28 @@ namespace bs
|
|
|
{
|
|
{
|
|
|
const glslang::TType* ttype = program->getUniformBlockTType(i);
|
|
const glslang::TType* ttype = program->getUniformBlockTType(i);
|
|
|
|
|
|
|
|
|
|
+ if (!ttype->getQualifier().hasBinding())
|
|
|
|
|
+ {
|
|
|
|
|
+ log = "Uniform parsing error: Found a uniform block without a binding qualifier. Each uniform block must "
|
|
|
|
|
+ " have an explicitly defined binding number.";
|
|
|
|
|
+
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const char* name = program->getUniformBlockName(i);
|
|
const char* name = program->getUniformBlockName(i);
|
|
|
int size = program->getUniformBlockSize(i);
|
|
int size = program->getUniformBlockSize(i);
|
|
|
int index = program->getUniformBlockIndex(i);
|
|
int index = program->getUniformBlockIndex(i);
|
|
|
|
|
|
|
|
GpuParamBlockDesc param;
|
|
GpuParamBlockDesc param;
|
|
|
param.name = name;
|
|
param.name = name;
|
|
|
- param.blockSize = size;
|
|
|
|
|
|
|
+ param.blockSize = size / 4;
|
|
|
param.isShareable = true;
|
|
param.isShareable = true;
|
|
|
param.slot = ttype->getQualifier().layoutBinding;
|
|
param.slot = ttype->getQualifier().layoutBinding;
|
|
|
param.set = ttype->getQualifier().layoutSet;
|
|
param.set = ttype->getQualifier().layoutSet;
|
|
|
|
|
|
|
|
|
|
+ if (param.set == glslang::TQualifier::layoutSetEnd)
|
|
|
|
|
+ param.set = 0;
|
|
|
|
|
+
|
|
|
desc.paramBlocks[name] = param;
|
|
desc.paramBlocks[name] = param;
|
|
|
uniformBlockMap[index] = name;
|
|
uniformBlockMap[index] = name;
|
|
|
}
|
|
}
|
|
@@ -377,19 +388,19 @@ namespace bs
|
|
|
const glslang::TType* ttype = program->getUniformTType(i);
|
|
const glslang::TType* ttype = program->getUniformTType(i);
|
|
|
const char* name = program->getUniformName(i);
|
|
const char* name = program->getUniformName(i);
|
|
|
|
|
|
|
|
- if(!ttype->getQualifier().hasBinding())
|
|
|
|
|
- {
|
|
|
|
|
- log = "Uniform parsing error: Found an uniform without a binding qualifier. Each uniform must have an "
|
|
|
|
|
- "explicitly defined binding number.";
|
|
|
|
|
-
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if (ttype->getBasicType() == glslang::EbtSampler) // Object type
|
|
if (ttype->getBasicType() == glslang::EbtSampler) // Object type
|
|
|
{
|
|
{
|
|
|
// Note: Even though the type is named EbtSampler, all object types are categorized under it (including non
|
|
// Note: Even though the type is named EbtSampler, all object types are categorized under it (including non
|
|
|
// sampled images and buffers)
|
|
// sampled images and buffers)
|
|
|
|
|
|
|
|
|
|
+ if (!ttype->getQualifier().hasBinding())
|
|
|
|
|
+ {
|
|
|
|
|
+ log = "Uniform parsing error: Found an uniform without a binding qualifier. Each uniform must have an "
|
|
|
|
|
+ "explicitly defined binding number.";
|
|
|
|
|
+
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const glslang::TSampler& sampler = ttype->getSampler();
|
|
const glslang::TSampler& sampler = ttype->getSampler();
|
|
|
|
|
|
|
|
GpuParamObjectDesc param;
|
|
GpuParamObjectDesc param;
|
|
@@ -397,6 +408,9 @@ namespace bs
|
|
|
param.slot = ttype->getQualifier().layoutBinding;
|
|
param.slot = ttype->getQualifier().layoutBinding;
|
|
|
param.set = ttype->getQualifier().layoutSet;
|
|
param.set = ttype->getQualifier().layoutSet;
|
|
|
|
|
|
|
|
|
|
+ if (param.set == glslang::TQualifier::layoutSetEnd)
|
|
|
|
|
+ param.set = 0;
|
|
|
|
|
+
|
|
|
if (sampler.isImage())
|
|
if (sampler.isImage())
|
|
|
{
|
|
{
|
|
|
switch (sampler.dim)
|
|
switch (sampler.dim)
|
|
@@ -611,8 +625,8 @@ namespace bs
|
|
|
// Add special header so code is recognized as GLSL
|
|
// Add special header so code is recognized as GLSL
|
|
|
UINT32* header = (UINT32*)codeBytes;
|
|
UINT32* header = (UINT32*)codeBytes;
|
|
|
header[0] = ICD_SPV_MAGIC;
|
|
header[0] = ICD_SPV_MAGIC;
|
|
|
- header[1] = ICD_SPV_VERSION;
|
|
|
|
|
- header[2] = 0;
|
|
|
|
|
|
|
+ header[1] = 0;
|
|
|
|
|
+ header[2] = VulkanUtility::getShaderStage(mProperties.getType());
|
|
|
|
|
|
|
|
UINT32* glslBytes = codeBytes + 3;
|
|
UINT32* glslBytes = codeBytes + 3;
|
|
|
memcpy(glslBytes, sourceBytes, source.size());
|
|
memcpy(glslBytes, sourceBytes, source.size());
|