Package and default to GLES via ANGLE on windows.
This commit is contained in:
2
AUTHORS
2
AUTHORS
@@ -188,6 +188,8 @@ distributed under MIT License.
|
|||||||
Using Json.NET developed by James Newton-King
|
Using Json.NET developed by James Newton-King
|
||||||
distributed under MIT License.
|
distributed under MIT License.
|
||||||
|
|
||||||
|
Using ANGLE distributed under the BS3 3-Clause license.
|
||||||
|
|
||||||
This site or product includes IP2Location LITE data
|
This site or product includes IP2Location LITE data
|
||||||
available from http://www.ip2location.com.
|
available from http://www.ip2location.com.
|
||||||
|
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -171,6 +171,9 @@ ifeq ($(TARGETPLATFORM), $(filter $(TARGETPLATFORM),win-x86 win-x64))
|
|||||||
@$(INSTALL_PROGRAM) SDL2.dll "$(DATA_INSTALL_DIR)"
|
@$(INSTALL_PROGRAM) SDL2.dll "$(DATA_INSTALL_DIR)"
|
||||||
@$(INSTALL_PROGRAM) freetype6.dll "$(DATA_INSTALL_DIR)"
|
@$(INSTALL_PROGRAM) freetype6.dll "$(DATA_INSTALL_DIR)"
|
||||||
@$(INSTALL_PROGRAM) lua51.dll "$(DATA_INSTALL_DIR)"
|
@$(INSTALL_PROGRAM) lua51.dll "$(DATA_INSTALL_DIR)"
|
||||||
|
@$(INSTALL_PROGRAM) libEGL.dll "$(DATA_INSTALL_DIR)"
|
||||||
|
@$(INSTALL_PROGRAM) libGLESv2.dll "$(DATA_INSTALL_DIR)"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGETPLATFORM), linux-x64)
|
ifeq ($(TARGETPLATFORM), linux-x64)
|
||||||
@-echo "Installing OpenRA dependencies to $(DATA_INSTALL_DIR)"
|
@-echo "Installing OpenRA dependencies to $(DATA_INSTALL_DIR)"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace OpenRA
|
|||||||
public enum GLProfile
|
public enum GLProfile
|
||||||
{
|
{
|
||||||
Automatic,
|
Automatic,
|
||||||
|
ANGLE,
|
||||||
Modern,
|
Modern,
|
||||||
Embedded,
|
Embedded,
|
||||||
Legacy
|
Legacy
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj" />
|
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj" />
|
||||||
<PackageReference Include="OpenRA-Freetype6" Version="1.0.4" />
|
<PackageReference Include="OpenRA-Freetype6" Version="1.0.4" />
|
||||||
<PackageReference Include="OpenRA-OpenAL-CS" Version="1.0.16" />
|
<PackageReference Include="OpenRA-OpenAL-CS" Version="1.0.16" />
|
||||||
<PackageReference Include="OpenRA-SDL2-CS" Version="1.0.27" />
|
<PackageReference Include="OpenRA-SDL2-CS" Version="1.0.28" />
|
||||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
|
||||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||||
<AdditionalFiles Include="../stylecop.json" />
|
<AdditionalFiles Include="../stylecop.json" />
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -146,14 +147,11 @@ namespace OpenRA.Platforms.Default
|
|||||||
SetProcessDPIAware();
|
SetProcessDPIAware();
|
||||||
|
|
||||||
// Decide which OpenGL profile to use.
|
// Decide which OpenGL profile to use.
|
||||||
// We first need to query the available profiles on Windows/Linux.
|
// Prefer standard GL over GLES provided by the native driver
|
||||||
// On macOS, known/consistent OpenGL support is provided by the OS.
|
var testProfiles = new List<GLProfile> { GLProfile.ANGLE, GLProfile.Modern, GLProfile.Embedded, GLProfile.Legacy };
|
||||||
if (Platform.CurrentPlatform == PlatformType.OSX)
|
supportedProfiles = testProfiles
|
||||||
supportedProfiles = new[] { GLProfile.Modern, GLProfile.Legacy };
|
.Where(CanCreateGLWindow)
|
||||||
else
|
.ToArray();
|
||||||
supportedProfiles = new[] { GLProfile.Modern, GLProfile.Embedded, GLProfile.Legacy }
|
|
||||||
.Where(CanCreateGLWindow)
|
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
if (!supportedProfiles.Any())
|
if (!supportedProfiles.Any())
|
||||||
throw new InvalidOperationException("No supported OpenGL profiles were found.");
|
throw new InvalidOperationException("No supported OpenGL profiles were found.");
|
||||||
@@ -471,6 +469,9 @@ namespace OpenRA.Platforms.Default
|
|||||||
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_BLUE_SIZE, 8);
|
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_BLUE_SIZE, 8);
|
||||||
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_ALPHA_SIZE, 0);
|
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_ALPHA_SIZE, 0);
|
||||||
|
|
||||||
|
var useAngle = profile == GLProfile.ANGLE ? "1" : "0";
|
||||||
|
SDL.SDL_SetHint("SDL_OPENGL_ES_DRIVER", useAngle);
|
||||||
|
|
||||||
switch (profile)
|
switch (profile)
|
||||||
{
|
{
|
||||||
case GLProfile.Modern:
|
case GLProfile.Modern:
|
||||||
@@ -478,6 +479,7 @@ namespace OpenRA.Platforms.Default
|
|||||||
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
||||||
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_PROFILE_MASK, (int)SDL.SDL_GLprofile.SDL_GL_CONTEXT_PROFILE_CORE);
|
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_PROFILE_MASK, (int)SDL.SDL_GLprofile.SDL_GL_CONTEXT_PROFILE_CORE);
|
||||||
break;
|
break;
|
||||||
|
case GLProfile.ANGLE:
|
||||||
case GLProfile.Embedded:
|
case GLProfile.Embedded:
|
||||||
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||||
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||||
@@ -516,10 +518,18 @@ namespace OpenRA.Platforms.Default
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Distinguish between ANGLE and native GLES
|
||||||
|
var success = true;
|
||||||
|
if (profile == GLProfile.ANGLE || profile == GLProfile.Embedded)
|
||||||
|
{
|
||||||
|
var isAngle = SDL.SDL_GL_ExtensionSupported("GL_ANGLE_texture_usage") == SDL.SDL_bool.SDL_TRUE;
|
||||||
|
success = isAngle ^ (profile != GLProfile.ANGLE);
|
||||||
|
}
|
||||||
|
|
||||||
SDL.SDL_GL_DeleteContext(context);
|
SDL.SDL_GL_DeleteContext(context);
|
||||||
SDL.SDL_DestroyWindow(window);
|
SDL.SDL_DestroyWindow(window);
|
||||||
SDL.SDL_Quit();
|
SDL.SDL_Quit();
|
||||||
return true;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetScaleModifier(float scale)
|
public void SetScaleModifier(float scale)
|
||||||
|
|||||||
@@ -153,6 +153,8 @@ Section "Game" GAME
|
|||||||
File "${SRCDIR}\DiscordRPC.dll"
|
File "${SRCDIR}\DiscordRPC.dll"
|
||||||
File "${SRCDIR}\Newtonsoft.Json.dll"
|
File "${SRCDIR}\Newtonsoft.Json.dll"
|
||||||
File "${SRCDIR}\SDL2.dll"
|
File "${SRCDIR}\SDL2.dll"
|
||||||
|
File "${SRCDIR}\libEGL.dll"
|
||||||
|
File "${SRCDIR}\libGLESv2.dll"
|
||||||
File "${SRCDIR}\freetype6.dll"
|
File "${SRCDIR}\freetype6.dll"
|
||||||
File "${SRCDIR}\lua51.dll"
|
File "${SRCDIR}\lua51.dll"
|
||||||
|
|
||||||
@@ -263,6 +265,8 @@ Function ${UN}Clean
|
|||||||
Delete $INSTDIR\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP
|
Delete $INSTDIR\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP
|
||||||
Delete $INSTDIR\soft_oal.dll
|
Delete $INSTDIR\soft_oal.dll
|
||||||
Delete $INSTDIR\SDL2.dll
|
Delete $INSTDIR\SDL2.dll
|
||||||
|
Delete $INSTDIR\libEGL.dll
|
||||||
|
Delete $INSTDIR\libGLESv2.dll
|
||||||
Delete $INSTDIR\lua51.dll
|
Delete $INSTDIR\lua51.dll
|
||||||
Delete $INSTDIR\eluant.dll
|
Delete $INSTDIR\eluant.dll
|
||||||
Delete $INSTDIR\freetype6.dll
|
Delete $INSTDIR\freetype6.dll
|
||||||
|
|||||||
Reference in New Issue
Block a user