Ver Fonte

Godot works on Windows again..

reduz há 8 anos atrás
pai
commit
72b844c349

+ 4 - 4
drivers/gles3/rasterizer_canvas_gles3.cpp

@@ -1257,16 +1257,16 @@ void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, cons
 		CameraMatrix projection;
 		{
 			real_t fov =  90;
-			real_t near = p_near;
-			real_t far = p_far;
+			real_t nearp = p_near;
+			real_t farp = p_far;
 			real_t aspect = 1.0;
 
-			real_t ymax = near * Math::tan( Math::deg2rad( fov * 0.5 ) );
+			real_t ymax = nearp * Math::tan( Math::deg2rad( fov * 0.5 ) );
 			real_t ymin = - ymax;
 			real_t xmin = ymin * aspect;
 			real_t xmax = ymax * aspect;
 
-			projection.set_frustum( xmin, xmax, ymin, ymax, near, far );
+			projection.set_frustum( xmin, xmax, ymin, ymax, nearp, farp );
 		}
 
 		Vector3 cam_target=Matrix3(Vector3(0,0,Math_PI*2*(i/4.0))).xform(Vector3(0,1,0));

+ 1 - 1
drivers/gles3/rasterizer_gles3.cpp

@@ -131,7 +131,7 @@ void RasterizerGLES3::initialize() {
 	}
 
 	glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
-	glDebugMessageCallbackARB(_gl_debug_print, NULL);
+//	glDebugMessageCallbackARB(_gl_debug_print, NULL);
 	glEnable(_EXT_DEBUG_OUTPUT);
 
 #endif

+ 2 - 2
drivers/gles3/rasterizer_scene_gles3.cpp

@@ -996,7 +996,7 @@ void RasterizerSceneGLES3::light_instance_set_shadow_transform(RID p_light_insta
 
 	light_instance->shadow_transform[p_pass].camera=p_projection;
 	light_instance->shadow_transform[p_pass].transform=p_transform;
-	light_instance->shadow_transform[p_pass].far=p_far;
+	light_instance->shadow_transform[p_pass].farplane=p_far;
 	light_instance->shadow_transform[p_pass].split=p_split;
 
 }
@@ -4443,7 +4443,7 @@ static _FORCE_INLINE_ Vector3 ImportanceSampleGGX(Vector2 Xi, float Roughness, V
       float a = Roughness * Roughness; // DISNEY'S ROUGHNESS [see Burley'12 siggraph]
 
       // Compute distribution direction
-      float Phi = 2.0f * M_PI * Xi.x;
+      float Phi = 2.0f * Math_PI * Xi.x;
       float CosTheta = Math::sqrt((1.0f - Xi.y) / (1.0f + (a*a - 1.0f) * Xi.y));
       float SinTheta = Math::sqrt((float)Math::abs(1.0f - CosTheta * CosTheta));
 

+ 1 - 1
drivers/gles3/rasterizer_scene_gles3.h

@@ -482,7 +482,7 @@ public:
 
 			CameraMatrix camera;
 			Transform transform;
-			float far;
+			float farplane;
 			float split;
 		};
 

+ 1 - 1
drivers/gles3/rasterizer_storage_gles3.cpp

@@ -133,7 +133,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima
 
 		} break;
 		case Image::FORMAT_RGB565: {
-#warning TODO: Convert tod 555 if 565 is not supported (GLES3.3-)
+//#warning TODO: Convert tod 555 if 565 is not supported (GLES3.3-)
 			r_gl_internal_format=GL_RGB5;
 			//r_gl_internal_format=GL_RGB565;
 			r_gl_format=GL_RGB;

+ 5 - 5
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");

+ 2 - 2
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"):

+ 16 - 11
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);

+ 1 - 1
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;

+ 2 - 2
platform/windows/platform_config.h

@@ -30,7 +30,7 @@
 //#else
 //#include <alloca.h>
 //#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"
 
 

+ 1 - 1
servers/visual/visual_server_scene.h

@@ -9,7 +9,7 @@
 #include "self_list.h"
 #include "os/thread.h"
 #include "os/semaphore.h"
-#include "semaphore.h"
+#include "os/semaphore.h"
 
 class VisualServerScene {
 public: