[spirv] temporary emission of DebugTypeMember.Offset#330
Conversation
When the physical layout of a local variable is unknown, we cannot properly set Offset and Size of DebugTypeMember based on the current spec. We need the spec update. Since we need to test SwiftShader debugger (the first Vulkan shader debugger that can be used as a reference implementation), we want to temporarily emit Offset and Size of DebugTypeMember even for local variables with the unknown physical layout. We assume it uses the tight data filling.
|
✅ Build DirectXShaderCompiler 1.0.479 completed (commit 885416fa6a by @jaebaek) |
| // For example, we do not have physical layout for a local variable. | ||
|
|
||
| // Get offset (in bits) of this member within the composite. | ||
| uint32_t offsetInBits = field.offset.hasValue() |
There was a problem hiding this comment.
in what situation would field.offset not have a value?
should we assert that it has a value and then use it?
There was a problem hiding this comment.
When we know the physical memory layout, field.offset has a value, but it does not when we do not know the physical layout e.g., local variables.
should we assert that it has a value and then use it?
No, I think we have to use compositeSizeInBits when field.offset does not have a value e.g., local variable.
jaebaek
left a comment
There was a problem hiding this comment.
Thank you for your code review. PTAL!
| // For example, we do not have physical layout for a local variable. | ||
|
|
||
| // Get offset (in bits) of this member within the composite. | ||
| uint32_t offsetInBits = field.offset.hasValue() |
There was a problem hiding this comment.
When we know the physical memory layout, field.offset has a value, but it does not when we do not know the physical layout e.g., local variables.
should we assert that it has a value and then use it?
No, I think we have to use compositeSizeInBits when field.offset does not have a value e.g., local variable.
When the physical layout of a local variable is unknown, we cannot
properly set Offset and Size of DebugTypeMember based on the current
spec. We need the spec update.
Since we need to test SwiftShader debugger (the first Vulkan shader
debugger that can be used as a reference implementation), we want to
temporarily emit Offset and Size of DebugTypeMember even for local
variables with the unknown physical layout. We assume it uses the
tight data filling.