summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/builtin_openssl2/SCsub3
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp58
-rw-r--r--drivers/gles2/shaders/material.glsl12
-rw-r--r--drivers/theora/SCsub44
4 files changed, 87 insertions, 30 deletions
diff --git a/drivers/builtin_openssl2/SCsub b/drivers/builtin_openssl2/SCsub
index a28bc2922c..0c035cc4a5 100644
--- a/drivers/builtin_openssl2/SCsub
+++ b/drivers/builtin_openssl2/SCsub
@@ -656,7 +656,8 @@ if "platform" in env and env["platform"] == "winrt":
# Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517)
import os
-if not (os.name=="nt" and os.getenv("VSINSTALLDIR")!=None): # not Windows and not MSVC
+import methods
+if not (os.name=="nt" and methods.msvc_is_detected() ): # not Windows and not MSVC
env_drivers.Append(CFLAGS=["-Wno-error=implicit-function-declaration"])
env_drivers.add_source_files(env.drivers_sources,openssl_sources)
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index aeb3d9e039..a7edc8d935 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -36,6 +36,7 @@
#include "servers/visual/particle_system_sw.h"
#include "gl_context/context_gl.h"
#include <string.h>
+#include <stdlib.h>
#ifdef GLEW_ENABLED
#define _GL_HALF_FLOAT_OES 0x140B
@@ -5455,9 +5456,16 @@ void RasterizerGLES2::_setup_light(uint16_t p_light) {
}
- light_data[VL_LIGHT_ATTENUATION][0]=l->vars[VS::LIGHT_PARAM_ENERGY];
- light_data[VL_LIGHT_ATTENUATION][1]=l->vars[VS::LIGHT_PARAM_RADIUS];
- light_data[VL_LIGHT_ATTENUATION][2]=l->vars[VS::LIGHT_PARAM_ATTENUATION];
+ light_data[VL_LIGHT_ATTENUATION][0] = l->vars[VS::LIGHT_PARAM_ENERGY];
+
+ if (l->type == VS::LIGHT_DIRECTIONAL) {
+ light_data[VL_LIGHT_ATTENUATION][1] = l->directional_shadow_param[VS::LIGHT_DIRECTIONAL_SHADOW_PARAM_MAX_DISTANCE];
+ }
+ else{
+ light_data[VL_LIGHT_ATTENUATION][1] = l->vars[VS::LIGHT_PARAM_RADIUS];
+ }
+
+ light_data[VL_LIGHT_ATTENUATION][2] = l->vars[VS::LIGHT_PARAM_ATTENUATION];
light_data[VL_LIGHT_SPOT_ATTENUATION][0]=Math::cos(Math::deg2rad(l->vars[VS::LIGHT_PARAM_SPOT_ANGLE]));
light_data[VL_LIGHT_SPOT_ATTENUATION][1]=l->vars[VS::LIGHT_PARAM_SPOT_ATTENUATION];
@@ -10813,14 +10821,52 @@ void RasterizerGLES2::init() {
print_line(String("GLES2: Using GLEW ") + (const char*) glewGetString(GLEW_VERSION));
}
+ // Godot makes use of functions from ARB_framebuffer_object extension which is not implemented by all drivers.
+ // On the other hand, these drivers might implement the older EXT_framebuffer_object extension
+ // with which current source code is backward compatible.
+
+ bool framebuffer_object_is_supported = glewIsSupported("GL_ARB_framebuffer_object");
+
+ if ( !framebuffer_object_is_supported ) {
+ WARN_PRINT("GL_ARB_framebuffer_object not supported by your graphics card.");
+
+ if ( glewIsSupported("GL_EXT_framebuffer_object") ) {
+ // falling-back to the older EXT function if present
+ WARN_PRINT("Falling-back to GL_EXT_framebuffer_object.");
+
+ glIsRenderbuffer = glIsRenderbufferEXT;
+ glBindRenderbuffer = glBindRenderbufferEXT;
+ glDeleteRenderbuffers = glDeleteRenderbuffersEXT;
+ glGenRenderbuffers = glGenRenderbuffersEXT;
+ glRenderbufferStorage = glRenderbufferStorageEXT;
+ glGetRenderbufferParameteriv = glGetRenderbufferParameterivEXT;
+ glIsFramebuffer = glIsFramebufferEXT;
+ glBindFramebuffer = glBindFramebufferEXT;
+ glDeleteFramebuffers = glDeleteFramebuffersEXT;
+ glGenFramebuffers = glGenFramebuffersEXT;
+ glCheckFramebufferStatus = glCheckFramebufferStatusEXT;
+ glFramebufferTexture1D = glFramebufferTexture1DEXT;
+ glFramebufferTexture2D = glFramebufferTexture2DEXT;
+ glFramebufferTexture3D = glFramebufferTexture3DEXT;
+ glFramebufferRenderbuffer = glFramebufferRenderbufferEXT;
+ glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT;
+ glGenerateMipmap = glGenerateMipmapEXT;
+
+ framebuffer_object_is_supported = true;
+ }
+ else {
+ ERR_PRINT("Framebuffer Object is not supported by your graphics card.");
+ }
+ }
+
// Check for GL 2.1 compatibility, if not bail out
- if (!glewIsSupported("GL_VERSION_2_1")) {
+ if (!(glewIsSupported("GL_VERSION_2_1") && framebuffer_object_is_supported)) {
ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n"
- "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.");
+ "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot is now going to terminate.");
OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n"
"Godot Engine will self-destruct as soon as you acknowledge this error message.",
"Fatal error: Insufficient OpenGL / GLES drivers");
- // TODO: If it's even possible, we should stop the execution without segfault and memory leaks :)
+ exit(1);
}
#endif
diff --git a/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl
index 477a451f2f..e5be25757d 100644
--- a/drivers/gles2/shaders/material.glsl
+++ b/drivers/gles2/shaders/material.glsl
@@ -980,6 +980,12 @@ FRAGMENT_SHADER_CODE
#ifdef LIGHT_USE_SHADOW
#ifdef LIGHT_TYPE_DIRECTIONAL
+ float shadow_fade_exponent=5.0; //hardcoded for now
+ float shadow_fade=pow(length(vertex_interp)/light_attenuation.g,shadow_fade_exponent);
+
+// optimization - skip shadows outside visible range
+ if(shadow_fade<1.0){
+
#ifdef LIGHT_USE_PSSM
@@ -1105,6 +1111,12 @@ FRAGMENT_SHADER_CODE
shadow_attenuation=SAMPLE_SHADOW_TEX(shadow_coord.xy,shadow_coord.z);
#endif
+
+ shadow_attenuation=mix(shadow_attenuation,1.0,shadow_fade);
+ }else{
+ shadow_attenuation=1.0;
+ };
+
#endif
#ifdef LIGHT_TYPE_OMNI
diff --git a/drivers/theora/SCsub b/drivers/theora/SCsub
index fa85b49804..94477d2827 100644
--- a/drivers/theora/SCsub
+++ b/drivers/theora/SCsub
@@ -1,11 +1,11 @@
Import('env')
sources = [
- "theora/analyze.c",
- "theora/apiwrapper.c",
+ #"theora/analyze.c",
+ #"theora/apiwrapper.c",
"theora/bitpack.c",
"theora/cpu.c",
- "theora/decapiwrapper.c",
+ #"theora/decapiwrapper.c",
"theora/decinfo.c",
"theora/decode.c",
"theora/dequant.c",
@@ -13,55 +13,53 @@ sources = [
#"theora/encfrag.c",
#"theora/encinfo.c",
#"theora/encode.c",
- "theora/encoder_disabled.c",
- "theora/enquant.c",
- "theora/fdct.c",
+ #"theora/encoder_disabled.c",
+ #"theora/enquant.c",
+ #"theora/fdct.c",
"theora/fragment.c",
"theora/huffdec.c",
- "theora/huffenc.c",
+ #"theora/huffenc.c",
"theora/idct.c",
"theora/info.c",
"theora/internal.c",
- "theora/mathops.c",
- "theora/mcenc.c",
+ #"theora/mathops.c",
+ #"theora/mcenc.c",
"theora/quant.c",
- "theora/rate.c",
+ #"theora/rate.c",
"theora/state.c",
- "theora/tokenize.c",
+ #"theora/tokenize.c",
"theora/video_stream_theora.cpp",
]
sources_x86 = [
- "theora/x86/mmxencfrag.c",
- "theora/x86/mmxfdct.c",
+ #"theora/x86/mmxencfrag.c",
+ #"theora/x86/mmxfdct.c",
"theora/x86/mmxfrag.c",
"theora/x86/mmxidct.c",
"theora/x86/mmxstate.c",
- "theora/x86/sse2fdct.c",
- "theora/x86/x86enc.c",
+ #"theora/x86/sse2fdct.c",
+ #"theora/x86/x86enc.c",
"theora/x86/x86state.c",
]
sources_x86_vc = [
- "theora/x86_vc/mmxencfrag.c",
- "theora/x86_vc/mmxfdct.c",
+ #"theora/x86_vc/mmxencfrag.c",
+ #"theora/x86_vc/mmxfdct.c",
"theora/x86_vc/mmxfrag.c",
"theora/x86_vc/mmxidct.c",
"theora/x86_vc/mmxstate.c",
- "theora/x86_vc/x86enc.c",
+ #"theora/x86_vc/x86enc.c",
"theora/x86_vc/x86state.c",
]
env.drivers_sources += sources
if (env["x86_opt_gcc"]):
- env.Append(CCFLAGS=["-DOC_X86_ASM"])
env.drivers_sources += sources_x86
if (env["x86_opt_vc"]):
- env.Append(CCFLAGS=["-DOC_X86_ASM"])
env.drivers_sources += sources_x86_vc
-
-
-
+if (env["x86_opt_gcc"] or env["x86_opt_vc"]):
+ Import('env_drivers')
+ env_drivers.Append(CCFLAGS=["-DOC_X86_ASM"])