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
|
#endif
|
||||||
constant int arraySize = SPIRV_CROSS_CONSTANT_ID_0;
|
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[0]->baz = uint4(constants[3]->foo);
|
||||||
storage[1]->quux = images[2].read(uint2(int2(constants[1]->bar))).xy;
|
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())
|
if (!address_space.empty())
|
||||||
decl = join(address_space, " ", decl);
|
decl = join(address_space, " ", decl);
|
||||||
|
|
||||||
// An awkward case where we need to emit *more* address space declarations (yay!).
|
if (msl_options.argument_buffers)
|
||||||
// An example is where we pass down an array of buffer pointers to leaf functions.
|
{
|
||||||
// It's a constant array containing pointers to constants.
|
// An awkward case where we need to emit *more* address space declarations (yay!).
|
||||||
// The pointer array is always constant however. E.g.
|
// An example is where we pass down an array of buffer pointers to leaf functions.
|
||||||
// device SSBO * constant (&array)[N].
|
// It's a constant array containing pointers to constants.
|
||||||
// const device SSBO * constant (&array)[N].
|
// The pointer array is always constant however. E.g.
|
||||||
// constant SSBO * constant (&array)[N].
|
// device SSBO * constant (&array)[N].
|
||||||
if (storage == StorageClassUniform || storage == StorageClassStorageBuffer)
|
// const device SSBO * constant (&array)[N].
|
||||||
decl += " constant";
|
// 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 += " (&";
|
||||||
decl += to_expression(name_id);
|
decl += to_expression(name_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user