|
@@ -165,7 +165,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
} break;
|
|
|
case Image::FORMAT_RGB8: {
|
|
|
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? GL_SRGB8 : GL_RGB8;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? GL_SRGB8 : GL_RGB8;
|
|
|
r_gl_format = GL_RGB;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
srgb = true;
|
|
@@ -174,7 +174,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
case Image::FORMAT_RGBA8: {
|
|
|
|
|
|
r_gl_format = GL_RGBA;
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? GL_SRGB8_ALPHA8 : GL_RGBA8;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? GL_SRGB8_ALPHA8 : GL_RGBA8;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
srgb = true;
|
|
|
|
|
@@ -254,7 +254,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
|
|
|
if (config.s3tc_supported) {
|
|
|
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV : _EXT_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV : _EXT_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
|
|
r_gl_format = GL_RGBA;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
r_compressed = true;
|
|
@@ -270,7 +270,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
|
|
|
if (config.s3tc_supported) {
|
|
|
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV : _EXT_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV : _EXT_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
|
|
r_gl_format = GL_RGBA;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
r_compressed = true;
|
|
@@ -286,7 +286,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
|
|
|
if (config.s3tc_supported) {
|
|
|
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV : _EXT_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV : _EXT_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
|
|
r_gl_format = GL_RGBA;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
r_compressed = true;
|
|
@@ -331,7 +331,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
|
|
|
if (config.bptc_supported) {
|
|
|
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM : _EXT_COMPRESSED_RGBA_BPTC_UNORM;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM : _EXT_COMPRESSED_RGBA_BPTC_UNORM;
|
|
|
r_gl_format = GL_RGBA;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
r_compressed = true;
|
|
@@ -371,7 +371,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
|
|
|
if (config.pvrtc_supported) {
|
|
|
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT : _EXT_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT : _EXT_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
|
|
r_gl_format = GL_RGBA;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
r_compressed = true;
|
|
@@ -386,7 +386,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
|
|
|
if (config.pvrtc_supported) {
|
|
|
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT : _EXT_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT : _EXT_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
|
|
|
r_gl_format = GL_RGBA;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
r_compressed = true;
|
|
@@ -402,7 +402,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
|
|
|
if (config.pvrtc_supported) {
|
|
|
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT : _EXT_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT : _EXT_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
|
|
|
r_gl_format = GL_RGBA;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
r_compressed = true;
|
|
@@ -418,7 +418,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
|
|
|
if (config.pvrtc_supported) {
|
|
|
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT : _EXT_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT : _EXT_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
|
|
|
r_gl_format = GL_RGBA;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
r_compressed = true;
|
|
@@ -503,7 +503,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
|
|
|
if (config.etc2_supported) {
|
|
|
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB8_ETC2 : _EXT_COMPRESSED_RGB8_ETC2;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB8_ETC2 : _EXT_COMPRESSED_RGB8_ETC2;
|
|
|
r_gl_format = GL_RGB;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
r_compressed = true;
|
|
@@ -518,7 +518,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
|
|
|
if (config.etc2_supported) {
|
|
|
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : _EXT_COMPRESSED_RGBA8_ETC2_EAC;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : _EXT_COMPRESSED_RGBA8_ETC2_EAC;
|
|
|
r_gl_format = GL_RGBA;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
r_compressed = true;
|
|
@@ -533,7 +533,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
|
|
|
if (config.etc2_supported) {
|
|
|
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? _EXT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 : _EXT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? _EXT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 : _EXT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
|
|
|
r_gl_format = GL_RGBA;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
r_compressed = true;
|
|
@@ -560,7 +560,7 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
|
|
|
}
|
|
|
|
|
|
r_gl_format = GL_RGBA;
|
|
|
- r_gl_internal_format = (config.srgb_decode_supported || p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) ? GL_SRGB8_ALPHA8 : GL_RGBA8;
|
|
|
+ r_gl_internal_format = (config.srgb_decode_supported || (p_flags & VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) ? GL_SRGB8_ALPHA8 : GL_RGBA8;
|
|
|
r_gl_type = GL_UNSIGNED_BYTE;
|
|
|
r_compressed = false;
|
|
|
srgb = true;
|
|
@@ -686,7 +686,7 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref<Image> &p
|
|
|
|
|
|
texture->ignore_mipmaps = compressed && !img->has_mipmaps();
|
|
|
|
|
|
- if (texture->flags & VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps)
|
|
|
+ if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && !texture->ignore_mipmaps)
|
|
|
glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, config.use_fast_texture_filter ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR_MIPMAP_LINEAR);
|
|
|
else {
|
|
|
if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
|
|
@@ -717,7 +717,7 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref<Image> &p
|
|
|
glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // raw Filtering
|
|
|
}
|
|
|
|
|
|
- if ((texture->flags & VS::TEXTURE_FLAG_REPEAT || texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) && texture->target != GL_TEXTURE_CUBE_MAP) {
|
|
|
+ if (((texture->flags & VS::TEXTURE_FLAG_REPEAT) || (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT)) && texture->target != GL_TEXTURE_CUBE_MAP) {
|
|
|
|
|
|
if (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) {
|
|
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
|
|
@@ -770,7 +770,7 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref<Image> &p
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- int mipmaps = (texture->flags & VS::TEXTURE_FLAG_MIPMAPS && img->has_mipmaps()) ? img->get_mipmap_count() + 1 : 1;
|
|
|
+ int mipmaps = ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && img->has_mipmaps()) ? img->get_mipmap_count() + 1 : 1;
|
|
|
|
|
|
int w = img->get_width();
|
|
|
int h = img->get_height();
|
|
@@ -820,7 +820,7 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref<Image> &p
|
|
|
|
|
|
texture->stored_cube_sides |= (1 << p_cube_side);
|
|
|
|
|
|
- if (texture->flags & VS::TEXTURE_FLAG_MIPMAPS && mipmaps == 1 && !texture->ignore_mipmaps && (!(texture->flags & VS::TEXTURE_FLAG_CUBEMAP) || texture->stored_cube_sides == (1 << 6) - 1)) {
|
|
|
+ if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && mipmaps == 1 && !texture->ignore_mipmaps && (!(texture->flags & VS::TEXTURE_FLAG_CUBEMAP) || texture->stored_cube_sides == (1 << 6) - 1)) {
|
|
|
//generate mipmaps if they were requested and the image does not contain them
|
|
|
glGenerateMipmap(texture->target);
|
|
|
} else if (mipmaps > 1) {
|
|
@@ -912,7 +912,7 @@ void RasterizerStorageGLES3::texture_set_flags(RID p_texture, uint32_t p_flags)
|
|
|
uint32_t cube = texture->flags & VS::TEXTURE_FLAG_CUBEMAP;
|
|
|
texture->flags = p_flags | cube; // can't remove a cube from being a cube
|
|
|
|
|
|
- if ((texture->flags & VS::TEXTURE_FLAG_REPEAT || texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) && texture->target != GL_TEXTURE_CUBE_MAP) {
|
|
|
+ if (((texture->flags & VS::TEXTURE_FLAG_REPEAT) || (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT)) && texture->target != GL_TEXTURE_CUBE_MAP) {
|
|
|
|
|
|
if (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) {
|
|
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
|
|
@@ -937,7 +937,7 @@ void RasterizerStorageGLES3::texture_set_flags(RID p_texture, uint32_t p_flags)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (texture->flags & VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) {
|
|
|
+ if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && !texture->ignore_mipmaps) {
|
|
|
if (!had_mipmaps && texture->mipmaps == 1) {
|
|
|
glGenerateMipmap(texture->target);
|
|
|
}
|
|
@@ -3360,7 +3360,7 @@ Rect3 RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const {
|
|
|
for (int i = 0; i < mesh->surfaces.size(); i++) {
|
|
|
|
|
|
Rect3 laabb;
|
|
|
- if (mesh->surfaces[i]->format & VS::ARRAY_FORMAT_BONES && mesh->surfaces[i]->skeleton_bone_aabb.size()) {
|
|
|
+ if ((mesh->surfaces[i]->format & VS::ARRAY_FORMAT_BONES) && mesh->surfaces[i]->skeleton_bone_aabb.size()) {
|
|
|
|
|
|
int bs = mesh->surfaces[i]->skeleton_bone_aabb.size();
|
|
|
const Rect3 *skbones = mesh->surfaces[i]->skeleton_bone_aabb.ptr();
|
|
@@ -4631,7 +4631,7 @@ void RasterizerStorageGLES3::light_directional_set_shadow_depth_range_mode(RID p
|
|
|
Light *light = light_owner.getornull(p_light);
|
|
|
ERR_FAIL_COND(!light);
|
|
|
|
|
|
- light->directional_range_mode=p_range_mode;
|
|
|
+ light->directional_range_mode = p_range_mode;
|
|
|
}
|
|
|
|
|
|
VS::LightDirectionalShadowDepthRangeMode RasterizerStorageGLES3::light_directional_get_shadow_depth_range_mode(RID p_light) const {
|
|
@@ -6864,42 +6864,28 @@ int RasterizerStorageGLES3::get_captured_render_info(VS::RenderInfo p_info) {
|
|
|
int RasterizerStorageGLES3::get_render_info(VS::RenderInfo p_info) {
|
|
|
|
|
|
switch (p_info) {
|
|
|
- case VS::INFO_OBJECTS_IN_FRAME: {
|
|
|
-
|
|
|
+ case VS::INFO_OBJECTS_IN_FRAME:
|
|
|
return info.render_final.object_count;
|
|
|
- } break;
|
|
|
- case VS::INFO_VERTICES_IN_FRAME: {
|
|
|
-
|
|
|
+ case VS::INFO_VERTICES_IN_FRAME:
|
|
|
return info.render_final.vertices_count;
|
|
|
- } break;
|
|
|
- case VS::INFO_MATERIAL_CHANGES_IN_FRAME: {
|
|
|
+ case VS::INFO_MATERIAL_CHANGES_IN_FRAME:
|
|
|
return info.render_final.material_switch_count;
|
|
|
- } break;
|
|
|
- case VS::INFO_SHADER_CHANGES_IN_FRAME: {
|
|
|
+ case VS::INFO_SHADER_CHANGES_IN_FRAME:
|
|
|
return info.render_final.shader_rebind_count;
|
|
|
- } break;
|
|
|
- case VS::INFO_SURFACE_CHANGES_IN_FRAME: {
|
|
|
+ case VS::INFO_SURFACE_CHANGES_IN_FRAME:
|
|
|
return info.render_final.surface_switch_count;
|
|
|
- } break;
|
|
|
- case VS::INFO_DRAW_CALLS_IN_FRAME: {
|
|
|
+ case VS::INFO_DRAW_CALLS_IN_FRAME:
|
|
|
return info.render_final.draw_call_count;
|
|
|
- } break;
|
|
|
- case VS::INFO_USAGE_VIDEO_MEM_TOTAL: {
|
|
|
-
|
|
|
+ case VS::INFO_USAGE_VIDEO_MEM_TOTAL:
|
|
|
return 0; //no idea
|
|
|
- } break;
|
|
|
- case VS::INFO_VIDEO_MEM_USED: {
|
|
|
-
|
|
|
+ case VS::INFO_VIDEO_MEM_USED:
|
|
|
return info.vertex_mem + info.texture_mem;
|
|
|
- } break;
|
|
|
- case VS::INFO_TEXTURE_MEM_USED: {
|
|
|
-
|
|
|
+ case VS::INFO_TEXTURE_MEM_USED:
|
|
|
return info.texture_mem;
|
|
|
- } break;
|
|
|
- case VS::INFO_VERTEX_MEM_USED: {
|
|
|
-
|
|
|
+ case VS::INFO_VERTEX_MEM_USED:
|
|
|
return info.vertex_mem;
|
|
|
- } break;
|
|
|
+ default:
|
|
|
+ return 0; //no idea either
|
|
|
}
|
|
|
}
|
|
|
|