Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-std=c99
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdint.h>
- int main (int argc, char **argv)
- {
- //from VulkanSDK
- typedef union VkClearColorValue {
- float float32[4];
- int32_t int32[4];
- uint32_t uint32[4];
- } VkClearColorValue;
- typedef struct VkClearDepthStencilValue {
- float depth;
- uint32_t stencil;
- } VkClearDepthStencilValue;
- typedef union VkClearValue {
- VkClearColorValue color;
- VkClearDepthStencilValue depthStencil;
- } VkClearValue;
- VkClearValue test1;
- VkClearValue test2;
- VkClearColorValue vcv;
- VkClearDepthStencilValue cdsv;
- vcv.float32[0]=0.1f;
- vcv.float32[1]=0.2f;
- vcv.float32[2]=0.3f;
- vcv.float32[3]=0.4f;
- printf("vcv (0): %f\n",vcv.float32[0]);
- printf("vcv (1): %f\n",vcv.float32[1]);
- printf("vcv (2): %f\n",vcv.float32[2]);
- printf("vcv (3): %f\n\n",vcv.float32[3]);
- cdsv.depth=0.5f;
- cdsv.stencil=1;
- printf("cdsv (0): %f\n",cdsv.depth);
- printf("cdsv (1): %d\n\n",cdsv.stencil);
- test1.color = vcv;
- test2.depthStencil = cdsv;
- printf("test1 (0): %f\n",test1.color.float32[0]);
- printf("test1 (1): %f\n",test1.color.float32[1]);
- printf("test1 (2): %f\n",test1.color.float32[2]);
- printf("test1 (3): %f\n\n",test1.color.float32[3]);
- printf("test2 (0): %f\n",test2.depthStencil.depth);
- printf("test2 (1): %d\n",test2.depthStencil.stencil);
- //wrong code
- //test1.color = vcv;
- //test1.depthStencil = cdsv;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement