cs_update.sc 582 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright 2014 Stanlo Slasinski. All rights reserved.
  3. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. */
  5. #include "bgfx_compute.sh"
  6. IMAGE2D_ARRAY_WR(s_texColor,rgba32f,0);
  7. uniform vec4 u_time;
  8. NUM_THREADS(16, 16, 1)
  9. void main()
  10. {
  11. vec3 colors[] = {
  12. vec3(1,0,0),
  13. vec3(1,1,0),
  14. vec3(1,0,1),
  15. vec3(0,1,0),
  16. vec3(0,1,1),
  17. vec3(0,0,1),
  18. };
  19. for (int face=0;face<6;face++)
  20. {
  21. vec3 color = colors[face]*0.75 + sin( u_time.x*4.0 )*0.25;
  22. ivec3 dest = ivec3( gl_GlobalInvocationID.xy, face );
  23. imageStore( s_texColor, dest, vec4(color,1) );
  24. }
  25. }