summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/SCsub5
-rw-r--r--drivers/gl_context/context_gl.cpp2
-rw-r--r--drivers/gl_context/context_gl.h2
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp62
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp39
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp1
-rw-r--r--drivers/unix/SCsub10
-rw-r--r--drivers/unix/os_unix.cpp27
-rw-r--r--drivers/unix/os_unix.h7
9 files changed, 33 insertions, 122 deletions
diff --git a/drivers/SCsub b/drivers/SCsub
index 34d6254578..938927f3a9 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -34,7 +34,12 @@ if env['tools']:
SConscript("convex_decomp/SCsub")
if env['vsproj']:
+ import os
+ path = os.getcwd()
+ # Change directory so the path resolves correctly in the function call.
+ os.chdir("..")
env.AddToVSProject(env.drivers_sources)
+ os.chdir(path)
if env.split_drivers:
env.split_lib("drivers")
diff --git a/drivers/gl_context/context_gl.cpp b/drivers/gl_context/context_gl.cpp
index a453eef227..1581512369 100644
--- a/drivers/gl_context/context_gl.cpp
+++ b/drivers/gl_context/context_gl.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "context_gl.h"
-#if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED)
+#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED)
ContextGL *ContextGL::singleton = NULL;
diff --git a/drivers/gl_context/context_gl.h b/drivers/gl_context/context_gl.h
index 399657eb52..3496f2948c 100644
--- a/drivers/gl_context/context_gl.h
+++ b/drivers/gl_context/context_gl.h
@@ -30,7 +30,7 @@
#ifndef CONTEXT_GL_H
#define CONTEXT_GL_H
-#if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED)
+#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED)
#include "typedefs.h"
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 42a253bc2d..308a18aa9d 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -149,13 +149,6 @@ void RasterizerCanvasGLES3::canvas_begin() {
storage->frame.clear_request = false;
}
- /*canvas_shader.unbind();
- canvas_shader.set_custom_shader(0);
- canvas_shader.set_conditional(CanvasShaderGLES2::USE_MODULATE,false);
- canvas_shader.bind();
- canvas_shader.set_uniform(CanvasShaderGLES2::TEXTURE, 0);
- canvas_use_modulate=false;*/
-
reset_canvas();
state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_TEXTURE_RECT, true);
@@ -911,61 +904,6 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
}
}
-#if 0
-void RasterizerGLES2::_canvas_item_setup_shader_params(ShaderMaterial *material,Shader* shader) {
-
- if (canvas_shader.bind())
- rebind_texpixel_size=true;
-
- if (material->shader_version!=shader->version) {
- //todo optimize uniforms
- material->shader_version=shader->version;
- }
-
- if (shader->has_texscreen && framebuffer.active) {
-
- int x = viewport.x;
- int y = window_size.height-(viewport.height+viewport.y);
-
- canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_SCREEN_MULT,Vector2(float(viewport.width)/framebuffer.width,float(viewport.height)/framebuffer.height));
- canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_SCREEN_CLAMP,Color(float(x)/framebuffer.width,float(y)/framebuffer.height,float(x+viewport.width)/framebuffer.width,float(y+viewport.height)/framebuffer.height));
- canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_TEX,max_texture_units-1);
- glActiveTexture(GL_TEXTURE0+max_texture_units-1);
- glBindTexture(GL_TEXTURE_2D,framebuffer.sample_color);
- if (framebuffer.scale==1 && !canvas_texscreen_used) {
-#ifdef GLEW_ENABLED
- if (current_rt) {
- glReadBuffer(GL_COLOR_ATTACHMENT0);
- } else {
- glReadBuffer(GL_BACK);
- }
-#endif
- if (current_rt) {
- glCopyTexSubImage2D(GL_TEXTURE_2D,0,viewport.x,viewport.y,viewport.x,viewport.y,viewport.width,viewport.height);
- canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_SCREEN_CLAMP,Color(float(x)/framebuffer.width,float(viewport.y)/framebuffer.height,float(x+viewport.width)/framebuffer.width,float(y+viewport.height)/framebuffer.height));
- //window_size.height-(viewport.height+viewport.y)
- } else {
- glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height);
- }
-
- canvas_texscreen_used=true;
- }
-
- glActiveTexture(GL_TEXTURE0);
-
- }
-
- if (shader->has_screen_uv) {
- canvas_shader.set_uniform(CanvasShaderGLES2::SCREEN_UV_MULT,Vector2(1.0/viewport.width,1.0/viewport.height));
- }
-
-
- uses_texpixel_size=shader->uses_texpixel_size;
-
-}
-
-#endif
-
void RasterizerCanvasGLES3::_copy_texscreen(const Rect2 &p_rect) {
glDisable(GL_BLEND);
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index 220a3533b7..ee61481a86 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -141,28 +141,22 @@ void RasterizerGLES3::initialize() {
print_line("Using GLES3 video driver");
}
-#ifdef GLEW_ENABLED
- GLuint res = glewInit();
- ERR_FAIL_COND(res != GLEW_OK);
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line(String("GLES2: Using GLEW ") + (const char *)glewGetString(GLEW_VERSION));
+#ifdef GLAD_ENABLED
+ if (!gladLoadGL()) {
+ ERR_PRINT("Error initializing GLAD");
}
- // Check for GL 2.1 compatibility, if not bail out
- if (!glewIsSupported("GL_VERSION_3_0")) {
- ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 3.0+ / GLES 3.0, sorry :(\n"
+// GLVersion seems to be used for both GL and GL ES, so we need different version checks for them
+#ifdef OPENGL_ENABLED // OpenGL 3.3 Core Profile required
+ if (GLVersion.major < 3 && GLVersion.minor < 3) {
+#else // OpenGL ES 3.0
+ if (GLVersion.major < 3) {
+#endif
+ ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 3.3 / OpenGL ES 3.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.");
- OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 3.0+ / GLES 3.0, sorry :(\n"
+ OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 3.3 / OpenGL ES 3.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 :)
- }
-#endif
-
-#ifdef GLAD_ENABLED
-
- if (!gladLoadGL()) {
- ERR_PRINT("Error initializing GLAD");
+ "Fatal error: Insufficient OpenGL / GLES driver support");
}
#ifdef __APPLE__
@@ -175,21 +169,20 @@ void RasterizerGLES3::initialize() {
}
#endif
-#endif
+#endif // GLAD_ENABLED
- /* glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_ERROR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
+ /* // For debugging
+ glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_ERROR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_PORTABILITY_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_PERFORMANCE_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_OTHER_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
glDebugMessageInsertARB(
-
GL_DEBUG_SOURCE_API_ARB,
GL_DEBUG_TYPE_OTHER_ARB, 1,
GL_DEBUG_SEVERITY_HIGH_ARB,5, "hello");
-
-*/
+ */
const GLubyte *renderer = glGetString(GL_RENDERER);
print_line("OpenGL ES 3.0 Renderer: " + String((const char *)renderer));
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 004c628252..a41d84a2aa 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -4466,6 +4466,7 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type) {
light->type = p_type;
light->param[VS::LIGHT_PARAM_ENERGY] = 1.0;
+ light->param[VS::LIGHT_PARAM_INDIRECT_ENERGY] = 1.0;
light->param[VS::LIGHT_PARAM_SPECULAR] = 0.5;
light->param[VS::LIGHT_PARAM_RANGE] = 1.0;
light->param[VS::LIGHT_PARAM_SPOT_ANGLE] = 45;
diff --git a/drivers/unix/SCsub b/drivers/unix/SCsub
index c560e1289f..ada8255580 100644
--- a/drivers/unix/SCsub
+++ b/drivers/unix/SCsub
@@ -2,16 +2,6 @@
Import('env')
-g_set_p = '#ifdef UNIX_ENABLED\n'
-g_set_p += '#include "os_unix.h"\n'
-g_set_p += 'String OS_Unix::get_global_settings_path() const {\n'
-g_set_p += '\treturn "' + env["unix_global_settings_path"] + '";\n'
-g_set_p += '}\n'
-g_set_p += '#endif'
-f = open("os_unix_global_settings_path.gen.cpp", "w")
-f.write(g_set_p)
-f.close()
-
env.add_source_files(env.drivers_sources, "*.cpp")
env["check_c_headers"] = [ [ "mntent.h", "HAVE_MNTENT" ] ]
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 729abd57ef..ce0967af2c 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -454,32 +454,21 @@ int OS_Unix::get_processor_count() const {
return sysconf(_SC_NPROCESSORS_CONF);
}
-String OS_Unix::get_data_dir() const {
+String OS_Unix::get_user_data_dir() const {
- String an = get_safe_application_name();
- if (an != "") {
-
- if (has_environment("HOME")) {
-
- bool use_godot = ProjectSettings::get_singleton()->get("application/config/use_shared_user_dir");
- if (use_godot)
- return get_environment("HOME") + "/.godot/app_userdata/" + an;
- else
- return get_environment("HOME") + "/." + an;
+ String appname = get_safe_application_name();
+ if (appname != "") {
+ bool use_godot_dir = ProjectSettings::get_singleton()->get("application/config/use_shared_user_dir");
+ if (use_godot_dir) {
+ return get_data_path().plus_file(get_godot_dir_name()).plus_file("app_userdata").plus_file(appname);
+ } else {
+ return get_data_path().plus_file(appname);
}
}
return ProjectSettings::get_singleton()->get_resource_path();
}
-String OS_Unix::get_installed_templates_path() const {
- String p = get_global_settings_path();
- if (p != "")
- return p + "/templates/";
- else
- return "";
-}
-
String OS_Unix::get_executable_path() const {
#ifdef __linux__
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index 82c7dee3b9..432f48408f 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -62,8 +62,6 @@ protected:
String stdin_buf;
- String get_global_settings_path() const;
-
public:
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
virtual String get_stdin_string(bool p_block);
@@ -108,11 +106,8 @@ public:
virtual void debug_break();
- virtual String get_installed_templates_path() const;
virtual String get_executable_path() const;
- virtual String get_data_dir() const;
-
- //virtual void run( MainLoop * p_main_loop );
+ virtual String get_user_data_dir() const;
};
class UnixTerminalLogger : public StdLogger {