Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointer syntax issue #3754

Closed
Ipotrick opened this issue Mar 13, 2024 · 0 comments · Fixed by #3753
Closed

Pointer syntax issue #3754

Ipotrick opened this issue Mar 13, 2024 · 0 comments · Fixed by #3753
Assignees
Labels
goal:client support Feature or fix needed for a current slang user.

Comments

@Ipotrick
Copy link

I encountered this error message:

SLANG [test] D:/repos/Daxa/tests/3_samples/1_mandelbrot/shaders/compute.slang(99): error 30027: 'x' is not a member of 'Ref<Tester>'.
    *push.ptr0 = (*push.ptr1).x;
                              ^

For this minimal repro:

struct Tester
{
  float x;
};

struct Push
{
    float* ptr0;
    Tester* ptr1;
};

[[vk::push_constant]] Push push;
[shader("compute")]
[numthreads(1, 1, 1)]
void main(uint3 dtid : SV_DispatchThreadID)
{
    *push.ptr0 = (*push.ptr1).x;
}

Config:

pc platform: x86-64msvc windows11
slang::TargetDesc::format: SlangCompileTarget::SLANG_SPIRV
slang::TargetDesc::profile: GLSL_460
slang::TargetDesc::flags: SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY
slang::SessionDesc::defaultMatrixLayoutMode: SLANG_MATRIX_LAYOUT_COLUMN_MAJOR

I would expect this syntax to work reading this example from the user guide:

int test(MyType* pObj)
{
    MyType* pNext = pObj + 1;
    MyType* pNext = &pNext[1];
    return pNext.a + (*pNext).a + pNext[0].a;
}
@csyonghe csyonghe self-assigned this Mar 13, 2024
@csyonghe csyonghe added the goal:client support Feature or fix needed for a current slang user. label Mar 13, 2024
@csyonghe csyonghe added this to the Q1 2024 (Winter) milestone Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goal:client support Feature or fix needed for a current slang user.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants