| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#ifdef GLES3_ENABLED |
| 34 |
|
| 35 |
#include "effects/copy_effects.h" |
| 36 |
#include "effects/cubemap_filter.h" |
| 37 |
#include "effects/feed_effects.h" |
| 38 |
#include "effects/glow.h" |
| 39 |
#include "effects/post_effects.h" |
| 40 |
#include "environment/fog.h" |
| 41 |
#include "environment/gi.h" |
| 42 |
#include "rasterizer_canvas_gles3.h" |
| 43 |
#include "rasterizer_scene_gles3.h" |
| 44 |
#include "servers/rendering/renderer_compositor.h" |
| 45 |
#include "storage/config.h" |
| 46 |
#include "storage/light_storage.h" |
| 47 |
#include "storage/material_storage.h" |
| 48 |
#include "storage/mesh_storage.h" |
| 49 |
#include "storage/particles_storage.h" |
| 50 |
#include "storage/texture_storage.h" |
| 51 |
#include "storage/utilities.h" |
| 52 |
|
| 53 |
class RasterizerGLES3 : public RendererCompositor { |
| 54 |
private: |
| 55 |
uint64_t frame = 1; |
| 56 |
float delta = 0; |
| 57 |
|
| 58 |
double time_total = 0.0; |
| 59 |
|
| 60 |
#ifdef WINDOWS_ENABLED |
| 61 |
static bool screen_flipped_y; |
| 62 |
#endif |
| 63 |
|
| 64 |
static bool gles_over_gl; |
| 65 |
|
| 66 |
protected: |
| 67 |
GLES3::Config *config = nullptr; |
| 68 |
GLES3::Utilities *utilities = nullptr; |
| 69 |
GLES3::TextureStorage *texture_storage = nullptr; |
| 70 |
GLES3::MaterialStorage *material_storage = nullptr; |
| 71 |
GLES3::MeshStorage *mesh_storage = nullptr; |
| 72 |
GLES3::ParticlesStorage *particles_storage = nullptr; |
| 73 |
GLES3::LightStorage *light_storage = nullptr; |
| 74 |
GLES3::GI *gi = nullptr; |
| 75 |
GLES3::Fog *fog = nullptr; |
| 76 |
GLES3::CopyEffects *copy_effects = nullptr; |
| 77 |
GLES3::CubemapFilter *cubemap_filter = nullptr; |
| 78 |
GLES3::Glow *glow = nullptr; |
| 79 |
GLES3::PostEffects *post_effects = nullptr; |
| 80 |
GLES3::FeedEffects *feed_effects = nullptr; |
| 81 |
RasterizerCanvasGLES3 *canvas = nullptr; |
| 82 |
RasterizerSceneGLES3 *scene = nullptr; |
| 83 |
static RasterizerGLES3 *singleton; |
| 84 |
|
| 85 |
void _blit_render_target_to_screen(DisplayServer::WindowID p_screen, const BlitToScreen &p_blit, bool p_first = true); |
| 86 |
|
| 87 |
public: |
| 88 |
RendererUtilities *get_utilities() { return utilities; } |
| 89 |
RendererLightStorage *get_light_storage() { return light_storage; } |
| 90 |
RendererMaterialStorage *get_material_storage() { return material_storage; } |
| 91 |
RendererMeshStorage *get_mesh_storage() { return mesh_storage; } |
| 92 |
RendererParticlesStorage *get_particles_storage() { return particles_storage; } |
| 93 |
RendererTextureStorage *get_texture_storage() { return texture_storage; } |
| 94 |
RendererGI *get_gi() { return gi; } |
| 95 |
RendererFog *get_fog() { return fog; } |
| 96 |
RendererCanvasRender *get_canvas() { return canvas; } |
| 97 |
RendererSceneRender *get_scene() { return scene; } |
| 98 |
|
| 99 |
void set_boot_image_with_stretch(const Ref<Image> &p_image, const Color &p_color, RenderingServer::SplashStretchMode p_stretch_mode, bool p_use_filter = true); |
| 100 |
|
| 101 |
void initialize(); |
| 102 |
void begin_frame(double frame_step); |
| 103 |
|
| 104 |
void blit_render_targets_to_screen(DisplayServer::WindowID p_screen, const BlitToScreen *p_render_targets, int p_amount); |
| 105 |
|
| 106 |
bool is_opengl() { return true; } |
| 107 |
void gl_end_frame(bool p_swap_buffers); |
| 108 |
void end_frame(bool p_swap_buffers); |
| 109 |
|
| 110 |
void finalize(); |
| 111 |
|
| 112 |
static RendererCompositor *_create_current() { |
| 113 |
return memnew(RasterizerGLES3); |
| 114 |
} |
| 115 |
|
| 116 |
static bool is_gles_over_gl() { return gles_over_gl; } |
| 117 |
static void clear_depth(float p_depth); |
| 118 |
static void clear_stencil(int32_t p_stencil); |
| 119 |
|
| 120 |
static void make_current(bool p_gles_over_gl) { |
| 121 |
gles_over_gl = p_gles_over_gl; |
| 122 |
OS::get_singleton()->set_gles_over_gl(gles_over_gl); |
| 123 |
_create_func = _create_current; |
| 124 |
low_end = true; |
| 125 |
} |
| 126 |
|
| 127 |
#ifdef WINDOWS_ENABLED |
| 128 |
static void set_screen_flipped_y(bool p_flipped) { |
| 129 |
screen_flipped_y = p_flipped; |
| 130 |
} |
| 131 |
#endif |
| 132 |
|
| 133 |
_ALWAYS_INLINE_ uint64_t get_frame_number() const { return frame; } |
| 134 |
_ALWAYS_INLINE_ double get_frame_delta_time() const { return delta; } |
| 135 |
_ALWAYS_INLINE_ double get_total_time() const { return time_total; } |
| 136 |
_ALWAYS_INLINE_ bool can_create_resources_async() const { return false; } |
| 137 |
|
| 138 |
static RasterizerGLES3 *get_singleton() { return singleton; } |
| 139 |
RasterizerGLES3(); |
| 140 |
~RasterizerGLES3(); |
| 141 |
}; |
| 142 |
|
| 143 |
#endif |