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

HLSL syntax error with swizzled integer literals #371

Closed
rossy opened this issue Dec 23, 2017 · 2 comments
Closed

HLSL syntax error with swizzled integer literals #371

rossy opened this issue Dec 23, 2017 · 2 comments
Labels
bug Feature which should work in SPIRV-Cross does not for some reason.

Comments

@rossy
Copy link
Contributor

rossy commented Dec 23, 2017

It seems like there's an issue with applying swizzles to integer literals.

The following GLSL fragment shader:

layout(binding = 0, std140) uniform ubo {
    int my_int;
};

layout(location = 0) out ivec2 color;

void main()
{
    color = ivec2(my_int) * 2;
}

Compiles to this HLSL:

cbuffer _12 : register(b0, space0)
{
    int ubo_my_int : packoffset(c0);
};

static int2 color;

struct SPIRV_Cross_Output
{
    int2 color : SV_Target0;
};

void frag_main()
{
    color = ubo_my_int.xx * 2.xx;
}

SPIRV_Cross_Output main()
{
    frag_main();
    SPIRV_Cross_Output stage_output;
    stage_output.color = color;
    return stage_output;
}

2.xx seems like invalid syntax. It produces this error with FXC:

C:\msys64\home\rossy\glsl\test.ps.hlsl(15,31-32): error X3000: syntax error: unexpected token 'xx'
@HansKristian-Work HansKristian-Work added the bug Feature which should work in SPIRV-Cross does not for some reason. label Dec 24, 2017
@HansKristian-Work
Copy link
Contributor

Sigh, didn't think of integers ... it works with float though ... <_< Trivial fix, but on holiday.

@rossy
Copy link
Contributor Author

rossy commented Jan 4, 2018

Great, thanks. Can confirm this fixed my bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Feature which should work in SPIRV-Cross does not for some reason.
Projects
None yet
Development

No branches or pull requests

2 participants