config.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /**************************************************************************/
  2. /* config.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef CONFIG_GLES3_H
  31. #define CONFIG_GLES3_H
  32. #ifdef GLES3_ENABLED
  33. #include "core/config/project_settings.h"
  34. #include "core/string/ustring.h"
  35. #include "core/templates/hash_set.h"
  36. #include "platform_gl.h"
  37. #ifdef ANDROID_ENABLED
  38. typedef void (*PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC)(GLenum, GLenum, GLuint, GLint, GLint, GLsizei);
  39. typedef void (*PFNGLTEXSTORAGE3DMULTISAMPLEPROC)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean);
  40. typedef void (*PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)(GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
  41. typedef void (*PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC)(GLenum, GLenum, GLuint, GLint, GLsizei, GLint, GLsizei);
  42. typedef void (*PFNEGLIMAGETARGETTEXTURE2DOESPROC)(GLenum, void *);
  43. #endif
  44. namespace GLES3 {
  45. class Config {
  46. private:
  47. static Config *singleton;
  48. public:
  49. bool use_nearest_mip_filter = false;
  50. bool use_depth_prepass = true;
  51. GLint max_vertex_texture_image_units = 0;
  52. GLint max_texture_image_units = 0;
  53. GLint max_texture_size = 0;
  54. GLint max_viewport_size[2] = { 0, 0 };
  55. GLint64 max_uniform_buffer_size = 0;
  56. int64_t max_renderable_elements = 0;
  57. int64_t max_renderable_lights = 0;
  58. int64_t max_lights_per_object = 0;
  59. bool generate_wireframes = false;
  60. HashSet<String> extensions;
  61. bool float_texture_supported = false;
  62. bool s3tc_supported = false;
  63. bool rgtc_supported = false;
  64. bool bptc_supported = false;
  65. bool etc2_supported = false;
  66. bool astc_supported = false;
  67. bool astc_hdr_supported = false;
  68. bool astc_layered_supported = false;
  69. bool srgb_framebuffer_supported = false;
  70. bool force_vertex_shading = false;
  71. bool support_anisotropic_filter = false;
  72. float anisotropic_level = 0.0f;
  73. GLint msaa_max_samples = 0;
  74. bool msaa_supported = false;
  75. bool msaa_multiview_supported = false;
  76. bool rt_msaa_supported = false;
  77. bool rt_msaa_multiview_supported = false;
  78. bool multiview_supported = false;
  79. bool external_texture_supported = false;
  80. // Adreno 3XX compatibility.
  81. bool disable_particles_workaround = false; // Set to 'true' to disable 'GPUParticles'.
  82. bool flip_xy_workaround = false;
  83. // PowerVR GE 8320 workaround.
  84. bool disable_transform_feedback_shader_cache = false;
  85. // ANGLE shader workaround.
  86. bool polyfill_half2float = true;
  87. #ifdef ANDROID_ENABLED
  88. PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC eglFramebufferTextureMultiviewOVR = nullptr;
  89. PFNGLTEXSTORAGE3DMULTISAMPLEPROC eglTexStorage3DMultisample = nullptr;
  90. PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC eglFramebufferTexture2DMultisampleEXT = nullptr;
  91. PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC eglFramebufferTextureMultisampleMultiviewOVR = nullptr;
  92. PFNEGLIMAGETARGETTEXTURE2DOESPROC eglEGLImageTargetTexture2DOES = nullptr;
  93. #endif
  94. static Config *get_singleton() { return singleton; }
  95. Config();
  96. ~Config();
  97. };
  98. } // namespace GLES3
  99. #endif // GLES3_ENABLED
  100. #endif // CONFIG_GLES3_H