Closed urbeller closed 2 months ago
I'm confused. Did you resolve the issue yourself? If not, please upload reproducing SPIR-V.
Sorry for the confusion. I haven't solved it but in deed I wasn't clear :-) . The following HLSL buffers:
RWStructuredBuffer<Vertex> vBuffer : register(u0);
cbuffer Params : register(b0)
{
uint numVertices;
float4 dims;
};
... is translated into Metal as:
kernel void main0(device void* spvBufferAliasSet0Binding0 [[buffer(0)]],...){
device auto& vBuffer = *(device type_RWStructuredBuffer_Vertex*)spvBufferAliasSet0Binding0;
constant auto& Params = *(constant type_Data*)spvBufferAliasSet0Binding0;
...
}
I realized that I am using the decorator to preserve the buffers indexing ! That could be the reason.
You cannot alias UBO and SSBO like that. They have same binding. There is a way to do this now with indirect argument buffers, but not plain descriptors. MSL does not allow casting between address spaces like this.
makes sens! thx for your help.
In a previously (working) translation, I had this MSL output (from hlsl compute shader):
The same HLSL source with the recent cross-compiler led this following code:
First of all, I don't understand why buffer(1) suddenly disappeared ? is there an argument buffer trick that I am supposed to use ? Also, the new code generates the following error:
Update: this seems to occur because of register indexing clash. the device and constant buffers in hlsl were indexed as u0 and b0. Thank you,