From c502847802b1251ab095e31282a55ad6658594c2 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 31 Aug 2014 00:51:54 -0300 Subject: [PATCH 1/2] Enable strict mode for shaders on some nvidia drivers. Should hopefully prevent some issues where nvidia GLSL compilers let things slide that should be illegal. --- src/scripts/graphics.lua | 3 ++- src/scripts/graphics.lua.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/scripts/graphics.lua b/src/scripts/graphics.lua index e9e3659eb..7d83c5184 100644 --- a/src/scripts/graphics.lua +++ b/src/scripts/graphics.lua @@ -1295,7 +1295,8 @@ do #define number float #define Image sampler2D #define extern uniform -#define Texel texture2D]] +#define Texel texture2D +#pragma optionNV(strict on)]] local GLSL_UNIFORMS = [[ #define TransformMatrix gl_ModelViewMatrix diff --git a/src/scripts/graphics.lua.h b/src/scripts/graphics.lua.h index 8842ecaf4..d2218faaa 100644 --- a/src/scripts/graphics.lua.h +++ b/src/scripts/graphics.lua.h @@ -6276,7 +6276,9 @@ const unsigned char graphics_lua[] = 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x20, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x20, 0x74, 0x65, 0x78, 0x74, - 0x75, 0x72, 0x65, 0x32, 0x44, 0x5d, 0x5d, 0x0a, + 0x75, 0x72, 0x65, 0x32, 0x44, 0x0a, + 0x23, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x56, 0x28, 0x73, + 0x74, 0x72, 0x69, 0x63, 0x74, 0x20, 0x6f, 0x6e, 0x29, 0x5d, 0x5d, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x47, 0x4c, 0x53, 0x4c, 0x5f, 0x55, 0x4e, 0x49, 0x46, 0x4f, 0x52, 0x4d, 0x53, 0x20, 0x3d, 0x20, 0x5b, 0x5b, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x4d, From 77bec45b4a60e6da4476c9ca1b1632b14910fef9 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 31 Aug 2014 01:15:58 -0300 Subject: [PATCH 2/2] Fixed SpriteBatch:setBufferSize. --- src/modules/graphics/opengl/SpriteBatch.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/SpriteBatch.cpp b/src/modules/graphics/opengl/SpriteBatch.cpp index 363b91fa3..08fcf7e04 100644 --- a/src/modules/graphics/opengl/SpriteBatch.cpp +++ b/src/modules/graphics/opengl/SpriteBatch.cpp @@ -233,7 +233,10 @@ void SpriteBatch::setBufferSize(int newsize) } // Copy as much of the old data into the new VertexBuffer as can fit. - new_array_buf->fill(0, sizeof(Vertex) * 4 * std::min(newsize, size), old_data); + { + VertexBuffer::Bind bind(*new_array_buf); + new_array_buf->fill(0, sizeof(Vertex) * 4 * std::min(newsize, size), old_data); + } // We don't need to unmap the old VertexBuffer since we're deleting it. delete array_buf;