From b444cabe4d7fe3a3163b22c0eeeeb034922fc1d0 Mon Sep 17 00:00:00 2001 From: Anis Date: Sat, 6 Dec 2014 19:32:38 +0100 Subject: [PATCH 01/12] vSync on opengl --- Engine/source/gfx/gl/gfxGLDevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/gfx/gl/gfxGLDevice.cpp b/Engine/source/gfx/gl/gfxGLDevice.cpp index 2e22530ed..cdc9ab003 100644 --- a/Engine/source/gfx/gl/gfxGLDevice.cpp +++ b/Engine/source/gfx/gl/gfxGLDevice.cpp @@ -147,7 +147,7 @@ void GFXGLDevice::initGLState() } #endif - PlatformGL::setVSync(0); + PlatformGL::setVSync(smDisableVSync ? 0 : 2); //OpenGL 3 need a binded VAO for render GLuint vao; From 005f322a94c4879729f0f33e3be887e7b41011ad Mon Sep 17 00:00:00 2001 From: Anis Date: Sat, 6 Dec 2014 19:41:00 +0100 Subject: [PATCH 02/12] vsync update on reset settings --- Engine/source/gfx/gl/gfxGLWindowTarget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Engine/source/gfx/gl/gfxGLWindowTarget.cpp b/Engine/source/gfx/gl/gfxGLWindowTarget.cpp index c02ff1bc3..b92f695a7 100644 --- a/Engine/source/gfx/gl/gfxGLWindowTarget.cpp +++ b/Engine/source/gfx/gl/gfxGLWindowTarget.cpp @@ -44,6 +44,8 @@ GFXGLWindowTarget::GFXGLWindowTarget(PlatformWindow *win, GFXDevice *d) void GFXGLWindowTarget::resetMode() { + PlatformGL::setVSync(GFXDevice::smDisableVSync ? 0 : 2); + if(mWindow->getVideoMode().fullScreen != mWindow->isFullscreen()) { _teardownCurrentMode(); From 2165266ff469525d9576e564dd052db31864eb27 Mon Sep 17 00:00:00 2001 From: Anis Date: Sat, 6 Dec 2014 20:44:47 +0100 Subject: [PATCH 03/12] revert vsync on reset changes --- Engine/source/gfx/gl/gfxGLWindowTarget.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Engine/source/gfx/gl/gfxGLWindowTarget.cpp b/Engine/source/gfx/gl/gfxGLWindowTarget.cpp index b92f695a7..c02ff1bc3 100644 --- a/Engine/source/gfx/gl/gfxGLWindowTarget.cpp +++ b/Engine/source/gfx/gl/gfxGLWindowTarget.cpp @@ -44,8 +44,6 @@ GFXGLWindowTarget::GFXGLWindowTarget(PlatformWindow *win, GFXDevice *d) void GFXGLWindowTarget::resetMode() { - PlatformGL::setVSync(GFXDevice::smDisableVSync ? 0 : 2); - if(mWindow->getVideoMode().fullScreen != mWindow->isFullscreen()) { _teardownCurrentMode(); From 1a76341049af898a5017c092769129db1c5cb703 Mon Sep 17 00:00:00 2001 From: Anis Date: Sat, 6 Dec 2014 20:46:27 +0100 Subject: [PATCH 04/12] Update gfxGLDevice.cpp --- Engine/source/gfx/gl/gfxGLDevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/gfx/gl/gfxGLDevice.cpp b/Engine/source/gfx/gl/gfxGLDevice.cpp index cdc9ab003..0132a4a9f 100644 --- a/Engine/source/gfx/gl/gfxGLDevice.cpp +++ b/Engine/source/gfx/gl/gfxGLDevice.cpp @@ -147,7 +147,7 @@ void GFXGLDevice::initGLState() } #endif - PlatformGL::setVSync(smDisableVSync ? 0 : 2); + PlatformGL::setVSync(smDisableVSync ? 0 : 1); //OpenGL 3 need a binded VAO for render GLuint vao; From 7455f123438b40d02ea38636d1ac1e76d25b7116 Mon Sep 17 00:00:00 2001 From: Anis Date: Sat, 6 Dec 2014 20:55:43 +0100 Subject: [PATCH 05/12] check extension before use it --- Engine/source/platformWin32/WinPlatformGL.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Engine/source/platformWin32/WinPlatformGL.cpp b/Engine/source/platformWin32/WinPlatformGL.cpp index 5413d37b7..a85245ef1 100644 --- a/Engine/source/platformWin32/WinPlatformGL.cpp +++ b/Engine/source/platformWin32/WinPlatformGL.cpp @@ -5,7 +5,10 @@ void PlatformGL::setVSync(const int i) { - wglSwapIntervalEXT( i ); + if (WGLEW_EXT_swap_control) + { + wglSwapIntervalEXT(i); + } } -#endif \ No newline at end of file +#endif From f1d382fcfffd82d15ff1185664ddb16831e96953 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Sat, 27 Dec 2014 11:34:08 -0600 Subject: [PATCH 06/12] cubemap Mip retrieval-DX similar to opengl, if the textures comprising a cubemap contain mips, it retrieves them, otherwise it generates them. --- Engine/source/gfx/D3D9/gfxD3D9Cubemap.cpp | 54 ++++++++++++++--------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/Engine/source/gfx/D3D9/gfxD3D9Cubemap.cpp b/Engine/source/gfx/D3D9/gfxD3D9Cubemap.cpp index ff46a3d22..d7161ad9b 100644 --- a/Engine/source/gfx/D3D9/gfxD3D9Cubemap.cpp +++ b/Engine/source/gfx/D3D9/gfxD3D9Cubemap.cpp @@ -101,11 +101,20 @@ void GFXD3D9Cubemap::initStatic( GFXTexHandle *faces ) mTexSize = faces[0].getWidth(); mFaceFormat = faces[0].getFormat(); - D3D9Assert( D3D9Device->CreateCubeTexture( mTexSize, 1, 0, GFXD3D9TextureFormat[mFaceFormat], + U32 levels = faces->getPointer()->getMipLevels(); + if (levels >1) + { + D3D9Assert(D3D9Device->CreateCubeTexture(mTexSize, levels, 0, GFXD3D9TextureFormat[mFaceFormat], + pool, &mCubeTex, NULL), NULL); + fillCubeTextures(faces, D3D9Device); + } + else + { + D3D9Assert( D3D9Device->CreateCubeTexture( mTexSize, 0, D3DUSAGE_AUTOGENMIPMAP, GFXD3D9TextureFormat[mFaceFormat], pool, &mCubeTex, NULL ), NULL ); - - fillCubeTextures( faces, D3D9Device ); -// mCubeTex->GenerateMipSubLevels(); + fillCubeTextures( faces, D3D9Device ); + mCubeTex->GenerateMipSubLevels(); + } } } @@ -195,24 +204,29 @@ void GFXD3D9Cubemap::initDynamic( U32 texSize, GFXFormat faceFormat ) //----------------------------------------------------------------------------- // Fills in face textures of cube map from existing textures //----------------------------------------------------------------------------- -void GFXD3D9Cubemap::fillCubeTextures( GFXTexHandle *faces, LPDIRECT3DDEVICE9 D3DDevice ) +void GFXD3D9Cubemap::fillCubeTextures( GFXTexHandle *faces, LPDIRECT3DDEVICE9 D3DDevice) { - for( U32 i=0; i<6; i++ ) - { - // get cube face surface - IDirect3DSurface9 *cubeSurf = NULL; - D3D9Assert( mCubeTex->GetCubeMapSurface( faceList[i], 0, &cubeSurf ), NULL ); - // get incoming texture surface - GFXD3D9TextureObject *texObj = dynamic_cast( (GFXTextureObject*)faces[i] ); - IDirect3DSurface9 *inSurf; - D3D9Assert( texObj->get2DTex()->GetSurfaceLevel( 0, &inSurf ), NULL ); - - // copy incoming texture into cube face - D3D9Assert( GFXD3DX.D3DXLoadSurfaceFromSurface( cubeSurf, NULL, NULL, inSurf, NULL, - NULL, D3DX_FILTER_NONE, 0 ), NULL ); - cubeSurf->Release(); - inSurf->Release(); + U32 levels = faces->getPointer()->getMipLevels(); + for (U32 mip = 0; mip < levels; mip++) + { + for (U32 i = 0; i < 6; i++) + { + // get cube face surface + IDirect3DSurface9 *cubeSurf = NULL; + D3D9Assert(mCubeTex->GetCubeMapSurface(faceList[i], mip, &cubeSurf), NULL); + + // get incoming texture surface + GFXD3D9TextureObject *texObj = dynamic_cast((GFXTextureObject*)faces[i]); + IDirect3DSurface9 *inSurf; + D3D9Assert(texObj->get2DTex()->GetSurfaceLevel(mip, &inSurf), NULL); + + // copy incoming texture into cube face + D3D9Assert(GFXD3DX.D3DXLoadSurfaceFromSurface(cubeSurf, NULL, NULL, inSurf, NULL, + NULL, D3DX_FILTER_NONE, 0), NULL); + cubeSurf->Release(); + inSurf->Release(); + } } } From ee4f0df69a922bb4a98cf4cfe03c2b22345fc781 Mon Sep 17 00:00:00 2001 From: Anis Date: Mon, 19 Jan 2015 17:44:48 +0100 Subject: [PATCH 07/12] Update gfxGLDevice.win.cpp --- Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp b/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp index f2f81b8fa..6d4d09d0b 100644 --- a/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp +++ b/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp @@ -297,8 +297,6 @@ void GFXGLDevice::init( const GFXVideoMode &mode, PlatformWindow *window ) loadGLCore(); loadGLExtensions(hdcGL); - - wglSwapIntervalEXT(0); // It is very important that extensions be loaded // before we call initGLState() From 1631f76a47b691b89defa01f5a831ba3f5290f98 Mon Sep 17 00:00:00 2001 From: Adam Beer Date: Sun, 15 Feb 2015 13:18:12 -0500 Subject: [PATCH 08/12] Update winStackWalker.h --- Engine/source/platformWin32/minidump/winStackWalker.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Engine/source/platformWin32/minidump/winStackWalker.h b/Engine/source/platformWin32/minidump/winStackWalker.h index a7341ace1..5a628333f 100644 --- a/Engine/source/platformWin32/minidump/winStackWalker.h +++ b/Engine/source/platformWin32/minidump/winStackWalker.h @@ -28,6 +28,8 @@ #include #include +#include "platform/types.h" + class StackWalker { public: @@ -99,4 +101,4 @@ private: void dGetStackTrace(char * traceBuffer, CONTEXT const & ContextRecord); #endif -#endif \ No newline at end of file +#endif From 8d66817e36b03d140900716a3ea16d0b4bef8c16 Mon Sep 17 00:00:00 2001 From: Adam Beer Date: Sun, 15 Feb 2015 13:28:12 -0500 Subject: [PATCH 09/12] Update vc2010_lib_proj.tpl --- Tools/projectGenerator/templates/vc2010_lib_proj.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/projectGenerator/templates/vc2010_lib_proj.tpl b/Tools/projectGenerator/templates/vc2010_lib_proj.tpl index 1b19d1136..b469fc5de 100644 --- a/Tools/projectGenerator/templates/vc2010_lib_proj.tpl +++ b/Tools/projectGenerator/templates/vc2010_lib_proj.tpl @@ -135,7 +135,7 @@ Full AnySuitable {foreach item=def from=$projIncludes}{$def};{/foreach}%(AdditionalIncludeDirectories) - {foreach item=def from=$projDefines}{$def};{/foreach}UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + {foreach item=def from=$projDefines}{$def};{/foreach}UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;TORQUE_RELEASE;%(PreprocessorDefinitions) Default From 86b8b39978adf8464c8208bdf532d013cea753e2 Mon Sep 17 00:00:00 2001 From: Adam Beer Date: Sun, 15 Feb 2015 13:29:59 -0500 Subject: [PATCH 10/12] Update vc2k8_lib_proj.tpl --- Tools/projectGenerator/templates/vc2k8_lib_proj.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tools/projectGenerator/templates/vc2k8_lib_proj.tpl b/Tools/projectGenerator/templates/vc2k8_lib_proj.tpl index 8036d5524..dbd330771 100644 --- a/Tools/projectGenerator/templates/vc2k8_lib_proj.tpl +++ b/Tools/projectGenerator/templates/vc2k8_lib_proj.tpl @@ -206,7 +206,7 @@ Optimization="3" InlineFunctionExpansion="2" AdditionalIncludeDirectories="{foreach item=def from=$projIncludes}{$def};{/foreach}" - PreprocessorDefinitions="{foreach item=def from=$projDefines}{$def};{/foreach}UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS" + PreprocessorDefinitions="{foreach item=def from=$projDefines}{$def};{/foreach}UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;TORQUE_RELEASE" ExceptionHandling="0" BasicRuntimeChecks="0" StringPooling="true" @@ -269,4 +269,4 @@ - \ No newline at end of file + From da706ccb61b57f4e909ef09b894ca052e32ea9f0 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Sun, 15 Feb 2015 15:19:20 -0600 Subject: [PATCH 11/12] proper fix for https://github.com/GarageGames/Torque3D/issues/1197 courtesy @LuisAntonRebollo --- Engine/source/math/test/mMatrixTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/math/test/mMatrixTest.cpp b/Engine/source/math/test/mMatrixTest.cpp index 2efa04ffd..beb0b1d13 100644 --- a/Engine/source/math/test/mMatrixTest.cpp +++ b/Engine/source/math/test/mMatrixTest.cpp @@ -31,8 +31,8 @@ extern void mInstallLibrary_ASM(); // If we're x86 and not Mac, then include these. There's probably a better way to do this. #if defined(WIN32) && defined(TORQUE_CPU_X86) -extern "C" void Athlon_MatrixF_x_MatrixF(const F32 *matA, const F32 *matB, F32 *result); -extern "C" void SSE_MatrixF_x_MatrixF(const F32 *matA, const F32 *matB, F32 *result); +void Athlon_MatrixF_x_MatrixF(const F32 *matA, const F32 *matB, F32 *result); +void SSE_MatrixF_x_MatrixF(const F32 *matA, const F32 *matB, F32 *result); #endif #if defined( __VEC__ ) From 3ad04d050cacfe6c6daa6ee1f0f9a8f98b5883cf Mon Sep 17 00:00:00 2001 From: LuisAntonRebollo Date: Sun, 15 Feb 2015 22:26:05 +0100 Subject: [PATCH 12/12] Fix shadows on Basic Lighting. --- Templates/Empty/game/shaders/common/gl/projectedShadowV.glsl | 2 +- Templates/Full/game/shaders/common/gl/projectedShadowV.glsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/Empty/game/shaders/common/gl/projectedShadowV.glsl b/Templates/Empty/game/shaders/common/gl/projectedShadowV.glsl index b5de84181..c8b6d2a92 100644 --- a/Templates/Empty/game/shaders/common/gl/projectedShadowV.glsl +++ b/Templates/Empty/game/shaders/common/gl/projectedShadowV.glsl @@ -40,7 +40,7 @@ void main() gl_Position = modelview * vec4(vPosition.xyz, 1.0); color = vColor; - texCoord = vTexCoord1.st; + texCoord = vTexCoord0.st; float fromCasterDist = length(vPosition.xyz - shadowCasterPosition) - shadowLength; fade = 1.0 - clamp( fromCasterDist / shadowLength , 0.0, 1.0 ); diff --git a/Templates/Full/game/shaders/common/gl/projectedShadowV.glsl b/Templates/Full/game/shaders/common/gl/projectedShadowV.glsl index b5de84181..c8b6d2a92 100644 --- a/Templates/Full/game/shaders/common/gl/projectedShadowV.glsl +++ b/Templates/Full/game/shaders/common/gl/projectedShadowV.glsl @@ -40,7 +40,7 @@ void main() gl_Position = modelview * vec4(vPosition.xyz, 1.0); color = vColor; - texCoord = vTexCoord1.st; + texCoord = vTexCoord0.st; float fromCasterDist = length(vPosition.xyz - shadowCasterPosition) - shadowLength; fade = 1.0 - clamp( fromCasterDist / shadowLength , 0.0, 1.0 );