summaryrefslogtreecommitdiff
path: root/drivers/gles3
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp7
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp4
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp35
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp24
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h5
5 files changed, 44 insertions, 31 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index c10611c961..458da85e74 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -1,6 +1,11 @@
#include "rasterizer_canvas_gles3.h"
#include "os/os.h"
+#ifdef IPHONE_ENABLED
+// for some reason glClearDepth seems to have been removed in iOS ES3.h
+#define glClearDepth glClearDepthf
+#endif
+
static _FORCE_INLINE_ void store_transform2d(const Transform2D& p_mtx, float* p_array) {
p_array[ 0]=p_mtx.elements[0][0];
@@ -87,7 +92,7 @@ void RasterizerCanvasGLES3::light_internal_update(RID p_rid, Light* p_light) {
if (p_light->radius_cache==0)
li->ubo_data.shadow_gradient=0;
else
- li->ubo_data.shadow_gradient=p_light->shadow_gradient_length/(p_light->radius_cache*1.1);;
+ li->ubo_data.shadow_gradient=p_light->shadow_gradient_length/(p_light->radius_cache*1.1);
li->ubo_data.shadow_distance_mult=(p_light->radius_cache*1.1);
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index b7616db8b1..5c6b9c5410 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -237,7 +237,7 @@ void RasterizerGLES3::set_current_render_target(RID p_render_target){
storage->frame.current_rt=NULL;
storage->frame.clear_request=false;
glViewport(0,0,OS::get_singleton()->get_window_size().width,OS::get_singleton()->get_window_size().height);
- glBindFramebuffer(GL_FRAMEBUFFER,storage->config.system_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER,RasterizerStorageGLES3::system_fbo);
}
}
@@ -268,7 +268,7 @@ void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target,const Rec
canvas->canvas_begin();
glDisable(GL_BLEND);
- glBindFramebuffer(GL_FRAMEBUFFER,storage->config.system_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER,RasterizerStorageGLES3::system_fbo);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D,rt->color);
canvas->draw_generic_textured_rect(p_screen_rect,Rect2(0,0,1,-1));
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 1b531a69b9..f47fcfcd9b 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -3,6 +3,11 @@
#include "os/os.h"
#include "rasterizer_canvas_gles3.h"
+#ifdef IPHONE_ENABLED
+// for some reason glClearDepth seems to have been removed in iOS ES3.h
+#define glClearDepth glClearDepthf
+#endif
+
static const GLenum _cube_side_enum[6]={
GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
@@ -141,7 +146,7 @@ void RasterizerSceneGLES3::shadow_atlas_set_size(RID p_atlas,int p_size){
GL_TEXTURE_2D, shadow_atlas->depth, 0);
glViewport(0,0,shadow_atlas->size,shadow_atlas->size);
- glClearDepth(0);
+ glClearDepth(0.0f);
glClear(GL_DEPTH_BUFFER_BIT);
}
@@ -2270,9 +2275,9 @@ void RasterizerSceneGLES3::_setup_directional_light(int p_index,const Transform&
float sign = li->light_ptr->negative?-1:1;
Color linear_col = li->light_ptr->color.to_linear();
- ubo_data.light_color_energy[0]=linear_col.r*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];;
- ubo_data.light_color_energy[1]=linear_col.g*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];;
- ubo_data.light_color_energy[2]=linear_col.b*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];;
+ ubo_data.light_color_energy[0]=linear_col.r*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
+ ubo_data.light_color_energy[1]=linear_col.g*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
+ ubo_data.light_color_energy[2]=linear_col.b*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
ubo_data.light_color_energy[3]=0;
//omni, keep at 0
@@ -2427,9 +2432,9 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu
float sign = li->light_ptr->negative?-1:1;
Color linear_col = li->light_ptr->color.to_linear();
- ubo_data.light_color_energy[0]=linear_col.r*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];;
- ubo_data.light_color_energy[1]=linear_col.g*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];;
- ubo_data.light_color_energy[2]=linear_col.b*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];;
+ ubo_data.light_color_energy[0]=linear_col.r*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
+ ubo_data.light_color_energy[1]=linear_col.g*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
+ ubo_data.light_color_energy[2]=linear_col.b*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
ubo_data.light_color_energy[3]=0;
@@ -2520,9 +2525,9 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu
float sign = li->light_ptr->negative?-1:1;
Color linear_col = li->light_ptr->color.to_linear();
- ubo_data.light_color_energy[0]=linear_col.r*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];;
- ubo_data.light_color_energy[1]=linear_col.g*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];;
- ubo_data.light_color_energy[2]=linear_col.b*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];;
+ ubo_data.light_color_energy[0]=linear_col.r*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
+ ubo_data.light_color_energy[1]=linear_col.g*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
+ ubo_data.light_color_energy[2]=linear_col.b*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
ubo_data.light_color_energy[3]=0;
Vector3 pos = p_camera_inverse_transform.xform(li->transform.origin);
@@ -3753,8 +3758,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C
glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height);
glColorMask(0,0,0,0);
-
- glClearDepth(1.0);
+ glClearDepth(1.0f);
glClear(GL_DEPTH_BUFFER_BIT);
@@ -3866,7 +3870,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C
}
if (!fb_cleared) {
- glClearDepth(1.0);
+ glClearDepth(1.0f);
glClear(GL_DEPTH_BUFFER_BIT);
}
@@ -3973,7 +3977,6 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C
_render_mrts(env,p_cam_projection);
}
- glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glEnable(GL_BLEND);
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
@@ -4419,7 +4422,7 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa
}
glEnable(GL_SCISSOR_TEST);
- glClearDepth(1.0);
+ glClearDepth(1.0f);
glClear(GL_DEPTH_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
@@ -4472,7 +4475,7 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa
glViewport(local_x,local_y,local_width,local_height);
glScissor(local_x,local_y,local_width,local_height);
glEnable(GL_SCISSOR_TEST);
- glClearDepth(1.0);
+ glClearDepth(1.0f);
glClear(GL_DEPTH_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
//glDisable(GL_DEPTH_TEST);
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index f096719988..9f1ff396f1 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -78,6 +78,8 @@
#define _EXT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E
#define _EXT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F
+GLuint RasterizerStorageGLES3::system_fbo = 0;
+
Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Image::Format p_format, uint32_t p_flags,GLenum& r_gl_format,GLenum& r_gl_internal_format,GLenum &r_gl_type,bool &r_compressed,bool &srgb) {
@@ -133,8 +135,12 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima
} break;
case Image::FORMAT_RGB565: {
+#ifdef IPHONE_ENABLED
+ r_gl_internal_format=GL_RGB565;
+#else
//#warning TODO: Convert tod 555 if 565 is not supported (GLES3.3-)
r_gl_internal_format=GL_RGB5;
+#endif
//r_gl_internal_format=GL_RGB565;
r_gl_format=GL_RGB;
r_gl_type=GL_UNSIGNED_SHORT_5_6_5;
@@ -1186,7 +1192,7 @@ RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source,int p_r
glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
- glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
glDeleteFramebuffers(1, &tmp_fb);
Texture * ctex = memnew( Texture );
@@ -1351,7 +1357,7 @@ void RasterizerStorageGLES3::skybox_set_texture(RID p_skybox, RID p_cube_map, in
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
glDeleteFramebuffers(1, &tmp_fb);
}
@@ -5523,7 +5529,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
- glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE );
@@ -5610,7 +5616,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
- glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
if (status != GL_FRAMEBUFFER_COMPLETE) {
printf("err status: %x\n",status);
@@ -5643,7 +5649,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE );
}
- glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
if (status != GL_FRAMEBUFFER_COMPLETE) {
_render_target_clear(rt);
@@ -5712,7 +5718,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
}
- glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
rt->effects.mip_maps[i].levels=level;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -5941,7 +5947,7 @@ RID RasterizerStorageGLES3::canvas_light_shadow_buffer_create(int p_width) {
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
//printf("errnum: %x\n",status);
- glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
ERR_FAIL_COND_V( status != GL_FRAMEBUFFER_COMPLETE, RID() );
@@ -6296,7 +6302,7 @@ void RasterizerStorageGLES3::initialize() {
config.render_arch=RENDER_ARCH_DESKTOP;
//config.fbo_deferred=int(Globals::get_singleton()->get("rendering/gles3/lighting_technique"));
- config.system_fbo=0;
+ RasterizerStorageGLES3::system_fbo=0;
//// extensions config
@@ -6463,7 +6469,7 @@ void RasterizerStorageGLES3::initialize() {
glBufferData(GL_ARRAY_BUFFER,xf_feedback_size*1024,NULL,GL_STREAM_DRAW);
}
- shaders.blend_shapes.init();;
+ shaders.blend_shapes.init();
glGenVertexArrays(1,&resources.transform_feedback_array);
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index f9e440288f..c8f04f72c1 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -24,6 +24,7 @@ public:
RasterizerCanvasGLES3 *canvas;
RasterizerSceneGLES3 *scene;
+ static GLuint system_fbo; //on some devices, such as apple, screen is rendered to yet another fbo.
enum RenderArchitecture {
RENDER_ARCH_MOBILE,
@@ -34,8 +35,6 @@ public:
RenderArchitecture render_arch;
- GLuint system_fbo; //on some devices, such as apple, screen is rendered to yet another fbo.
-
bool shrink_textures_x2;
bool use_fast_texture_filter;
bool use_anisotropic_filter;
@@ -1011,7 +1010,7 @@ public:
Particles() : particle_element(this) {
emitting=false;
amount=0;
- lifetime=1.0;;
+ lifetime=1.0;
pre_process_time=0.0;
explosiveness=0.0;
randomness=0.0;