2
0

TestCompute.hlsl 686 B

12345678910111213141516171819202122232425
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2025 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #include "TestComputeBindings.h"
  5. JPH_SHADER_FUNCTION_BEGIN(void, main, cTestComputeGroupSize, 1, 1)
  6. JPH_SHADER_PARAM_THREAD_ID(tid)
  7. JPH_SHADER_FUNCTION_END
  8. {
  9. // Ensure that we do not write out of bounds
  10. if (tid.x >= cNumElements)
  11. return;
  12. if (cUIntValue2 == 0)
  13. {
  14. // First write, uses optional data and tests that the packing of float3/uint3's works
  15. gData[tid.x] = gOptionalData[tid.x] + int(cFloat3Value2.y) + gUploadData[0];
  16. }
  17. else
  18. {
  19. // Read-modify-write gData
  20. gData[tid.x] = (gData[tid.x] + cUIntValue) * cUIntValue2;
  21. }
  22. }