MSL: Use correct address space when passing array-of-buffers.
Need to check if the descriptor set is actually an argument buffer.
This commit is contained in:
parent
42e64597a7
commit
fd0feb1ec1
@ -39,7 +39,7 @@ struct spvDescriptorSetBuffer1
|
||||
device SSBO1* ssbos [[id(2)]][2];
|
||||
};
|
||||
|
||||
uint get_size(device SSBO& v_16, constant uint& v_16BufferSize, device SSBO1* constant (&ssbos)[2], constant uint* ssbosBufferSize, device SSBO2& v_38, constant uint& v_38BufferSize, device SSBO3* constant (&ssbos2)[2], constant uint* ssbos2BufferSize)
|
||||
uint get_size(device SSBO& v_16, constant uint& v_16BufferSize, device SSBO1* constant (&ssbos)[2], constant uint* ssbosBufferSize, device SSBO2& v_38, constant uint& v_38BufferSize, device SSBO3* (&ssbos2)[2], constant uint* ssbos2BufferSize)
|
||||
{
|
||||
uint len = uint(int((v_16BufferSize - 16) / 16));
|
||||
len += uint(int((ssbosBufferSize[1] - 0) / 4));
|
||||
|
@ -6454,17 +6454,21 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg)
|
||||
|
||||
if (msl_options.argument_buffers)
|
||||
{
|
||||
// An awkward case where we need to emit *more* address space declarations (yay!).
|
||||
// An example is where we pass down an array of buffer pointers to leaf functions.
|
||||
// It's a constant array containing pointers to constants.
|
||||
// The pointer array is always constant however. E.g.
|
||||
// device SSBO * constant (&array)[N].
|
||||
// const device SSBO * constant (&array)[N].
|
||||
// constant SSBO * constant (&array)[N].
|
||||
// However, this only matters for argument buffers, since for MSL 1.0 style codegen,
|
||||
// we emit the buffer array on stack instead, and that seems to work just fine apparently.
|
||||
if (storage == StorageClassUniform || storage == StorageClassStorageBuffer)
|
||||
uint32_t desc_set = get_decoration(name_id, DecorationDescriptorSet);
|
||||
if ((storage == StorageClassUniform || storage == StorageClassStorageBuffer) &&
|
||||
descriptor_set_is_argument_buffer(desc_set))
|
||||
{
|
||||
// An awkward case where we need to emit *more* address space declarations (yay!).
|
||||
// An example is where we pass down an array of buffer pointers to leaf functions.
|
||||
// It's a constant array containing pointers to constants.
|
||||
// The pointer array is always constant however. E.g.
|
||||
// device SSBO * constant (&array)[N].
|
||||
// const device SSBO * constant (&array)[N].
|
||||
// constant SSBO * constant (&array)[N].
|
||||
// However, this only matters for argument buffers, since for MSL 1.0 style codegen,
|
||||
// we emit the buffer array on stack instead, and that seems to work just fine apparently.
|
||||
decl += " constant";
|
||||
}
|
||||
}
|
||||
|
||||
decl += " (&";
|
||||
|
Loading…
Reference in New Issue
Block a user