MSL: Fixup buffer array case issue on MSL 1.0.
This commit is contained in:
parent
af8a9ccdcb
commit
969566aff5
@ -22,7 +22,7 @@ struct constant_block
|
||||
#endif
|
||||
constant int arraySize = SPIRV_CROSS_CONSTANT_ID_0;
|
||||
|
||||
void doWork(device storage_block* constant (&storage)[2], constant constant_block* constant (&constants)[4], thread const array<texture2d<int>, 3> images)
|
||||
void doWork(device storage_block* (&storage)[2], constant constant_block* (&constants)[4], thread const array<texture2d<int>, 3> images)
|
||||
{
|
||||
storage[0]->baz = uint4(constants[3]->foo);
|
||||
storage[1]->quux = images[2].read(uint2(int2(constants[1]->bar))).xy;
|
||||
|
@ -5968,15 +5968,20 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg)
|
||||
if (!address_space.empty())
|
||||
decl = join(address_space, " ", decl);
|
||||
|
||||
// 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].
|
||||
if (storage == StorageClassUniform || storage == StorageClassStorageBuffer)
|
||||
decl += " constant";
|
||||
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)
|
||||
decl += " constant";
|
||||
}
|
||||
|
||||
decl += " (&";
|
||||
decl += to_expression(name_id);
|
||||
|
Loading…
Reference in New Issue
Block a user