VisualC-WinRT/SDL2-WinRT.targets
author Sam Lantinga
Tue, 10 Jan 2017 08:54:33 -0800
changeset 10806 36f40b8cc979
parent 9940 f2d5ed0d9686
child 10911 1863707d9df8
permissions -rw-r--r--
Fixed bugs 2570, 3145, improved OpenGL ES context support on Windows and X11

Mark Callow

The attached patch does the following for the X11 and Windows platforms, the only ones where SDL attempts to use context_create_es_profile:

- Adds SDL_HINT_OPENGL_ES_DRIVER by which the application can
say to use the OpenGL ES driver & EGL rather than the Open GL
driver. (For bug #2570)
- Adds code to {WIN,X11}_GL_InitExtensions to determine the maximum
OpenGL ES version supported by the OpenGL driver (for bug #3145)
- Modifies the test that determines whether to use the OpenGL
driver or the real OpenGL ES driver to take into account the
hint, the requested and supported ES version and whether ES 1.X
is being requested. (For bug #2570 & bug #3145)
- Enables the testgles2 test for __WINDOWS__ and __LINUX__ and adds
the test to the VisualC projects.

With the fix in place I have run testdraw2, testgl and testgles2 without any issues and have run my own apps that use OpenGL, OpenGL ES 3 and OpenGL ES 1.1.
dludwig@9940
     1
<?xml version="1.0" encoding="utf-8"?>
dludwig@9940
     2
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
dludwig@9940
     3
dludwig@9940
     4
  <PropertyGroup>
dludwig@9940
     5
    <LibSDL2-DeviceType Condition="'$(TargetPlatformIdentifier)' == 'Windows' and '$(TargetPlatformVersion)' == '8.0'">WinRT80</LibSDL2-DeviceType>
dludwig@9940
     6
    <LibSDL2-DeviceType Condition="'$(TargetPlatformIdentifier)' == 'Windows' and '$(TargetPlatformVersion)' == '8.1'">WinRT81</LibSDL2-DeviceType>
dludwig@9940
     7
    <LibSDL2-DeviceType Condition="'$(TargetPlatformIdentifier)' == 'Windows Phone' and '$(TargetPlatformVersion)' == '8.0'">WinPhone80</LibSDL2-DeviceType>
dludwig@9940
     8
    <LibSDL2-DeviceType Condition="'$(TargetPlatformIdentifier)' == 'WindowsPhoneApp' and '$(TargetPlatformVersion)' == '8.1'">WinPhone81</LibSDL2-DeviceType>
dludwig@9940
     9
    <LibSDL2-DeviceType Condition="'$(TargetPlatformIdentifier)' == 'UAP'">UWP</LibSDL2-DeviceType>
dludwig@9940
    10
dludwig@9940
    11
  	<LibSDL2-BinPath>$(MSBuildThisFileDirectory)..\..\bin\$(LibSDL2-DeviceType)\$(Platform)</LibSDL2-BinPath>
dludwig@9940
    12
  </PropertyGroup>
dludwig@9940
    13
dludwig@9940
    14
  <Target Name="LibSDL2-DeviceType-Check" BeforeTargets="ResolveAssemblyReferences">
dludwig@9940
    15
      <Error Condition="'$(LibSDL2-DeviceType)' == ''" Text="Unable to determine which version of Windows is being built-for" />
dludwig@9940
    16
  </Target>
dludwig@9940
    17
dludwig@9940
    18
  <ItemDefinitionGroup>
dludwig@9940
    19
    <Link>
dludwig@9940
    20
      <AdditionalLibraryDirectories>$(LibSDL2-BinPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
dludwig@9940
    21
      <AdditionalDependencies>SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
dludwig@9940
    22
    </Link>
dludwig@9940
    23
  </ItemDefinitionGroup>
dludwig@9940
    24
dludwig@9940
    25
  <ItemDefinitionGroup>
dludwig@9940
    26
    <ClCompile>
dludwig@9940
    27
      <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
dludwig@9940
    28
    </ClCompile>
dludwig@9940
    29
  </ItemDefinitionGroup>
dludwig@9940
    30
dludwig@9940
    31
  <ItemGroup Label="LibSDL2">
dludwig@9940
    32
    <PackagingOutputs Include="$(LibSDL2-BinPath)\SDL2.dll">
dludwig@9940
    33
        <OutputGroup>LibSDL2Binaries</OutputGroup>
dludwig@9940
    34
        <ProjectName>$(ProjectName)</ProjectName>
dludwig@9940
    35
        <TargetPath>%(Filename)%(Extension)</TargetPath>
dludwig@9940
    36
    </PackagingOutputs>
dludwig@9940
    37
  </ItemGroup>
dludwig@9940
    38
dludwig@9940
    39
</Project>