Skip to content

Commit 81490a7

Browse files
committed
Fix gl.ClearAttachmentFBO() doc and expose Platform.glVersionNum to Lua
1 parent ef1aeac commit 81490a7

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

rts/Lua/LuaConstPlatform.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ bool LuaConstPlatform::PushEntries(lua_State* L)
4949
LuaPushNamedString(L, "gpuVendor", globalRenderingInfo.gpuVendor);
5050
LuaPushNamedNumber(L, "gpuMemorySize", globalRenderingInfo.gpuMemorySize.x);
5151
LuaPushNamedString(L, "glVersionShort", globalRenderingInfo.glVersionShort.data());
52+
LuaPushNamedNumber(L, "glVersionNum", globalRenderingInfo.glVersionNum);
5253
LuaPushNamedString(L, "glslVersionShort", globalRenderingInfo.glslVersionShort.data());
5354
LuaPushNamedNumber(L, "glslVersionNum", globalRenderingInfo.glslVersionNum);
5455

rts/Lua/LuaFBOs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ namespace Impl {
784784
}
785785
}
786786

787-
/*** needs `Platform.glslVersionNum >= 300`
787+
/*** needs `Platform.glVersionNum >= 30`
788788
* Clears the "attachment" of the currently bound FBO type "target" with "clearValues"
789789
*
790790
* @function gl.ClearAttachmentFBO

rts/Rendering/GlobalRendering.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,9 @@ void CGlobalRendering::SetGLSupportFlags()
824824
break;
825825
}
826826
}
827+
if (int2 glVerNum = { 0, 0 }; sscanf(globalRenderingInfo.glVersionShort.data(), "%d.%d", &glVerNum.x, &glVerNum.y) == 2) {
828+
globalRenderingInfo.glslVersionNum = glVerNum.x * 10 + glVerNum.y;
829+
}
827830

828831
for (size_t n = 0; (n < sizeof(globalRenderingInfo.glslVersionShort) && globalRenderingInfo.glslVersion[n] != 0); n++) {
829832
if ((globalRenderingInfo.glslVersionShort[n] = globalRenderingInfo.glslVersion[n]) == ' ') {

rts/Rendering/GlobalRenderingInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct GlobalRenderingInfo {
3232
std::array<char, 256> glVersionShort = { 0 };
3333
std::array<char, 256> glslVersionShort = { 0 };
3434

35+
int glVersionNum = 0;
3536
int glslVersionNum = 0;
3637

3738
bool glContextIsCore;

0 commit comments

Comments
 (0)