environment.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. #include <array>
  3. #include "common/common_types.h"
  4. #include "shader_recompiler/program_header.h"
  5. #include "shader_recompiler/shader_info.h"
  6. #include "shader_recompiler/stage.h"
  7. namespace Shader {
  8. class Environment {
  9. public:
  10. virtual ~Environment() = default;
  11. [[nodiscard]] virtual u64 ReadInstruction(u32 address) = 0;
  12. [[nodiscard]] virtual u32 ReadCbufValue(u32 cbuf_index, u32 cbuf_offset) = 0;
  13. [[nodiscard]] virtual TextureType ReadTextureType(u32 raw_handle) = 0;
  14. [[nodiscard]] virtual u32 TextureBoundBuffer() const = 0;
  15. [[nodiscard]] virtual u32 LocalMemorySize() const = 0;
  16. [[nodiscard]] virtual u32 SharedMemorySize() const = 0;
  17. [[nodiscard]] virtual std::array<u32, 3> WorkgroupSize() const = 0;
  18. [[nodiscard]] const ProgramHeader& SPH() const noexcept {
  19. return sph;
  20. }
  21. [[nodiscard]] const std::array<u32, 8>& GpPassthroughMask() const noexcept {
  22. return gp_passthrough_mask;
  23. }
  24. [[nodiscard]] Stage ShaderStage() const noexcept {
  25. return stage;
  26. }
  27. [[nodiscard]] u32 StartAddress() const noexcept {
  28. return start_address;
  29. }
  30. protected:
  31. ProgramHeader sph{};
  32. std::array<u32, 8> gp_passthrough_mask{};
  33. Stage stage{};
  34. u32 start_address{};
  35. };
  36. } // namespace Shader