Merge pull request #115623 from akien-mga/gles3-includes-codestyle
GLES3: Tidy up includes for consistency and remove unnecessary includes
This commit is contained in:
commit
be587f3a2d
31 changed files with 278 additions and 210 deletions
|
|
@ -28,10 +28,11 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "copy_effects.h"
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "copy_effects.h"
|
||||
#include "../storage/texture_storage.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
|
||||
using namespace GLES3;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "cubemap_filter.h"
|
||||
|
||||
#include "../storage/texture_storage.h"
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
|
||||
using namespace GLES3;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,15 +28,9 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "feed_effects.h"
|
||||
|
||||
#ifdef ANDROID_ENABLED
|
||||
#include <GLES3/gl3ext.h>
|
||||
#endif
|
||||
|
||||
#define GL_PROGRAM_POINT_SIZE 0x8642
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
using namespace GLES3;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "drivers/gles3/shader_gles3.h"
|
||||
#include "drivers/gles3/shaders/feed.glsl.gen.h"
|
||||
|
||||
namespace GLES3 {
|
||||
|
|
|
|||
|
|
@ -28,10 +28,11 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "glow.h"
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "glow.h"
|
||||
#include "../storage/texture_storage.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
|
||||
using namespace GLES3;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,11 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "post_effects.h"
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "post_effects.h"
|
||||
#include "../storage/texture_storage.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
|
||||
using namespace GLES3;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "drivers/gles3/effects/glow.h"
|
||||
#include "drivers/gles3/shaders/effects/post.glsl.gen.h"
|
||||
#include "glow.h"
|
||||
|
||||
namespace GLES3 {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "fog.h"
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
using namespace GLES3;
|
||||
|
||||
/* FOG */
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "gi.h"
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
using namespace GLES3;
|
||||
|
||||
/* VOXEL GI API */
|
||||
|
|
|
|||
|
|
@ -32,18 +32,17 @@
|
|||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "rasterizer_gles3.h"
|
||||
#include "rasterizer_scene_gles3.h"
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/math/geometry_2d.h"
|
||||
#include "core/math/transform_interpolator.h"
|
||||
#include "drivers/gles3/rasterizer_util_gles3.h"
|
||||
#include "drivers/gles3/storage/config.h"
|
||||
#include "drivers/gles3/storage/mesh_storage.h"
|
||||
#include "drivers/gles3/storage/particles_storage.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
#include "drivers/gles3/storage/utilities.h"
|
||||
#include "servers/rendering/rendering_server_default.h"
|
||||
#include "storage/config.h"
|
||||
#include "storage/material_storage.h"
|
||||
#include "storage/mesh_storage.h"
|
||||
#include "storage/particles_storage.h"
|
||||
#include "storage/texture_storage.h"
|
||||
#include "servers/rendering/rendering_server_globals.h"
|
||||
|
||||
void RasterizerCanvasGLES3::_update_transform_2d_to_mat4(const Transform2D &p_transform, float *p_mat4) {
|
||||
p_mat4[0] = p_transform.columns[0][0];
|
||||
|
|
@ -1662,7 +1661,7 @@ void RasterizerCanvasGLES3::light_update_shadow(RID p_rid, int p_shadow_index, c
|
|||
glEnable(GL_SCISSOR_TEST);
|
||||
glScissor(0, p_shadow_index * 2, state.shadow_texture_size, 2);
|
||||
glClearColor(p_far, p_far, p_far, 1.0);
|
||||
RasterizerGLES3::clear_depth(1.0);
|
||||
RasterizerUtilGLES3::clear_depth(1.0);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
|
|
@ -1795,7 +1794,7 @@ void RasterizerCanvasGLES3::light_update_directional_shadow(RID p_rid, int p_sha
|
|||
glEnable(GL_SCISSOR_TEST);
|
||||
glScissor(0, p_shadow_index * 2, state.shadow_texture_size, 2);
|
||||
glClearColor(1.0, 1.0, 1.0, 1.0);
|
||||
RasterizerGLES3::clear_depth(1.0);
|
||||
RasterizerUtilGLES3::clear_depth(1.0);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,16 +32,10 @@
|
|||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "rasterizer_scene_gles3.h"
|
||||
#include "servers/rendering/renderer_canvas_render.h"
|
||||
#include "servers/rendering/renderer_compositor.h"
|
||||
#include "storage/material_storage.h"
|
||||
#include "storage/texture_storage.h"
|
||||
|
||||
#include "drivers/gles3/shaders/canvas.glsl.gen.h"
|
||||
#include "drivers/gles3/shaders/canvas_occlusion.glsl.gen.h"
|
||||
|
||||
class RasterizerSceneGLES3;
|
||||
#include "drivers/gles3/storage/material_storage.h"
|
||||
#include "servers/rendering/renderer_canvas_render.h"
|
||||
|
||||
class RasterizerCanvasGLES3 : public RendererCanvasRender {
|
||||
static RasterizerCanvasGLES3 *singleton;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
/**************************************************************************/
|
||||
|
||||
#include "rasterizer_gles3.h"
|
||||
#include "storage/utilities.h"
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
|
|
@ -37,7 +36,6 @@
|
|||
#include "core/io/dir_access.h"
|
||||
#include "core/io/image.h"
|
||||
#include "core/os/os.h"
|
||||
#include "storage/texture_storage.h"
|
||||
|
||||
#define _EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
|
||||
#define _EXT_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
|
||||
|
|
@ -92,8 +90,6 @@
|
|||
bool RasterizerGLES3::screen_flipped_y = false;
|
||||
#endif
|
||||
|
||||
bool RasterizerGLES3::gles_over_gl = true;
|
||||
|
||||
void RasterizerGLES3::begin_frame(double frame_step) {
|
||||
frame++;
|
||||
delta = frame_step;
|
||||
|
|
@ -125,23 +121,6 @@ void RasterizerGLES3::gl_end_frame(bool p_swap_buffers) {
|
|||
}
|
||||
}
|
||||
|
||||
void RasterizerGLES3::clear_depth(float p_depth) {
|
||||
#ifdef GL_API_ENABLED
|
||||
if (is_gles_over_gl()) {
|
||||
glClearDepth(p_depth);
|
||||
}
|
||||
#endif // GL_API_ENABLED
|
||||
#ifdef GLES_API_ENABLED
|
||||
if (!is_gles_over_gl()) {
|
||||
glClearDepthf(p_depth);
|
||||
}
|
||||
#endif // GLES_API_ENABLED
|
||||
}
|
||||
|
||||
void RasterizerGLES3::clear_stencil(int32_t p_stencil) {
|
||||
glClearStencil(p_stencil);
|
||||
}
|
||||
|
||||
#ifdef CAN_DEBUG
|
||||
static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam) {
|
||||
// These are ultimately annoying, so removing for now.
|
||||
|
|
@ -255,7 +234,7 @@ RasterizerGLES3::RasterizerGLES3() {
|
|||
bool has_egl = (eglGetProcAddress != nullptr);
|
||||
#endif
|
||||
|
||||
if (gles_over_gl) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
if (has_egl && !glad_loaded && gladLoadGL((GLADloadfunc)&_egl_load_function_wrapper)) {
|
||||
glad_loaded = true;
|
||||
}
|
||||
|
|
@ -266,7 +245,7 @@ RasterizerGLES3::RasterizerGLES3() {
|
|||
}
|
||||
#endif // EGL_ENABLED
|
||||
|
||||
if (gles_over_gl) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
if (!glad_loaded && gladLoaderLoadGL()) {
|
||||
glad_loaded = true;
|
||||
}
|
||||
|
|
@ -281,7 +260,7 @@ RasterizerGLES3::RasterizerGLES3() {
|
|||
// or we need to actually test for this situation before constructing this.
|
||||
ERR_FAIL_COND_MSG(!glad_loaded, "Error initializing GLAD.");
|
||||
|
||||
if (gles_over_gl) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
||||
if (GLAD_GL_ARB_debug_output) {
|
||||
glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
|
|
@ -297,7 +276,7 @@ RasterizerGLES3::RasterizerGLES3() {
|
|||
// For debugging
|
||||
#ifdef CAN_DEBUG
|
||||
#ifdef GL_API_ENABLED
|
||||
if (gles_over_gl) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
if (OS::get_singleton()->is_stdout_verbose() && GLAD_GL_ARB_debug_output) {
|
||||
glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_ERROR_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, nullptr, GL_TRUE);
|
||||
glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, nullptr, GL_TRUE);
|
||||
|
|
@ -309,7 +288,7 @@ RasterizerGLES3::RasterizerGLES3() {
|
|||
}
|
||||
#endif // GL_API_ENABLED
|
||||
#ifdef GLES_API_ENABLED
|
||||
if (!gles_over_gl) {
|
||||
if (!RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
||||
DebugMessageCallbackARB callback = (DebugMessageCallbackARB)eglGetProcAddress("glDebugMessageCallback");
|
||||
if (!callback) {
|
||||
|
|
|
|||
|
|
@ -32,23 +32,24 @@
|
|||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "effects/copy_effects.h"
|
||||
#include "effects/cubemap_filter.h"
|
||||
#include "effects/feed_effects.h"
|
||||
#include "effects/glow.h"
|
||||
#include "effects/post_effects.h"
|
||||
#include "environment/fog.h"
|
||||
#include "environment/gi.h"
|
||||
#include "rasterizer_canvas_gles3.h"
|
||||
#include "rasterizer_scene_gles3.h"
|
||||
#include "drivers/gles3/effects/copy_effects.h"
|
||||
#include "drivers/gles3/effects/cubemap_filter.h"
|
||||
#include "drivers/gles3/effects/feed_effects.h"
|
||||
#include "drivers/gles3/effects/glow.h"
|
||||
#include "drivers/gles3/effects/post_effects.h"
|
||||
#include "drivers/gles3/environment/fog.h"
|
||||
#include "drivers/gles3/environment/gi.h"
|
||||
#include "drivers/gles3/rasterizer_canvas_gles3.h"
|
||||
#include "drivers/gles3/rasterizer_scene_gles3.h"
|
||||
#include "drivers/gles3/rasterizer_util_gles3.h"
|
||||
#include "drivers/gles3/storage/config.h"
|
||||
#include "drivers/gles3/storage/light_storage.h"
|
||||
#include "drivers/gles3/storage/material_storage.h"
|
||||
#include "drivers/gles3/storage/mesh_storage.h"
|
||||
#include "drivers/gles3/storage/particles_storage.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
#include "drivers/gles3/storage/utilities.h"
|
||||
#include "servers/rendering/renderer_compositor.h"
|
||||
#include "storage/config.h"
|
||||
#include "storage/light_storage.h"
|
||||
#include "storage/material_storage.h"
|
||||
#include "storage/mesh_storage.h"
|
||||
#include "storage/particles_storage.h"
|
||||
#include "storage/texture_storage.h"
|
||||
#include "storage/utilities.h"
|
||||
|
||||
class RasterizerGLES3 : public RendererCompositor {
|
||||
private:
|
||||
|
|
@ -61,8 +62,6 @@ private:
|
|||
static bool screen_flipped_y;
|
||||
#endif
|
||||
|
||||
static bool gles_over_gl;
|
||||
|
||||
protected:
|
||||
GLES3::Config *config = nullptr;
|
||||
GLES3::Utilities *utilities = nullptr;
|
||||
|
|
@ -113,13 +112,9 @@ public:
|
|||
return memnew(RasterizerGLES3);
|
||||
}
|
||||
|
||||
static bool is_gles_over_gl() { return gles_over_gl; }
|
||||
static void clear_depth(float p_depth);
|
||||
static void clear_stencil(int32_t p_stencil);
|
||||
|
||||
static void make_current(bool p_gles_over_gl) {
|
||||
gles_over_gl = p_gles_over_gl;
|
||||
OS::get_singleton()->set_gles_over_gl(gles_over_gl);
|
||||
RasterizerUtilGLES3::set_gles_over_gl(p_gles_over_gl);
|
||||
OS::get_singleton()->set_gles_over_gl(p_gles_over_gl);
|
||||
_create_func = _create_current;
|
||||
low_end = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,24 +30,26 @@
|
|||
|
||||
#include "rasterizer_scene_gles3.h"
|
||||
|
||||
#include "drivers/gles3/effects/copy_effects.h"
|
||||
#include "drivers/gles3/effects/feed_effects.h"
|
||||
#include "drivers/gles3/storage/material_storage.h"
|
||||
#include "rasterizer_gles3.h"
|
||||
#include "storage/config.h"
|
||||
#include "storage/mesh_storage.h"
|
||||
#include "storage/particles_storage.h"
|
||||
#include "storage/texture_storage.h"
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/templates/sort_array.h"
|
||||
#include "drivers/gles3/effects/copy_effects.h"
|
||||
#include "drivers/gles3/effects/cubemap_filter.h"
|
||||
#include "drivers/gles3/effects/feed_effects.h"
|
||||
#include "drivers/gles3/effects/post_effects.h"
|
||||
#include "drivers/gles3/rasterizer_util_gles3.h"
|
||||
#include "drivers/gles3/storage/config.h"
|
||||
#include "drivers/gles3/storage/mesh_storage.h"
|
||||
#include "drivers/gles3/storage/particles_storage.h"
|
||||
#include "drivers/gles3/storage/render_scene_buffers_gles3.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
#include "drivers/gles3/storage/utilities.h"
|
||||
#include "servers/camera/camera_feed.h"
|
||||
#include "servers/camera/camera_server.h"
|
||||
#include "servers/rendering/rendering_server_default.h"
|
||||
#include "servers/rendering/rendering_server_globals.h"
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
RasterizerSceneGLES3 *RasterizerSceneGLES3::singleton = nullptr;
|
||||
|
||||
RenderGeometryInstance *RasterizerSceneGLES3::geometry_instance_create(RID p_base) {
|
||||
|
|
@ -588,7 +590,7 @@ GLuint _init_radiance_texture(int p_size, int p_mipmaps, String p_name) {
|
|||
glGenTextures(1, &radiance_id);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, radiance_id);
|
||||
#ifdef GL_API_ENABLED
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
//TODO, on low-end compare this to allocating each face of each mip individually
|
||||
// see: https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexStorage2D.xhtml
|
||||
for (int i = 0; i < 6; i++) {
|
||||
|
|
@ -599,7 +601,7 @@ GLuint _init_radiance_texture(int p_size, int p_mipmaps, String p_name) {
|
|||
}
|
||||
#endif // GL_API_ENABLED
|
||||
#ifdef GLES_API_ENABLED
|
||||
if (!RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (!RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
glTexStorage2D(GL_TEXTURE_CUBE_MAP, p_mipmaps, GL_RGB10_A2, p_size, p_size);
|
||||
}
|
||||
#endif // GLES_API_ENABLED
|
||||
|
|
@ -2235,7 +2237,7 @@ void RasterizerSceneGLES3::_render_shadow_pass(RID p_light, RID p_shadow_atlas,
|
|||
|
||||
glColorMask(0, 0, 0, 0);
|
||||
glDrawBuffers(0, nullptr);
|
||||
RasterizerGLES3::clear_depth(0.0);
|
||||
RasterizerUtilGLES3::clear_depth(0.0);
|
||||
if (needs_clear) {
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
|
@ -2560,7 +2562,7 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
|
|||
scene_state.enable_gl_scissor_test(false);
|
||||
|
||||
glColorMask(1, 1, 1, 1);
|
||||
RasterizerGLES3::clear_depth(0.0);
|
||||
RasterizerUtilGLES3::clear_depth(0.0);
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
GLuint db = GL_COLOR_ATTACHMENT0;
|
||||
|
|
@ -2620,8 +2622,8 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
|
|||
scene_state.enable_gl_stencil_test(false);
|
||||
|
||||
glColorMask(0, 0, 0, 0);
|
||||
RasterizerGLES3::clear_depth(0.0);
|
||||
RasterizerGLES3::clear_stencil(0);
|
||||
RasterizerUtilGLES3::clear_depth(0.0);
|
||||
RasterizerUtilGLES3::clear_stencil(0);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
// Some desktop GL implementations fall apart when using Multiview with GL_NONE.
|
||||
GLuint db = p_camera_data->view_count > 1 ? GL_COLOR_ATTACHMENT0 : GL_NONE;
|
||||
|
|
@ -2665,8 +2667,8 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
|
|||
scene_state.enable_gl_stencil_test(false);
|
||||
|
||||
if (!fb_cleared) {
|
||||
RasterizerGLES3::clear_depth(0.0);
|
||||
RasterizerGLES3::clear_stencil(0);
|
||||
RasterizerUtilGLES3::clear_depth(0.0);
|
||||
RasterizerUtilGLES3::clear_stencil(0);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
}
|
||||
|
||||
|
|
@ -3930,7 +3932,7 @@ void RasterizerSceneGLES3::render_particle_collider_heightfield(RID p_collider,
|
|||
glDrawBuffers(0, nullptr);
|
||||
|
||||
glColorMask(0, 0, 0, 0);
|
||||
RasterizerGLES3::clear_depth(0.0);
|
||||
RasterizerUtilGLES3::clear_depth(0.0);
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
|
|
@ -3982,7 +3984,7 @@ void RasterizerSceneGLES3::_render_uv2(const PagedArray<RenderGeometryInstance *
|
|||
glDrawBuffers(std_size(draw_buffers), draw_buffers);
|
||||
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
RasterizerGLES3::clear_depth(0.0);
|
||||
RasterizerUtilGLES3::clear_depth(0.0);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
uint64_t base_spec_constant = 0;
|
||||
|
|
@ -4575,7 +4577,7 @@ void sky() {
|
|||
}
|
||||
|
||||
#ifdef GL_API_ENABLED
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
glEnable(_EXT_TEXTURE_CUBE_MAP_SEAMLESS);
|
||||
}
|
||||
#endif // GL_API_ENABLED
|
||||
|
|
|
|||
|
|
@ -30,24 +30,18 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "platform_gl.h"
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "core/math/projection.h"
|
||||
#include "core/templates/paged_allocator.h"
|
||||
#include "core/templates/rid_owner.h"
|
||||
#include "core/templates/self_list.h"
|
||||
#include "drivers/gles3/shaders/effects/cubemap_filter.glsl.gen.h"
|
||||
#include "drivers/gles3/shaders/sky.glsl.gen.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "servers/rendering/renderer_compositor.h"
|
||||
#include "drivers/gles3/storage/light_storage.h"
|
||||
#include "drivers/gles3/storage/material_storage.h"
|
||||
#include "servers/rendering/renderer_scene_render.h"
|
||||
#include "servers/rendering/rendering_server.h"
|
||||
#include "shader_gles3.h"
|
||||
#include "storage/light_storage.h"
|
||||
#include "storage/material_storage.h"
|
||||
#include "storage/render_scene_buffers_gles3.h"
|
||||
#include "storage/utilities.h"
|
||||
|
||||
class RenderSceneBuffersGLES3;
|
||||
|
||||
enum RenderListType {
|
||||
RENDER_LIST_OPAQUE, //used for opaque objects
|
||||
|
|
|
|||
52
drivers/gles3/rasterizer_util_gles3.cpp
Normal file
52
drivers/gles3/rasterizer_util_gles3.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/**************************************************************************/
|
||||
/* rasterizer_util_gles3.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "rasterizer_util_gles3.h"
|
||||
|
||||
#include "platform_gl.h"
|
||||
|
||||
bool RasterizerUtilGLES3::gles_over_gl = true;
|
||||
|
||||
void RasterizerUtilGLES3::clear_depth(float p_depth) {
|
||||
#ifdef GL_API_ENABLED
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
glClearDepth(p_depth);
|
||||
}
|
||||
#endif // GL_API_ENABLED
|
||||
#ifdef GLES_API_ENABLED
|
||||
if (!RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
glClearDepthf(p_depth);
|
||||
}
|
||||
#endif // GLES_API_ENABLED
|
||||
}
|
||||
|
||||
void RasterizerUtilGLES3::clear_stencil(int32_t p_stencil) {
|
||||
glClearStencil(p_stencil);
|
||||
}
|
||||
51
drivers/gles3/rasterizer_util_gles3.h
Normal file
51
drivers/gles3/rasterizer_util_gles3.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/**************************************************************************/
|
||||
/* rasterizer_util_gles3.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
// This class is meant to hold static utility methods with minimal dependencies.
|
||||
|
||||
class RasterizerUtilGLES3 {
|
||||
private:
|
||||
static bool gles_over_gl;
|
||||
|
||||
public:
|
||||
static void set_gles_over_gl(bool p_gles_over_gl) {
|
||||
gles_over_gl = p_gles_over_gl;
|
||||
}
|
||||
static bool is_gles_over_gl() {
|
||||
return gles_over_gl;
|
||||
}
|
||||
|
||||
static void clear_depth(float p_depth);
|
||||
static void clear_stencil(int32_t p_stencil);
|
||||
};
|
||||
|
|
@ -34,8 +34,8 @@
|
|||
|
||||
#include "core/io/dir_access.h"
|
||||
#include "core/io/file_access.h"
|
||||
|
||||
#include "drivers/gles3/rasterizer_gles3.h"
|
||||
#include "core/string/string_builder.h"
|
||||
#include "drivers/gles3/rasterizer_util_gles3.h"
|
||||
#include "drivers/gles3/storage/config.h"
|
||||
|
||||
static String _mkid(const String &p_id) {
|
||||
|
|
@ -154,7 +154,7 @@ RID ShaderGLES3::version_create() {
|
|||
}
|
||||
|
||||
void ShaderGLES3::_build_variant_code(StringBuilder &builder, uint32_t p_variant, const Version *p_version, StageType p_stage_type, uint64_t p_specialization) {
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
builder.append("#version 330\n");
|
||||
builder.append("#define USE_GLES_OVER_GL\n");
|
||||
} else {
|
||||
|
|
@ -215,7 +215,7 @@ void ShaderGLES3::_build_variant_code(StringBuilder &builder, uint32_t p_variant
|
|||
// Default to highp precision unless specified otherwise.
|
||||
builder.append("precision highp float;\n");
|
||||
builder.append("precision highp int;\n");
|
||||
if (!RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (!RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
builder.append("precision highp sampler2D;\n");
|
||||
builder.append("precision highp samplerCube;\n");
|
||||
builder.append("precision highp sampler2DArray;\n");
|
||||
|
|
@ -527,7 +527,7 @@ String ShaderGLES3::_version_get_sha1(Version *p_version) const {
|
|||
hash_build.append("[custom_defines:" + itos(i) + "]");
|
||||
hash_build.append(p_version->custom_defines[i].get_data());
|
||||
}
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
hash_build.append("[gl]");
|
||||
} else {
|
||||
hash_build.append("[gles]");
|
||||
|
|
@ -546,7 +546,7 @@ bool ShaderGLES3::_load_from_cache(Version *p_version) {
|
|||
return false;
|
||||
#else
|
||||
#if !defined(ANDROID_ENABLED) && !defined(IOS_ENABLED)
|
||||
if (RasterizerGLES3::is_gles_over_gl() && (glProgramBinary == nullptr)) { // ARB_get_program_binary extension not available.
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl() && (glProgramBinary == nullptr)) { // ARB_get_program_binary extension not available.
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -633,7 +633,7 @@ void ShaderGLES3::_save_to_cache(Version *p_version) {
|
|||
#else
|
||||
ERR_FAIL_COND(!shader_cache_dir_valid);
|
||||
#if !defined(ANDROID_ENABLED) && !defined(IOS_ENABLED)
|
||||
if (RasterizerGLES3::is_gles_over_gl() && (glGetProgramBinary == nullptr)) { // ARB_get_program_binary extension not available.
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl() && (glGetProgramBinary == nullptr)) { // ARB_get_program_binary extension not available.
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,18 +30,18 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/math/projection.h"
|
||||
#include "core/os/mutex.h"
|
||||
#include "core/string/string_builder.h"
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "core/templates/a_hash_map.h"
|
||||
#include "core/templates/hash_map.h"
|
||||
#include "core/templates/local_vector.h"
|
||||
#include "core/templates/rid_owner.h"
|
||||
#include "servers/rendering/rendering_server.h"
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "platform_gl.h"
|
||||
|
||||
class StringBuilder;
|
||||
|
||||
class ShaderGLES3 {
|
||||
public:
|
||||
struct TextureUniformData {
|
||||
|
|
@ -105,8 +105,6 @@ private:
|
|||
LocalVector<AHashMap<uint64_t, Specialization>> variants;
|
||||
};
|
||||
|
||||
Mutex variant_set_mutex;
|
||||
|
||||
void _get_uniform_locations(Version::Specialization &spec, Version *p_version);
|
||||
void _compile_specialization(Version::Specialization &spec, uint32_t p_variant, Version *p_version, uint64_t p_specialization);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,11 +28,14 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "../rasterizer_gles3.h"
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "drivers/gles3/rasterizer_util_gles3.h"
|
||||
|
||||
#ifdef WEB_ENABLED
|
||||
#include <emscripten/html5_webgl.h>
|
||||
|
|
@ -83,7 +86,7 @@ Config::Config() {
|
|||
astc_layered_supported = astc_hdr_supported || extensions.has("GL_KHR_texture_compression_astc_sliced_3d");
|
||||
astc_supported = astc_layered_supported || extensions.has("GL_KHR_texture_compression_astc_ldr") || extensions.has("WEBGL_compressed_texture_astc");
|
||||
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
float_texture_supported = true;
|
||||
float_texture_linear_supported = true;
|
||||
etc2_supported = false;
|
||||
|
|
|
|||
|
|
@ -32,10 +32,12 @@
|
|||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/templates/hash_set.h"
|
||||
|
||||
// FIXME: platform_gl.h includes windows.h via egl.h, which defines ConnectFlags.
|
||||
// This breaks include project_settings.h in config.cpp, so we include object.h first.
|
||||
#include "core/object/object.h"
|
||||
|
||||
#include "platform_gl.h"
|
||||
|
||||
#ifdef ANDROID_ENABLED
|
||||
|
|
@ -46,6 +48,8 @@ typedef void (*PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC)(GLenum, GLenu
|
|||
typedef void (*PFNEGLIMAGETARGETTEXTURE2DOESPROC)(GLenum, void *);
|
||||
#endif
|
||||
|
||||
class String;
|
||||
|
||||
namespace GLES3 {
|
||||
|
||||
class Config {
|
||||
|
|
|
|||
|
|
@ -28,14 +28,17 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "light_storage.h"
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "light_storage.h"
|
||||
#include "../rasterizer_gles3.h"
|
||||
#include "../rasterizer_scene_gles3.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/math/geometry_3d.h"
|
||||
#include "texture_storage.h"
|
||||
#include "drivers/gles3/effects/cubemap_filter.h"
|
||||
#include "drivers/gles3/rasterizer_scene_gles3.h"
|
||||
#include "drivers/gles3/rasterizer_util_gles3.h"
|
||||
#include "drivers/gles3/storage/render_scene_buffers_gles3.h"
|
||||
#include "drivers/gles3/storage/utilities.h"
|
||||
|
||||
using namespace GLES3;
|
||||
|
||||
|
|
@ -856,7 +859,7 @@ bool LightStorage::reflection_probe_instance_begin_render(RID p_instance, RID p_
|
|||
atlas->reflections.write[i].color = color;
|
||||
|
||||
#ifdef GL_API_ENABLED
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
for (int s = 0; s < 6; s++) {
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + s, 0, GL_RGB10_A2, atlas->size, atlas->size, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, nullptr);
|
||||
}
|
||||
|
|
@ -864,7 +867,7 @@ bool LightStorage::reflection_probe_instance_begin_render(RID p_instance, RID p_
|
|||
}
|
||||
#endif
|
||||
#ifdef GLES_API_ENABLED
|
||||
if (!RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (!RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
glTexStorage2D(GL_TEXTURE_CUBE_MAP, atlas->mipmap_count, GL_RGB10_A2, atlas->size, atlas->size);
|
||||
}
|
||||
#endif // GLES_API_ENABLED
|
||||
|
|
@ -894,7 +897,7 @@ bool LightStorage::reflection_probe_instance_begin_render(RID p_instance, RID p_
|
|||
atlas->reflections.write[i].radiance = radiance;
|
||||
|
||||
#ifdef GL_API_ENABLED
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
for (int s = 0; s < 6; s++) {
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + s, 0, GL_RGB10_A2, atlas->size, atlas->size, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, nullptr);
|
||||
}
|
||||
|
|
@ -902,7 +905,7 @@ bool LightStorage::reflection_probe_instance_begin_render(RID p_instance, RID p_
|
|||
}
|
||||
#endif
|
||||
#ifdef GLES_API_ENABLED
|
||||
if (!RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (!RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
glTexStorage2D(GL_TEXTURE_CUBE_MAP, atlas->mipmap_count, GL_RGB10_A2, atlas->size, atlas->size);
|
||||
}
|
||||
#endif // GLES_API_ENABLED
|
||||
|
|
@ -1667,7 +1670,7 @@ void LightStorage::update_directional_shadow_atlas() {
|
|||
glUseProgram(0);
|
||||
glDepthMask(GL_TRUE);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, directional_shadow.fbo);
|
||||
RasterizerGLES3::clear_depth(0.0);
|
||||
RasterizerUtilGLES3::clear_depth(0.0);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
|
|
|||
|
|
@ -32,15 +32,16 @@
|
|||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "platform_gl.h"
|
||||
#include "render_scene_buffers_gles3.h"
|
||||
|
||||
#include "core/templates/local_vector.h"
|
||||
#include "core/templates/rid_owner.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
#include "servers/rendering/storage/light_storage.h"
|
||||
#include "servers/rendering/storage/utilities.h"
|
||||
|
||||
#include "platform_gl.h"
|
||||
|
||||
class RenderSceneBuffersGLES3;
|
||||
|
||||
namespace GLES3 {
|
||||
|
||||
/* LIGHT */
|
||||
|
|
|
|||
|
|
@ -28,17 +28,15 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "material_storage.h"
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "material_storage.h"
|
||||
#include "particles_storage.h"
|
||||
#include "texture_storage.h"
|
||||
|
||||
#include "drivers/gles3/rasterizer_canvas_gles3.h"
|
||||
#include "drivers/gles3/rasterizer_gles3.h"
|
||||
#include "drivers/gles3/storage/config.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
#include "servers/rendering/storage/variant_converters.h"
|
||||
|
||||
using namespace GLES3;
|
||||
|
|
|
|||
|
|
@ -34,16 +34,15 @@
|
|||
|
||||
#include "core/templates/rid_owner.h"
|
||||
#include "core/templates/self_list.h"
|
||||
#include "servers/rendering/shader_compiler.h"
|
||||
#include "servers/rendering/shader_language.h"
|
||||
#include "servers/rendering/storage/material_storage.h"
|
||||
#include "servers/rendering/storage/utilities.h"
|
||||
|
||||
#include "drivers/gles3/shaders/canvas.glsl.gen.h"
|
||||
#include "drivers/gles3/shaders/particles.glsl.gen.h"
|
||||
#include "drivers/gles3/shaders/scene.glsl.gen.h"
|
||||
#include "drivers/gles3/shaders/sky.glsl.gen.h"
|
||||
#include "drivers/gles3/shaders/tex_blit.glsl.gen.h"
|
||||
#include "servers/rendering/shader_compiler.h"
|
||||
#include "servers/rendering/shader_language.h"
|
||||
#include "servers/rendering/storage/material_storage.h"
|
||||
#include "servers/rendering/storage/utilities.h"
|
||||
|
||||
namespace GLES3 {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,12 +28,13 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "mesh_storage.h"
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "mesh_storage.h"
|
||||
#include "config.h"
|
||||
#include "texture_storage.h"
|
||||
#include "utilities.h"
|
||||
#include "drivers/gles3/storage/config.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
#include "drivers/gles3/storage/utilities.h"
|
||||
|
||||
using namespace GLES3;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,16 +28,15 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "particles_storage.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "material_storage.h"
|
||||
#include "mesh_storage.h"
|
||||
#include "texture_storage.h"
|
||||
#include "utilities.h"
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "drivers/gles3/storage/config.h"
|
||||
#include "drivers/gles3/storage/material_storage.h"
|
||||
#include "drivers/gles3/storage/mesh_storage.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
#include "drivers/gles3/storage/utilities.h"
|
||||
#include "servers/rendering/rendering_server_globals.h"
|
||||
|
||||
using namespace GLES3;
|
||||
|
|
|
|||
|
|
@ -28,12 +28,13 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "render_scene_buffers_gles3.h"
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "render_scene_buffers_gles3.h"
|
||||
#include "config.h"
|
||||
#include "texture_storage.h"
|
||||
#include "utilities.h"
|
||||
#include "drivers/gles3/storage/config.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
#include "drivers/gles3/storage/utilities.h"
|
||||
|
||||
// Will only be defined if GLES 3.2 headers are included
|
||||
#ifndef GL_TEXTURE_2D_MULTISAMPLE_ARRAY
|
||||
|
|
|
|||
|
|
@ -28,14 +28,15 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "texture_storage.h"
|
||||
|
||||
#include "../effects/copy_effects.h"
|
||||
#include "../rasterizer_gles3.h"
|
||||
#include "config.h"
|
||||
#include "utilities.h"
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "drivers/gles3/effects/copy_effects.h"
|
||||
#include "drivers/gles3/rasterizer_gles3.h"
|
||||
#include "drivers/gles3/rasterizer_util_gles3.h"
|
||||
#include "drivers/gles3/storage/material_storage.h"
|
||||
#include "drivers/gles3/storage/utilities.h"
|
||||
|
||||
using namespace GLES3;
|
||||
|
||||
|
|
@ -283,7 +284,7 @@ TextureStorage::TextureStorage() {
|
|||
}
|
||||
|
||||
#ifdef GL_API_ENABLED
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
glEnable(GL_PROGRAM_POINT_SIZE);
|
||||
}
|
||||
#endif // GL_API_ENABLED
|
||||
|
|
@ -453,7 +454,7 @@ static inline Error _get_gl_uncompressed_format(const Ref<Image> &p_image, Image
|
|||
|
||||
switch (p_format) {
|
||||
case Image::FORMAT_L8: {
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
r_gl_internal_format = GL_R8;
|
||||
r_gl_format = GL_RED;
|
||||
r_gl_type = GL_UNSIGNED_BYTE;
|
||||
|
|
@ -464,7 +465,7 @@ static inline Error _get_gl_uncompressed_format(const Ref<Image> &p_image, Image
|
|||
}
|
||||
} break;
|
||||
case Image::FORMAT_LA8: {
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
r_gl_internal_format = GL_RG8;
|
||||
r_gl_format = GL_RG;
|
||||
r_gl_type = GL_UNSIGNED_BYTE;
|
||||
|
|
@ -1521,7 +1522,7 @@ Ref<Image> TextureStorage::texture_2d_get(RID p_texture) const {
|
|||
|
||||
Ref<Image> image;
|
||||
#ifdef GL_API_ENABLED
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
// OpenGL 3.3 supports glGetTexImage which is faster and simpler than glReadPixels.
|
||||
// It also allows for reading compressed textures, mipmaps, and more formats.
|
||||
Vector<uint8_t> data;
|
||||
|
|
@ -1564,7 +1565,7 @@ Ref<Image> TextureStorage::texture_2d_get(RID p_texture) const {
|
|||
}
|
||||
#endif // GL_API_ENABLED
|
||||
#ifdef GLES_API_ENABLED
|
||||
if (!RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (!RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
Vector<uint8_t> data;
|
||||
|
||||
// On web and mobile we always read an RGBA8 image with no mipmaps.
|
||||
|
|
@ -2001,7 +2002,7 @@ void TextureStorage::_texture_set_data(RID p_texture, const Ref<Image> &p_image,
|
|||
bool needs_decompress = texture->resize_to_po2;
|
||||
|
||||
// Support for RGTC-compressed Texture Arrays isn't mandated by GLES3/WebGL.
|
||||
if (!RasterizerGLES3::is_gles_over_gl() && texture->target == GL_TEXTURE_2D_ARRAY) {
|
||||
if (!RasterizerUtilGLES3::is_gles_over_gl() && texture->target == GL_TEXTURE_2D_ARRAY) {
|
||||
if (p_image->get_format() == Image::FORMAT_RGTC_R || p_image->get_format() == Image::FORMAT_RGTC_RG) {
|
||||
needs_decompress = true;
|
||||
}
|
||||
|
|
@ -2173,7 +2174,7 @@ void TextureStorage::_texture_set_swizzle(GLES3::Texture *p_texture, Image::Form
|
|||
#ifndef WEB_ENABLED
|
||||
switch (p_texture->format) {
|
||||
case Image::FORMAT_L8: {
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
glTexParameteri(p_texture->target, GL_TEXTURE_SWIZZLE_R, GL_RED);
|
||||
glTexParameteri(p_texture->target, GL_TEXTURE_SWIZZLE_G, GL_RED);
|
||||
glTexParameteri(p_texture->target, GL_TEXTURE_SWIZZLE_B, GL_RED);
|
||||
|
|
@ -2186,7 +2187,7 @@ void TextureStorage::_texture_set_swizzle(GLES3::Texture *p_texture, Image::Form
|
|||
}
|
||||
} break;
|
||||
case Image::FORMAT_LA8: {
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
glTexParameteri(p_texture->target, GL_TEXTURE_SWIZZLE_R, GL_RED);
|
||||
glTexParameteri(p_texture->target, GL_TEXTURE_SWIZZLE_G, GL_RED);
|
||||
glTexParameteri(p_texture->target, GL_TEXTURE_SWIZZLE_B, GL_RED);
|
||||
|
|
|
|||
|
|
@ -32,16 +32,14 @@
|
|||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "platform_gl.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "core/io/image.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/templates/rb_map.h"
|
||||
#include "core/templates/rid_owner.h"
|
||||
#include "servers/rendering/renderer_compositor.h"
|
||||
#include "drivers/gles3/shaders/canvas_sdf.glsl.gen.h"
|
||||
#include "drivers/gles3/storage/config.h"
|
||||
#include "servers/rendering/storage/texture_storage.h"
|
||||
|
||||
#include "drivers/gles3/shaders/canvas_sdf.glsl.gen.h"
|
||||
#include "platform_gl.h"
|
||||
|
||||
namespace GLES3 {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,17 +28,17 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include "../rasterizer_gles3.h"
|
||||
#include "config.h"
|
||||
#include "light_storage.h"
|
||||
#include "material_storage.h"
|
||||
#include "mesh_storage.h"
|
||||
#include "particles_storage.h"
|
||||
#include "texture_storage.h"
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
#include "drivers/gles3/rasterizer_util_gles3.h"
|
||||
#include "drivers/gles3/storage/config.h"
|
||||
#include "drivers/gles3/storage/light_storage.h"
|
||||
#include "drivers/gles3/storage/material_storage.h"
|
||||
#include "drivers/gles3/storage/mesh_storage.h"
|
||||
#include "drivers/gles3/storage/particles_storage.h"
|
||||
#include "drivers/gles3/storage/texture_storage.h"
|
||||
|
||||
using namespace GLES3;
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ void Utilities::capture_timestamp(const String &p_name) {
|
|||
ERR_FAIL_COND(frames[frame].timestamp_count >= max_timestamp_query_elements);
|
||||
|
||||
#ifdef GL_API_ENABLED
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
glQueryCounter(frames[frame].queries[frames[frame].timestamp_count], GL_TIMESTAMP);
|
||||
}
|
||||
#endif // GL_API_ENABLED
|
||||
|
|
@ -339,7 +339,7 @@ void Utilities::_capture_timestamps_begin() {
|
|||
// frame is incremented at the end of the frame so this gives us the queries for frame - 2. By then they should be ready.
|
||||
if (frames[frame].timestamp_count) {
|
||||
#ifdef GL_API_ENABLED
|
||||
if (RasterizerGLES3::is_gles_over_gl()) {
|
||||
if (RasterizerUtilGLES3::is_gles_over_gl()) {
|
||||
for (uint32_t i = 0; i < frames[frame].timestamp_count; i++) {
|
||||
uint64_t temp = 0;
|
||||
glGetQueryObjectui64v(frames[frame].queries[i], GL_QUERY_RESULT, &temp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue