utils.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <string_view>
  6. #include <vector>
  7. #include <glad/glad.h>
  8. #include "common/common_types.h"
  9. namespace OpenGL {
  10. class VertexArrayPushBuffer final {
  11. public:
  12. explicit VertexArrayPushBuffer();
  13. ~VertexArrayPushBuffer();
  14. void Setup();
  15. void SetIndexBuffer(const GLuint* buffer);
  16. void SetVertexBuffer(GLuint binding_index, const GLuint* buffer, GLintptr offset,
  17. GLsizei stride);
  18. void Bind();
  19. private:
  20. struct Entry;
  21. const GLuint* index_buffer{};
  22. std::vector<Entry> vertex_buffers;
  23. };
  24. class BindBuffersRangePushBuffer final {
  25. public:
  26. explicit BindBuffersRangePushBuffer(GLenum target);
  27. ~BindBuffersRangePushBuffer();
  28. void Setup();
  29. void Push(GLuint binding, const GLuint* buffer, GLintptr offset, GLsizeiptr size);
  30. void Bind();
  31. private:
  32. struct Entry;
  33. GLenum target;
  34. std::vector<Entry> entries;
  35. };
  36. void LabelGLObject(GLenum identifier, GLuint handle, VAddr addr, std::string_view extra_info = {});
  37. } // namespace OpenGL