From 22d83bc9f655d5ae7a1b49709c4c1b663725daf5 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 3 Oct 2016 16:33:42 -0300 Subject: Begining of GLES3 renderer: -Most 2D drawing is implemented -Missing shaders -Missing all 3D -Editor needs to be set on update always to be used, otherwise it does not refresh -Large parts of editor not working --- platform/windows/os_windows.cpp | 4 ++-- platform/windows/platform_config.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'platform/windows') diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 35d90a8308..1af7cb2a49 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2081,8 +2081,8 @@ void OS_Windows::set_icon(const Image& p_icon) { Image icon=p_icon; - if (icon.get_format()!=Image::FORMAT_RGBA) - icon.convert(Image::FORMAT_RGBA); + if (icon.get_format()!=Image::FORMAT_RGBA8) + icon.convert(Image::FORMAT_RGBA8); int w = icon.get_width(); int h = icon.get_height(); diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h index 9e20750816..296a778ac8 100644 --- a/platform/windows/platform_config.h +++ b/platform/windows/platform_config.h @@ -31,5 +31,6 @@ //#include //#endif #define GLES2_INCLUDE_H "gl_context/GL/glew.h" +#define GLES3_INCLUDE_H "gl_context/GL/glew.h" -- cgit v1.2.3 From 1527cf8c0d17891dd0ebf99d484f83daa46eba3c Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 10 Oct 2016 18:31:01 -0300 Subject: 2D Shaders are working again using the new syntax, though all is buggy in general --- platform/windows/os_windows.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'platform/windows') diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 1af7cb2a49..92359892a8 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1727,6 +1727,10 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l print("SCRIPT ERROR: %s: %s\n", p_function, err_details); print(" At: %s:%i\n", p_file, p_line); break; + case ERR_SHADER: + print("SHADER ERROR: %s: %s\n", p_function, err_details); + print(" At: %s:%i\n", p_file, p_line); + break; } } else { @@ -1742,6 +1746,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: basecol = FOREGROUND_RED; break; case ERR_WARNING: basecol = FOREGROUND_RED | FOREGROUND_GREEN; break; case ERR_SCRIPT: basecol = FOREGROUND_RED | FOREGROUND_BLUE; break; + case ERR_SHADER: basecol = FOREGROUND_GREEN | FOREGROUND_BLUE; break; } basecol |= current_bg; @@ -1753,6 +1758,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: print("ERROR: "); break; case ERR_WARNING: print("WARNING: "); break; case ERR_SCRIPT: print("SCRIPT ERROR: "); break; + case ERR_SCRIPT: print("SHADER ERROR: "); break; } SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY); @@ -1763,6 +1769,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: print(" At: "); break; case ERR_WARNING: print(" At: "); break; case ERR_SCRIPT: print(" At: "); break; + case ERR_SHADER: print(" At: "); break; } SetConsoleTextAttribute(hCon, current_fg | current_bg); @@ -1775,6 +1782,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: print("ERROR: %s: ", p_function); break; case ERR_WARNING: print("WARNING: %s: ", p_function); break; case ERR_SCRIPT: print("SCRIPT ERROR: %s: ", p_function); break; + case ERR_SHADER: print("SCRIPT ERROR: %s: ", p_function); break; } SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY); @@ -1785,6 +1793,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: print(" At: "); break; case ERR_WARNING: print(" At: "); break; case ERR_SCRIPT: print(" At: "); break; + case ERR_SHADER: print(" At: "); break; } SetConsoleTextAttribute(hCon, current_fg | current_bg); -- cgit v1.2.3 From 72b844c34999d8615450798ed1f27ef24a72d8ce Mon Sep 17 00:00:00 2001 From: reduz Date: Wed, 21 Dec 2016 02:29:58 -0300 Subject: Godot works on Windows again.. --- platform/windows/context_gl_win.cpp | 10 +++++----- platform/windows/detect.py | 4 ++-- platform/windows/os_windows.cpp | 27 ++++++++++++++++----------- platform/windows/os_windows.h | 2 +- platform/windows/platform_config.h | 4 ++-- 5 files changed, 26 insertions(+), 21 deletions(-) (limited to 'platform/windows') diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index fd9e895370..57950d33ca 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -162,8 +162,8 @@ Error ContextGL_Win::initialize() { if (opengl_3_context) { int attribs[] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, 3,//we want a 3.1 context - WGL_CONTEXT_MINOR_VERSION_ARB, 2, + WGL_CONTEXT_MAJOR_VERSION_ARB, 3,//we want a 3.3 context + WGL_CONTEXT_MINOR_VERSION_ARB, 3, //and it shall be forward compatible so that we can only use up to date functionality WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, 0}; //zero indicates the end of the array @@ -182,7 +182,7 @@ Error ContextGL_Win::initialize() { if (!(new_hRC=wglCreateContextAttribsARB(hDC,0, attribs))) { wglDeleteContext(hRC); - MessageBox(NULL,"Can't Create An OpenGL 3.1 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL,"Can't Create An OpenGL 3.3 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return ERR_CANT_CREATE; // Return false } wglMakeCurrent(hDC,NULL); @@ -191,11 +191,11 @@ Error ContextGL_Win::initialize() { if (!wglMakeCurrent(hDC,hRC)) // Try To Activate The Rendering Context { - MessageBox(NULL,"Can't Activate The GL 3.1 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL,"Can't Activate The GL 3.3 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return ERR_CANT_CREATE; // Return FALSE } - printf("Activated GL 3.1 context"); + printf("Activated GL 3.3 context"); } wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress ("wglSwapIntervalEXT"); diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 12ea5a93ee..286e6cb78c 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -244,7 +244,7 @@ def configure(env): env.Append(CCFLAGS=['/DWIN32']) env.Append(CCFLAGS=['/DTYPED_METHOD_BIND']) - env.Append(CCFLAGS=['/DGLES2_ENABLED']) + env.Append(CCFLAGS=['/DOPENGL_ENABLED']) LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32','Ws2_32', 'shell32','advapi32','dinput8','dxguid'] env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS]) @@ -372,7 +372,7 @@ def configure(env): env.Append(CCFLAGS=['-DWINDOWS_ENABLED','-mwindows']) env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED']) - env.Append(CCFLAGS=['-DGLES2_ENABLED']) + env.Append(CCFLAGS=['-DOPENGL_ENABLED']) env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','shlwapi','wsock32','ws2_32','kernel32', 'oleaut32', 'dinput8', 'dxguid']) # if (env["bits"]=="32"): diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 92359892a8..7321f5d1b1 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -26,9 +26,11 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "drivers/gles2/rasterizer_gles2.h" + #include "os_windows.h" +#include "drivers/gles3/rasterizer_gles3.h" + #include "drivers/nedmalloc/memory_pool_static_nedmalloc.h" #include "drivers/unix/memory_pool_static_malloc.h" #include "os/memory_pool_dynamic_static.h" @@ -42,7 +44,7 @@ #include "servers/visual/visual_server_raster.h" #include "servers/audio/audio_server_sw.h" -#include "servers/visual/visual_server_wrap_mt.h" +//#include "servers/visual/visual_server_wrap_mt.h" #include "tcp_server_winsock.h" #include "packet_peer_udp_winsock.h" @@ -1079,21 +1081,24 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ }; -#if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED) || defined(LEGACYGL_ENABLED) - gl_context = memnew( ContextGL_Win(hWnd,false) ); +#if defined(OPENGL_ENABLED) + gl_context = memnew( ContextGL_Win(hWnd,true) ); gl_context->initialize(); - rasterizer = memnew( RasterizerGLES2 ); + + RasterizerGLES3::register_config(); + + RasterizerGLES3::make_current(); #else #ifdef DX9_ENABLED rasterizer = memnew( RasterizerDX9(hWnd) ); #endif #endif - visual_server = memnew( VisualServerRaster(rasterizer) ); - if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { - - visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); - } + visual_server = memnew( VisualServerRaster ); + //if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { +// +// visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); +// } // physics_server = memnew( PhysicsServerSW ); @@ -1758,7 +1763,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: print("ERROR: "); break; case ERR_WARNING: print("WARNING: "); break; case ERR_SCRIPT: print("SCRIPT ERROR: "); break; - case ERR_SCRIPT: print("SHADER ERROR: "); break; + case ERR_SHADER: print("SHADER ERROR: "); break; } SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY); diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 70ef694957..bbacdb1a91 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -92,7 +92,7 @@ class OS_Windows : public OS { int old_x,old_y; Point2i center; unsigned int last_id; -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) || defined(GLES2_ENABLED) +#if defined(OPENGL_ENABLED) ContextGL_Win *gl_context; #endif VisualServer *visual_server; diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h index 296a778ac8..fbcf0f74d2 100644 --- a/platform/windows/platform_config.h +++ b/platform/windows/platform_config.h @@ -30,7 +30,7 @@ //#else //#include //#endif -#define GLES2_INCLUDE_H "gl_context/GL/glew.h" -#define GLES3_INCLUDE_H "gl_context/GL/glew.h" +//#define GLES2_INCLUDE_H "gl_context/GL/glew.h" +#define GLES3_INCLUDE_H "gl_context/glad/glad.h" -- cgit v1.2.3 From 0d4abf2aa3a336a8a04c83f0576c6b42783ba6e9 Mon Sep 17 00:00:00 2001 From: reduz Date: Sat, 24 Dec 2016 16:23:30 -0300 Subject: fixed a horrible bug on Windows AMD, scenes saved until now in this branch are no longer valid :( --- platform/windows/context_gl_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'platform/windows') diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index 57950d33ca..fc6e33f408 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -165,7 +165,7 @@ Error ContextGL_Win::initialize() { WGL_CONTEXT_MAJOR_VERSION_ARB, 3,//we want a 3.3 context WGL_CONTEXT_MINOR_VERSION_ARB, 3, //and it shall be forward compatible so that we can only use up to date functionality - WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, + WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB/*|WGL_CONTEXT_DEBUG_BIT_ARB*/, 0}; //zero indicates the end of the array PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; //pointer to the method -- cgit v1.2.3 From 289bc881aaec35cc127256137abc7dcf116afd48 Mon Sep 17 00:00:00 2001 From: reduz Date: Sun, 25 Dec 2016 08:05:23 -0300 Subject: now it really works on window for real --- platform/windows/context_gl_win.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'platform/windows') diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index fc6e33f408..0ca4a67d19 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -110,6 +110,7 @@ bool ContextGL_Win::is_using_vsync() const { return use_vsync; } +#define _WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 Error ContextGL_Win::initialize() { @@ -165,7 +166,7 @@ Error ContextGL_Win::initialize() { WGL_CONTEXT_MAJOR_VERSION_ARB, 3,//we want a 3.3 context WGL_CONTEXT_MINOR_VERSION_ARB, 3, //and it shall be forward compatible so that we can only use up to date functionality - WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB/*|WGL_CONTEXT_DEBUG_BIT_ARB*/, + WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB|_WGL_CONTEXT_DEBUG_BIT_ARB, 0}; //zero indicates the end of the array PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; //pointer to the method -- cgit v1.2.3