ComputeShader.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2025 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Jolt/Core/Reference.h>
  6. #include <Jolt/Core/NonCopyable.h>
  7. #include <Jolt/Core/Result.h>
  8. JPH_NAMESPACE_BEGIN
  9. /// Compute shader handle
  10. class JPH_EXPORT ComputeShader : public RefTarget<ComputeShader>, public NonCopyable
  11. {
  12. public:
  13. JPH_OVERRIDE_NEW_DELETE
  14. /// Constructor / destructor
  15. ComputeShader(uint32 inGroupSizeX, uint32 inGroupSizeY, uint32 inGroupSizeZ) :
  16. mGroupSizeX(inGroupSizeX),
  17. mGroupSizeY(inGroupSizeY),
  18. mGroupSizeZ(inGroupSizeZ)
  19. {
  20. }
  21. virtual ~ComputeShader() = default;
  22. /// Get group sizes
  23. uint32 GetGroupSizeX() const { return mGroupSizeX; }
  24. uint32 GetGroupSizeY() const { return mGroupSizeY; }
  25. uint32 GetGroupSizeZ() const { return mGroupSizeZ; }
  26. private:
  27. uint32 mGroupSizeX;
  28. uint32 mGroupSizeY;
  29. uint32 mGroupSizeZ;
  30. };
  31. using ComputeShaderResult = Result<Ref<ComputeShader>>;
  32. JPH_NAMESPACE_END