You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But if we take the test for that (tests/ui/lang/core/ref/member_ref_arg.rs) and add another function g:
structS{x:u32,y:u32,}fnf(x:&u32){}fng(xy:(&u32,&u32)){}#[spirv(fragment)]pubfnmain(){let s = S{x:2,y:2};f(&s.x);g((&s.x,&s.y));}
Then only the (existing) f call is inlined, but the g call still produces:
error: error:0:0 - Pointer operand '22[%22]' must be a memory object declaration
This is because #777 banned specifically OpAccessChain function arguments (i.e. &s.x), but in the case of g, the pair is created and then (because it has ScalarPair ABI) the two pointer fields are extracted to call g.
Based on my reading of the SPIR-V standard, the only way to be fully correct here is to only allow OpVariables and OpFunctionParameters (instead of banning one thing or another).
cc @Shfty (who ran into this while doing some type/trait metaprogramming which I guess involved ref-pairs)
The text was updated successfully, but these errors were encountered:
a pointer to an element in an array that is a memory object declaration, where the element type is OpTypeSampler or OpTypeImage.
(note that the existing check introduced by #777 already rules out the second case, because that would involve OpAccessChain, so we can treat it like "memory object declaration" is the only allowed case)
All declared types are restricted to those types that are, or are contained within, valid types for an OpVariable Result Type or an OpTypeFunction Return Type.
So the inliner checks can probably partition types into "pointer to OpVariable's contents" (valid for function parameters, too, for a subset of storage classes) and "pointer-free type" (valid for function return types).
This is technically not a new issue, and most of it was fixed in:
But if we take the test for that (
tests/ui/lang/core/ref/member_ref_arg.rs
) and add another functiong
:Then only the (existing)
f
call is inlined, but theg
call still produces:This is because #777 banned specifically
OpAccessChain
function arguments (i.e.&s.x
), but in the case ofg
, the pair is created and then (because it hasScalarPair
ABI) the two pointer fields are extracted to callg
.Based on my reading of the SPIR-V standard, the only way to be fully correct here is to only allow
OpVariable
s andOpFunctionParameter
s (instead of banning one thing or another).cc @Shfty (who ran into this while doing some type/trait metaprogramming which I guess involved ref-pairs)
The text was updated successfully, but these errors were encountered: