Support setting sizes of SPIR-V unsized arrays.
Set SPIRV-Cross MSLResourceBinding::size value from MVKDescriptorSetLayoutBinding descriptor count.
This commit is contained in:
parent
4055d84a22
commit
3d952d5ed4
@ -70,6 +70,11 @@ public:
|
||||
/** Returns the binding number of this layout. */
|
||||
inline uint32_t getBinding() { return _info.binding; }
|
||||
|
||||
/** Returns whether this binding has a variable descriptor count. */
|
||||
inline bool hasVariableDescriptorCount() {
|
||||
return mvkIsAnyFlagEnabled(_flags, VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of descriptors in this layout.
|
||||
*
|
||||
|
@ -80,7 +80,7 @@ uint32_t MVKDescriptorSetLayoutBinding::getDescriptorCount(MVKDescriptorSet* des
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (descSet && mvkIsAnyFlagEnabled(_flags, VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT)) {
|
||||
if (descSet && hasVariableDescriptorCount()) {
|
||||
return descSet->_variableDescriptorCount;
|
||||
}
|
||||
|
||||
@ -374,6 +374,7 @@ void MVKDescriptorSetLayoutBinding::populateShaderConverterContext(mvk::SPIRVToM
|
||||
models[i],
|
||||
dslIndex,
|
||||
_info.binding,
|
||||
getDescriptorCount(nullptr),
|
||||
mvkSamp);
|
||||
}
|
||||
}
|
||||
|
@ -317,4 +317,5 @@ void mvkPopulateShaderConverterContext(mvk::SPIRVToMSLConversionConfiguration& c
|
||||
spv::ExecutionModel stage,
|
||||
uint32_t descriptorSetIndex,
|
||||
uint32_t bindingIndex,
|
||||
uint32_t count,
|
||||
MVKSampler* immutableSampler);
|
||||
|
@ -817,6 +817,7 @@ void mvkPopulateShaderConverterContext(mvk::SPIRVToMSLConversionConfiguration& c
|
||||
spv::ExecutionModel stage,
|
||||
uint32_t descriptorSetIndex,
|
||||
uint32_t bindingIndex,
|
||||
uint32_t count,
|
||||
MVKSampler* immutableSampler) {
|
||||
mvk::MSLResourceBinding rb;
|
||||
|
||||
@ -824,6 +825,7 @@ void mvkPopulateShaderConverterContext(mvk::SPIRVToMSLConversionConfiguration& c
|
||||
rbb.stage = stage;
|
||||
rbb.desc_set = descriptorSetIndex;
|
||||
rbb.binding = bindingIndex;
|
||||
rbb.size = count;
|
||||
rbb.msl_buffer = ssRB.bufferIndex;
|
||||
rbb.msl_texture = ssRB.textureIndex;
|
||||
rbb.msl_sampler = ssRB.samplerIndex;
|
||||
|
@ -101,6 +101,7 @@ void MVKPipelineLayout::populateShaderConverterContext(SPIRVToMSLConversionConfi
|
||||
models[i],
|
||||
kPushConstDescSet,
|
||||
kPushConstBinding,
|
||||
1,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
@ -1996,6 +1997,7 @@ namespace SPIRV_CROSS_NAMESPACE {
|
||||
archive(rb.stage,
|
||||
rb.desc_set,
|
||||
rb.binding,
|
||||
rb.size,
|
||||
rb.msl_buffer,
|
||||
rb.msl_texture,
|
||||
rb.msl_sampler);
|
||||
|
@ -101,6 +101,7 @@ MVK_PUBLIC_SYMBOL bool mvk::MSLResourceBinding::matches(const MSLResourceBinding
|
||||
if (resourceBinding.stage != other.resourceBinding.stage) { return false; }
|
||||
if (resourceBinding.desc_set != other.resourceBinding.desc_set) { return false; }
|
||||
if (resourceBinding.binding != other.resourceBinding.binding) { return false; }
|
||||
if (resourceBinding.size != other.resourceBinding.size) { return false; }
|
||||
if (resourceBinding.msl_buffer != other.resourceBinding.msl_buffer) { return false; }
|
||||
if (resourceBinding.msl_texture != other.resourceBinding.msl_texture) { return false; }
|
||||
if (resourceBinding.msl_sampler != other.resourceBinding.msl_sampler) { return false; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user