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: struct member initialization? #1093

Closed
chaoticbob opened this issue Oct 7, 2017 · 2 comments
Closed

HLSL: struct member initialization? #1093

chaoticbob opened this issue Oct 7, 2017 · 2 comments

Comments

@chaoticbob
Copy link
Contributor

chaoticbob commented Oct 7, 2017

Seems like this has been asked before, but I wasn't able to find an issue with it - and also couldn't find an item that matched it on #362. Was wondering if a shader like this could be supported via SPIR-V:

cbuffer ubo {
  float x = 0.0;
};

float4 main(float4 pos : POSITION) : SV_POSITION {
  return pos + float4(x, 0, 0, 0);
}
@johnkslang
Copy link
Member

I believe this is because it is a Vulkan, or meta, issue. See related issue #701.

This "initialization" does not actually mean the shader initializes the struct member. Rather, it is a request that the driver pre-initialize the memory for the shader. If you look at fxc output, the initializer is actually in a comment, not the code.

If we do something to support this in glslang, something else will have to consume it to finish the job. So, we need a complete proposal of what to do:

  • does it come with new Vulkan functionality?
  • new driver support?
  • some boiler plate application code the app can call to initialize buffers with?
  • etc.

@chaoticbob
Copy link
Contributor Author

Thanks for clearing this up. Will keep tracking it on #701.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants