Commit 406a3be9 by Cooper Partin Committed by Geoff Lang

Added IInspectable EGLNativeWindowType and ICoreWindow support

Change-Id: I9ad82b7819bcca1c05e7aa60dc2baec4a7bc403c Reviewed-on: https://chromium-review.googlesource.com/222360Tested-by: 's avatarCooper Partin <coopp@microsoft.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 97049c6a
Debug
Debug_Win32
Debug_x64
Release
Release_Win32
Release_x64
Debug/
Debug_Win32/
Debug_x64/
Debug_ARM/
Release/
Release_Win32/
Release_x64/
Release_ARM/
*.sdf
*.ncb
*.suo
......
......@@ -8,6 +8,8 @@
{
'angle_build_tests%': '1',
'angle_build_samples%': '1',
'angle_build_winrt%': '0',
'angle_build_winphone%': '0',
# angle_code is set to 1 for the core ANGLE targets defined in src/build_angle.gyp.
# angle_code is set to 0 for test code, sample code, and third party code.
# When angle_code is 1, we build with additional warning flags on Mac and Linux.
......@@ -96,6 +98,10 @@
'Debug_Base':
{
'abstract': 1,
'defines':
[
'_DEBUG'
],
'msvs_settings':
{
'VCCLCompilerTool':
......@@ -103,6 +109,15 @@
'Optimization': '0', # /Od
'BasicRuntimeChecks': '3',
'RuntimeLibrary': '1', # /MTd (debug static)
'conditions':
[
# winrt compilation requires that this library is
# uses dynamic linked runtime
['angle_build_winrt==1',
{
'RuntimeLibrary': '3', # /MDd (debug dynamic)
}],
],
},
'VCLinkerTool':
{
......@@ -120,12 +135,25 @@
'Release_Base':
{
'abstract': 1,
'defines':
[
'NDEBUG'
],
'msvs_settings':
{
'VCCLCompilerTool':
{
'Optimization': '2', # /Os
'RuntimeLibrary': '0', # /MT (static)
'conditions':
[
# winrt compilation requires that this library is
# uses dynamic linked runtime
['angle_build_winrt==1',
{
'RuntimeLibrary': '2', # /MDd (debug dynamic)
}],
],
},
'VCLinkerTool':
{
......@@ -184,6 +212,30 @@
},
}, # x64_Base
'arm_Base':
{
'abstract': 1,
'msvs_configuration_platform': 'ARM',
'msvs_settings':
{
'VCLinkerTool':
{
'TargetMachine': '3', # ARM
'AdditionalLibraryDirectories':
[
'<(windows_sdk_path)/Lib/win8/um/arm',
],
},
'VCLibrarianTool':
{
'AdditionalLibraryDirectories':
[
'<(windows_sdk_path)/Lib/win8/um/arm',
],
},
},
}, # arm_Base
# Concrete configurations
'Debug':
{
......@@ -195,7 +247,7 @@
},
'conditions':
[
[ 'OS == "win" and MSVS_VERSION != "2010e"',
['angle_build_winrt==0 and OS == "win" and MSVS_VERSION != "2010e"',
{
'Debug_x64':
{
......@@ -206,6 +258,36 @@
'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
},
}],
['angle_build_winrt==1 and angle_build_winphone==0',
{
'Debug_x64':
{
'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
},
'Release_x64':
{
'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
},
'Debug_ARM':
{
'inherit_from': ['Common_Base', 'arm_Base', 'Debug_Base'],
},
'Release_ARM':
{
'inherit_from': ['Common_Base', 'arm_Base', 'Release_Base'],
},
}],
['angle_build_winrt==1 and angle_build_winphone==1',
{
'Debug_ARM':
{
'inherit_from': ['Common_Base', 'arm_Base', 'Debug_Base'],
},
'Release_ARM':
{
'inherit_from': ['Common_Base', 'arm_Base', 'Release_Base'],
},
}],
],
}, # configurations
}, # target_defaults
......
......@@ -7,13 +7,16 @@
{
'component%': 'static_library',
'angle_path%': '..',
'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/8.0',
'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/8.1',
'windows8_sdk_path%': 'C:/Program Files (x86)/Windows Kits/8.0',
},
'msvs_disabled_warnings': [ 4100, 4127, 4239, 4244, 4245, 4251, 4512, 4702, 4530, 4718, 4267 ],
'msvs_disabled_warnings': [ 4100, 4127, 4239, 4244, 4245, 4251, 4512, 4702, 4530, 4718, 4267, 4264, 4447, 4075 ],
'msvs_system_include_dirs':
[
'<(windows_sdk_path)/Include/shared',
'<(windows_sdk_path)/Include/um',
'<(windows8_sdk_path)/Include/shared',
'<(windows8_sdk_path)/Include/um',
],
'msvs_settings':
{
......@@ -28,21 +31,38 @@
},
'VCLinkerTool':
{
'AdditionalDependencies':
'conditions':
[
'kernel32.lib',
'gdi32.lib',
'winspool.lib',
'comdlg32.lib',
'advapi32.lib',
'shell32.lib',
'ole32.lib',
'oleaut32.lib',
'user32.lib',
'uuid.lib',
'odbc32.lib',
'odbccp32.lib',
'delayimp.lib',
['angle_build_winrt==0',
{
'AdditionalDependencies':
[
'kernel32.lib',
'gdi32.lib',
'winspool.lib',
'comdlg32.lib',
'advapi32.lib',
'shell32.lib',
'ole32.lib',
'oleaut32.lib',
'user32.lib',
'uuid.lib',
'odbc32.lib',
'odbccp32.lib',
'delayimp.lib',
],
}],
# winrt compilation is dynamic depending on the project
# type. AdditionalDependencies is automatically configured
# with the required .libs
['angle_build_winrt==1',
{
'AdditionalDependencies':
[
'%(AdditionalDependencies)',
'uuid.lib',
],
}],
],
},
},
......@@ -67,10 +87,6 @@
],
},
},
'defines':
[
'_DEBUG'
],
},
'Release':
{
......@@ -80,21 +96,19 @@
{
'AdditionalLibraryDirectories':
[
'<(windows_sdk_path)/Lib/win8/um/x86',
'<(windows_sdk_path)/Lib/winv6.3/um/x86',
'<(windows8_sdk_path)/Lib/win8/um/x86',
],
},
'VCLibrarianTool':
{
'AdditionalLibraryDirectories':
[
'<(windows_sdk_path)/Lib/win8/um/x86',
'<(windows_sdk_path)/Lib/winv6.3/um/x86',
'<(windows8_sdk_path)/Lib/win8/um/x86',
],
},
},
'defines':
[
'NDEBUG'
],
},
},
'conditions':
......
......@@ -19,11 +19,14 @@ gyp_dir = os.path.join(angle_dir, 'third_party', 'gyp')
generation_dir = "projects"
gyp_generators = "msvs"
msvs_version = "2013e"
build_samples = True
build_tests = False
release_symbols = False
if __name__ == '__main__':
def generateProjects( generation_dir,
build_samples,
build_winrt,
build_winphone,
enable_d3d9 ) :
gyp_cmd = os.path.join(gyp_dir, 'gyp')
gyp_cmd += ' --ignore-environment'
gyp_cmd += ' --depth=.'
......@@ -35,6 +38,9 @@ if __name__ == '__main__':
gyp_cmd += ' -D angle_build_samples=' + ('1' if build_samples else '0')
gyp_cmd += ' -D release_symbols=' + ('true' if release_symbols else 'false')
gyp_cmd += ' -D angle_use_commit_id=0'
gyp_cmd += ' -D angle_build_winrt=' + ('1' if build_winrt else '0')
gyp_cmd += ' -D angle_build_winphone=' + ('1' if build_winphone else '0')
gyp_cmd += ' -D angle_enable_d3d9=' + ('1' if enable_d3d9 else '0')
gyp_cmd += ' ' + os.path.join(script_dir, 'all.gyp')
print 'Generating projects to ' + generation_dir + ' from gyp files...'
......@@ -47,3 +53,12 @@ if __name__ == '__main__':
print git_add_cmd
sys.stdout.flush()
os.system(git_add_cmd)
return;
if __name__ == '__main__':
# Generate Windows Desktop projects
generateProjects("projects", True, False, False, True);
# Generate Windows 8.1 projects
generateProjects("projects/winrt/windows", False, True, False, False);
......@@ -75,7 +75,13 @@
typedef HDC EGLNativeDisplayType;
typedef HBITMAP EGLNativePixmapType;
#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP /* Windows Store */
#include <inspectable.h>
typedef IInspectable* EGLNativeWindowType;
#else
typedef HWND EGLNativeWindowType;
#endif
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
......
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// angle_windowsstore.h:
#ifndef ANGLE_WINDOWSSTORE_H_
#define ANGLE_WINDOWSSTORE_H_
// The following properties can be set on the CoreApplication to support additional
// ANGLE configuration options.
//
// The Visual Studio sample templates provided with this version of ANGLE have examples
// of how to set these property values.
//
// Property: EGLNativeWindowTypeProperty
// Type: IInspectable
// Description: Set this property to specify the window type to use for creating a surface.
// If this property is missing, surface creation will fail.
//
const wchar_t EGLNativeWindowTypeProperty[] = L"EGLNativeWindowTypeProperty";
//
// Property: EGLRenderSurfaceSizeProperty
// Type: Size
// Description: Set this property to specify a preferred size in pixels of the render surface.
// The render surface size width and height must be greater than 0.
// If this property is set, then the render surface size is fixed.
// If this property is missing, a default behavior will be provided.
// The default behavior uses the window size if a CoreWindow is specified or
// the size of the SwapChainPanel control if one is specified.
//
const wchar_t EGLRenderSurfaceSizeProperty[] = L"EGLRenderSurfaceSizeProperty";
#endif // ANGLE_WINDOWSSTORE_H_
......@@ -60,18 +60,19 @@
<MinimalRebuild>false</MinimalRebuild>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
<Link>
<AdditionalDependencies></AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
......@@ -81,6 +82,7 @@
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
......@@ -95,17 +97,18 @@
<MinimalRebuild>false</MinimalRebuild>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
<Link>
<AdditionalDependencies></AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
......@@ -115,6 +118,7 @@
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
......@@ -128,18 +132,19 @@
<MinimalRebuild>false</MinimalRebuild>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
<Link>
<AdditionalDependencies></AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
......@@ -149,6 +154,7 @@
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
......@@ -162,17 +168,18 @@
<MinimalRebuild>false</MinimalRebuild>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
<Link>
<AdditionalDependencies></AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
......@@ -182,6 +189,7 @@
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
......
......@@ -60,18 +60,19 @@
<MinimalRebuild>false</MinimalRebuild>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
<Link>
<AdditionalDependencies></AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
......@@ -81,6 +82,7 @@
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
......@@ -95,17 +97,18 @@
<MinimalRebuild>false</MinimalRebuild>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
<Link>
<AdditionalDependencies></AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
......@@ -115,6 +118,7 @@
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
......@@ -128,18 +132,19 @@
<MinimalRebuild>false</MinimalRebuild>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
<Link>
<AdditionalDependencies></AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
......@@ -149,6 +154,7 @@
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
......@@ -162,17 +168,18 @@
<MinimalRebuild>false</MinimalRebuild>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
<Link>
<AdditionalDependencies></AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
......@@ -182,6 +189,7 @@
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
......
......@@ -181,11 +181,8 @@
<Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter>
<Filter Include="src\common">
<UniqueIdentifier>{2F5FD094-EF52-77F7-7AA8-4327A01BF747}</UniqueIdentifier>
</Filter>
<Filter Include="src\common\win32">
<UniqueIdentifier>{789FEF16-EFE7-512E-F91B-DF7E0D72FB79}</UniqueIdentifier>
<Filter Include="src\libEGL">
<UniqueIdentifier>{D633941D-C923-DFCE-3A9B-DCF851CC7DBA}</UniqueIdentifier>
</Filter>
<Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
......@@ -256,8 +253,11 @@
<Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter>
<Filter Include="src\libEGL">
<UniqueIdentifier>{D633941D-C923-DFCE-3A9B-DCF851CC7DBA}</UniqueIdentifier>
<Filter Include="src\common">
<UniqueIdentifier>{2F5FD094-EF52-77F7-7AA8-4327A01BF747}</UniqueIdentifier>
</Filter>
<Filter Include="src\common\win32">
<UniqueIdentifier>{789FEF16-EFE7-512E-F91B-DF7E0D72FB79}</UniqueIdentifier>
</Filter>
<Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
......@@ -354,9 +354,6 @@
<ClInclude Include="..\..\src\common\version.h">
<Filter>src\common</Filter>
</ClInclude>
<ClCompile Include="..\..\src\common\win32\NativeWindow.cpp">
<Filter>src\common\win32</Filter>
</ClCompile>
<ClCompile Include="..\..\src\libEGL\Config.cpp">
<Filter>src\libEGL</Filter>
</ClCompile>
......@@ -393,6 +390,9 @@
<ClInclude Include="..\..\src\libEGL\resource.h">
<Filter>src\libEGL</Filter>
</ClInclude>
<ClCompile Include="..\..\src\common\win32\NativeWindow.cpp">
<Filter>src\common\win32</Filter>
</ClCompile>
<None Include="..\..\src\angle.gyp">
<Filter>src</Filter>
</None>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="libGLESv2">
<UniqueIdentifier>{A62A9415-2E9D-A6D2-631D-1F25A5CD626F}</UniqueIdentifier>
</Filter>
<Filter Include="libGLESv2">
<UniqueIdentifier>{A62A9415-2E9D-A6D2-631D-1F25A5CD626F}</UniqueIdentifier>
</Filter>
<Filter Include="libGLESv2">
<UniqueIdentifier>{A62A9415-2E9D-A6D2-631D-1F25A5CD626F}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\src\libGLESv2\libGLESv2.cpp">
<Filter>libGLESv2</Filter>
</ClCompile>
<None Include="..\..\..\..\src\libGLESv2\libGLESv2.def">
<Filter>libGLESv2</Filter>
</None>
<ResourceCompile Include="..\..\..\..\src\libGLESv2\libGLESv2.rc">
<Filter>libGLESv2</Filter>
</ResourceCompile>
<None Include="..\..\..\..\src\angle.gyp"/>
</ItemGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="libGLESv2">
<UniqueIdentifier>{A62A9415-2E9D-A6D2-631D-1F25A5CD626F}</UniqueIdentifier>
</Filter>
<Filter Include="libGLESv2">
<UniqueIdentifier>{A62A9415-2E9D-A6D2-631D-1F25A5CD626F}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\src\libGLESv2\libGLESv2.cpp">
<Filter>libGLESv2</Filter>
</ClCompile>
<ResourceCompile Include="..\..\..\..\src\libGLESv2\libGLESv2.rc">
<Filter>libGLESv2</Filter>
</ResourceCompile>
<None Include="..\..\..\..\src\angle.gyp"/>
</ItemGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="compiler">
<UniqueIdentifier>{041FFD28-E4BD-ABC0-5AF7-A6D1560FAC0E}</UniqueIdentifier>
</Filter>
<Filter Include="compiler\translator">
<UniqueIdentifier>{502101C2-1680-5126-1D2E-39419A1AE009}</UniqueIdentifier>
</Filter>
<Filter Include="compiler">
<UniqueIdentifier>{041FFD28-E4BD-ABC0-5AF7-A6D1560FAC0E}</UniqueIdentifier>
</Filter>
<Filter Include="compiler\translator">
<UniqueIdentifier>{502101C2-1680-5126-1D2E-39419A1AE009}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\src\compiler\translator\ShaderLang.cpp">
<Filter>compiler\translator</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\compiler\translator\ShaderVars.cpp">
<Filter>compiler\translator</Filter>
</ClCompile>
<None Include="..\..\..\..\src\angle.gyp"/>
</ItemGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="compiler">
<UniqueIdentifier>{041FFD28-E4BD-ABC0-5AF7-A6D1560FAC0E}</UniqueIdentifier>
</Filter>
<Filter Include="compiler\translator">
<UniqueIdentifier>{502101C2-1680-5126-1D2E-39419A1AE009}</UniqueIdentifier>
</Filter>
<Filter Include="compiler">
<UniqueIdentifier>{041FFD28-E4BD-ABC0-5AF7-A6D1560FAC0E}</UniqueIdentifier>
</Filter>
<Filter Include="compiler\translator">
<UniqueIdentifier>{502101C2-1680-5126-1D2E-39419A1AE009}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\src\compiler\translator\ShaderLang.cpp">
<Filter>compiler\translator</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\compiler\translator\ShaderVars.cpp">
<Filter>compiler\translator</Filter>
</ClCompile>
<None Include="..\..\..\..\src\angle.gyp"/>
</ItemGroup>
</Project>
......@@ -44,6 +44,18 @@
'files': [ 'copy_compiler_dll.bat', '<(angle_id_script_base)' ],
},
],
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'type' : 'shared_library',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
},
],
'conditions':
......@@ -80,6 +92,18 @@
'<(angle_gen_path)',
],
},
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'type' : 'shared_library',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
}
]
},
......@@ -104,6 +128,18 @@
'<(angle_gen_path)',
],
},
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'type' : 'shared_library',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
}
]
}],
......@@ -116,23 +152,38 @@
'type': 'none',
'dependencies': [ 'copy_scripts', ],
'includes': [ '../build/common_defines.gypi', ],
'actions':
'conditions':
[
['angle_build_winrt==0',
{
'action_name': 'copy_dll',
'message': 'Copying D3D Compiler DLL...',
'msvs_cygwin_shell': 0,
'inputs': [ 'copy_compiler_dll.bat' ],
'outputs': [ '<(PRODUCT_DIR)/d3dcompiler_46.dll' ],
'action':
'actions':
[
"<(angle_gen_path)/copy_compiler_dll.bat",
"$(PlatformName)",
"<(windows_sdk_path)",
"<(PRODUCT_DIR)"
],
},
], #actions
{
'action_name': 'copy_dll',
'message': 'Copying D3D Compiler DLL...',
'msvs_cygwin_shell': 0,
'inputs': [ 'copy_compiler_dll.bat' ],
'outputs': [ '<(PRODUCT_DIR)/d3dcompiler_46.dll' ],
'action':
[
"<(angle_gen_path)/copy_compiler_dll.bat",
"$(PlatformName)",
"<(windows8_sdk_path)",
"<(PRODUCT_DIR)"
],
},
], #actions
}],
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'type' : 'shared_library',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
]
},
], # targets
}],
......
......@@ -20,22 +20,35 @@
// types. The HWND NativeWindow implementation requires IDXGISwapChain
// and IDXGIFactory and the Windows Store NativeWindow
// implementation requires IDXGISwapChain1 and IDXGIFactory2.
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
typedef IDXGISwapChain1 DXGISwapChain;
typedef IDXGIFactory2 DXGIFactory;
#include <wrl.h>
#include <wrl/wrappers/corewrappers.h>
#include <windows.applicationmodel.core.h>
#include <memory>
class IInspectableNativeWindow;
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
#else
typedef IDXGISwapChain DXGISwapChain;
typedef IDXGIFactory DXGIFactory;
#endif
namespace rx
{
class NativeWindow
{
public:
public:
explicit NativeWindow(EGLNativeWindowType window);
// The HWND NativeWindow implementation can benefit
// by having inline versions of these methods to
// reduce the calling overhead.
inline bool initialize() { return true; }
inline bool getClientRect(LPRECT rect) { return GetClientRect(mWindow, rect) == TRUE; }
inline bool isIconic() { return IsIconic(mWindow) == TRUE; }
bool initialize();
bool getClientRect(LPRECT rect);
bool isIconic();
HRESULT createSwapChain(ID3D11Device* device, DXGIFactory* factory,
DXGI_FORMAT format, UINT width, UINT height,
......@@ -43,8 +56,13 @@ class NativeWindow
inline EGLNativeWindowType getNativeWindow() const { return mWindow; }
private:
private:
EGLNativeWindowType mWindow;
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
std::shared_ptr<IInspectableNativeWindow> mImpl;
#endif
};
}
......
......@@ -109,7 +109,7 @@ inline unsigned int unorm(float x)
inline bool supportsSSE2()
{
#ifdef ANGLE_PLATFORM_WINDOWS
#if ANGLE_PLATFORM_WINDOWS && !defined(_M_ARM)
static bool checked = false;
static bool supports = false;
......
......@@ -34,6 +34,9 @@
#endif
#ifdef ANGLE_PLATFORM_WINDOWS
# if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP
# define ANGLE_ENABLE_WINDOWS_STORE 1
# endif
# ifndef STRICT
# define STRICT 1
# endif
......@@ -60,6 +63,11 @@
# include <d3dcompiler.h>
# endif
# if defined(ANGLE_ENABLE_WINDOWS_STORE)
# undef ANGLE_ENABLE_PERF
# include <dxgi1_3.h>
# endif
# undef near
# undef far
#endif
......
......@@ -10,12 +10,50 @@
#include <assert.h>
#ifdef ANGLE_ENABLE_WINDOWS_STORE
#include <vector>
#include <set>
#include <map>
#include <mutex>
#include <wrl/client.h>
#include <wrl/async.h>
#include <Windows.System.Threading.h>
using namespace std;
using namespace Windows::Foundation;
using namespace ABI::Windows::System::Threading;
// Thread local storage for Windows Store support
typedef vector<void*> ThreadLocalData;
static __declspec(thread) ThreadLocalData* currentThreadData = nullptr;
static set<ThreadLocalData*> allThreadData;
static DWORD nextTlsIndex = 0;
static vector<DWORD> freeTlsIndices;
#endif
TLSIndex CreateTLSIndex()
{
TLSIndex index;
#ifdef ANGLE_PLATFORM_WINDOWS
#ifdef ANGLE_ENABLE_WINDOWS_STORE
if (!freeTlsIndices.empty())
{
DWORD result = freeTlsIndices.back();
freeTlsIndices.pop_back();
index = result;
}
else
{
index = nextTlsIndex++;
}
#else
index = TlsAlloc();
#endif
#elif defined(ANGLE_PLATFORM_POSIX)
// Create global pool key
if ((pthread_key_create(&index, NULL)) != 0)
......@@ -37,7 +75,22 @@ bool DestroyTLSIndex(TLSIndex index)
}
#ifdef ANGLE_PLATFORM_WINDOWS
#ifdef ANGLE_ENABLE_WINDOWS_STORE
assert(index < nextTlsIndex);
assert(find(freeTlsIndices.begin(), freeTlsIndices.end(), index) == freeTlsIndices.end());
freeTlsIndices.push_back(index);
for (auto threadData : allThreadData)
{
if (threadData->size() > index)
{
threadData->at(index) = nullptr;
}
}
return true;
#else
return (TlsFree(index) == TRUE);
#endif
#elif defined(ANGLE_PLATFORM_POSIX)
return (pthread_key_delete(index) == 0);
#endif
......@@ -52,7 +105,24 @@ bool SetTLSValue(TLSIndex index, void *value)
}
#ifdef ANGLE_PLATFORM_WINDOWS
#ifdef ANGLE_ENABLE_WINDOWS_STORE
ThreadLocalData* threadData = currentThreadData;
if (!threadData)
{
threadData = new ThreadLocalData(index + 1, nullptr);
allThreadData.insert(threadData);
currentThreadData = threadData;
}
else if (threadData->size() <= index)
{
threadData->resize(index + 1, nullptr);
}
threadData->at(index) = value;
return true;
#else
return (TlsSetValue(index, value) == TRUE);
#endif
#elif defined(ANGLE_PLATFORM_POSIX)
return (pthread_setspecific(index, value) == 0);
#endif
......@@ -67,7 +137,19 @@ void *GetTLSValue(TLSIndex index)
}
#ifdef ANGLE_PLATFORM_WINDOWS
#ifdef ANGLE_ENABLE_WINDOWS_STORE
ThreadLocalData* threadData = currentThreadData;
if (threadData && threadData->size() > index)
{
return threadData->at(index);
}
else
{
return nullptr;
}
#else
return TlsGetValue(index);
#endif
#elif defined(ANGLE_PLATFORM_POSIX)
return pthread_getspecific(index);
#endif
......
......@@ -12,6 +12,14 @@
#include "common/platform.h"
#ifdef ANGLE_PLATFORM_WINDOWS
// TLS does not exist for Windows Store and needs to be emulated
# ifdef ANGLE_ENABLE_WINDOWS_STORE
# define TLS_OUT_OF_INDEXES -1
# ifndef CREATE_SUSPENDED
# define CREATE_SUSPENDED 0x00000004
# endif
# endif
typedef DWORD TLSIndex;
# define TLS_INVALID_INDEX (TLS_OUT_OF_INDEXES)
#elif defined(ANGLE_PLATFORM_POSIX)
......
......@@ -12,6 +12,13 @@
#include <set>
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
# include <wrl.h>
# include <wrl/wrappers/corewrappers.h>
# include <windows.applicationmodel.core.h>
# include <windows.graphics.display.h>
#endif
namespace gl
{
......@@ -442,22 +449,79 @@ int VariableSortOrder(GLenum type)
std::string getTempPath()
{
#ifdef ANGLE_PLATFORM_WINDOWS
char path[MAX_PATH];
DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path);
if (pathLen == 0)
{
UNREACHABLE();
return std::string();
}
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
using namespace ABI::Windows::ApplicationModel::Core;
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::Foundation::Collections;
ComPtr<IActivationFactory> pActivationFactory;
ComPtr<ABI::Windows::ApplicationModel::IPackageStatics> packageStatics;
ComPtr<ABI::Windows::ApplicationModel::IPackage> package;
ComPtr<ABI::Windows::Storage::IStorageFolder> storageFolder;
ComPtr<ABI::Windows::Storage::IStorageItem> storageItem;
HString hstrPath;
HRESULT result = GetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Package).Get(), &pActivationFactory);
ASSERT(SUCCEEDED(result));
if (SUCCEEDED(result))
{
result = pActivationFactory.As(&packageStatics);
ASSERT(SUCCEEDED(result));
}
if (SUCCEEDED(result))
{
result = packageStatics->get_Current(&package);
ASSERT(SUCCEEDED(result));
}
if (SUCCEEDED(result))
{
result = package->get_InstalledLocation(&storageFolder);
ASSERT(SUCCEEDED(result));
}
if (SUCCEEDED(result))
{
result = storageFolder.As(&storageItem);
ASSERT(SUCCEEDED(result));
}
if (SUCCEEDED(result))
{
result = storageItem->get_Path(hstrPath.GetAddressOf());
ASSERT(SUCCEEDED(result));
}
if (SUCCEEDED(result))
{
std::wstring t = std::wstring(hstrPath.GetRawBuffer(nullptr));
return std::string(t.begin(), t.end());
}
UINT unique = GetTempFileNameA(path, "sh", 0, path);
if (unique == 0)
{
UNREACHABLE();
return std::string();
}
#else
char path[MAX_PATH];
DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path);
if (pathLen == 0)
{
UNREACHABLE();
return std::string();
}
return path;
UINT unique = GetTempFileNameA(path, "sh", 0, path);
if (unique == 0)
{
UNREACHABLE();
return std::string();
}
return path;
#endif
#else
UNIMPLEMENTED();
return "";
......@@ -476,3 +540,32 @@ void writeFile(const char* path, const void* content, size_t size)
fwrite(content, sizeof(char), size, file);
fclose(file);
}
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
void Sleep(unsigned long dwMilliseconds)
{
static HANDLE singletonEvent = nullptr;
HANDLE sleepEvent = singletonEvent;
if (!sleepEvent)
{
sleepEvent = CreateEventEx(nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS);
if (!sleepEvent)
return;
HANDLE previousEvent = InterlockedCompareExchangePointerRelease(&singletonEvent, sleepEvent, nullptr);
if (previousEvent)
{
// Back out if multiple threads try to demand create at the same time.
CloseHandle(sleepEvent);
sleepEvent = previousEvent;
}
}
// Emulate sleep by waiting with timeout on an event that is never signalled.
WaitForSingleObjectEx(sleepEvent, dwMilliseconds, false);
}
#endif
......@@ -49,4 +49,8 @@ template <typename outT> outT uiround(GLfloat value) { return static_cast<outT>(
std::string getTempPath();
void writeFile(const char* path, const void* data, size_t size);
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
void Sleep(_In_ unsigned long dwMilliseconds);
#endif
#endif // LIBGLESV2_UTILITIES_H
......@@ -20,6 +20,21 @@ NativeWindow::NativeWindow(EGLNativeWindowType window) : mWindow(window)
{
}
bool NativeWindow::initialize()
{
return true;
}
bool NativeWindow::getClientRect(LPRECT rect)
{
return GetClientRect(mWindow, rect) == TRUE;
}
bool NativeWindow::isIconic()
{
return IsIconic(mWindow) == TRUE;
}
HRESULT NativeWindow::createSwapChain(ID3D11Device* device, DXGIFactory* factory,
DXGI_FORMAT format, unsigned int width, unsigned int height,
DXGISwapChain** swapChain)
......
//
// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CoreWindowNativeWindow.cpp: NativeWindow for managing ICoreWindow native window types.
#include <windows.graphics.display.h>
#include "common/winrt/CoreWindowNativeWindow.h"
using namespace ABI::Windows::Foundation::Collections;
CoreWindowNativeWindow::~CoreWindowNativeWindow()
{
unregisterForSizeChangeEvents();
}
bool CoreWindowNativeWindow::initialize(EGLNativeWindowType window, IPropertySet *propertySet)
{
ComPtr<IPropertySet> props = propertySet;
ComPtr<IInspectable> win = window;
SIZE swapChainSize = {};
bool swapChainSizeSpecified = false;
HRESULT result = S_OK;
// IPropertySet is an optional parameter and can null.
// If one is specified, cache as an IMap and read the properties
// used for initial host initialization.
if (propertySet)
{
result = props.As(&mPropertyMap);
if (SUCCEEDED(result))
{
// The EGLRenderSurfaceSizeProperty is optional and may be missing. The IPropertySet
// was prevalidated to contain the EGLNativeWindowType before being passed to
// this host.
result = getOptionalSizePropertyValue(mPropertyMap, EGLRenderSurfaceSizeProperty, &swapChainSize, &swapChainSizeSpecified);
}
}
if (SUCCEEDED(result))
{
result = win.As(&mCoreWindow);
}
if (SUCCEEDED(result))
{
// If a swapchain size is specfied, then the automatic resize
// behaviors implemented by the host should be disabled. The swapchain
// will be still be scaled when being rendered to fit the bounds
// of the host.
// Scaling of the swapchain output occurs automatically because if
// the scaling mode setting DXGI_SCALING_STRETCH on the swapchain.
if (swapChainSizeSpecified)
{
mClientRect = { 0, 0, swapChainSize.cx, swapChainSize.cy };
mSupportsSwapChainResize = false;
}
else
{
result = getCoreWindowSizeInPixels(mCoreWindow, &mClientRect);
}
}
if (SUCCEEDED(result))
{
mNewClientRect = mClientRect;
mClientRectChanged = false;
return registerForSizeChangeEvents();
}
return false;
}
bool CoreWindowNativeWindow::registerForSizeChangeEvents()
{
ComPtr<IWindowSizeChangedEventHandler> sizeChangedHandler;
HRESULT result = Microsoft::WRL::MakeAndInitialize<CoreWindowSizeChangedHandler>(sizeChangedHandler.ReleaseAndGetAddressOf(), this->shared_from_this());
if (SUCCEEDED(result))
{
result = mCoreWindow->add_SizeChanged(sizeChangedHandler.Get(), &mSizeChangedEventToken);
}
if (SUCCEEDED(result))
{
return true;
}
return false;
}
void CoreWindowNativeWindow::unregisterForSizeChangeEvents()
{
if (mCoreWindow)
{
(void)mCoreWindow->remove_SizeChanged(mSizeChangedEventToken);
}
mSizeChangedEventToken.value = 0;
}
HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
{
if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0)
{
return E_INVALIDARG;
}
DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 };
swapChainDesc.Width = width;
swapChainDesc.Height = height;
swapChainDesc.Format = format;
swapChainDesc.Stereo = FALSE;
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER;
swapChainDesc.BufferCount = 2;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
*swapChain = nullptr;
ComPtr<IDXGISwapChain1> newSwapChain;
HRESULT result = factory->CreateSwapChainForCoreWindow(device, mCoreWindow.Get(), &swapChainDesc, nullptr, newSwapChain.ReleaseAndGetAddressOf());
if (SUCCEEDED(result))
{
#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
// Test if swapchain supports resize. On Windows Phone devices, this will return DXGI_ERROR_UNSUPPORTED. On
// other devices DXGI_ERROR_INVALID_CALL should be returned because the combination of flags passed
// (DXGI_SWAP_CHAIN_FLAG_NONPREROTATED | DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE) are invalid flag combinations.
if (newSwapChain->ResizeBuffers(swapChainDesc.BufferCount, swapChainDesc.Width, swapChainDesc.Height, swapChainDesc.Format, DXGI_SWAP_CHAIN_FLAG_NONPREROTATED | DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE) == DXGI_ERROR_UNSUPPORTED)
{
mSupportsSwapChainResize = false;
}
#endif // (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
result = newSwapChain.CopyTo(swapChain);
}
if (SUCCEEDED(result))
{
// If automatic swapchain resize behaviors have been disabled, then
// unregister for the resize change events.
if (mSupportsSwapChainResize == false)
{
unregisterForSizeChangeEvents();
}
}
return result;
}
HRESULT getCoreWindowSizeInPixels(const ComPtr<ABI::Windows::UI::Core::ICoreWindow>& coreWindow, RECT *windowSize)
{
ABI::Windows::Foundation::Rect bounds;
HRESULT result = coreWindow->get_Bounds(&bounds);
if (SUCCEEDED(result))
{
*windowSize = { 0, 0, ConvertDipsToPixels(bounds.Width), ConvertDipsToPixels(bounds.Height) };
}
return result;
}
static float GetLogicalDpi()
{
ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> displayProperties;
float dpi = 96.0f;
if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), displayProperties.GetAddressOf())))
{
if (SUCCEEDED(displayProperties->get_LogicalDpi(&dpi)))
{
return dpi;
}
}
return dpi;
}
long ConvertDipsToPixels(float dips)
{
static const float dipsPerInch = 96.0f;
return lround((dips * GetLogicalDpi() / dipsPerInch));
}
\ No newline at end of file
//
// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CoreWindowNativeWindow.h: NativeWindow for managing ICoreWindow native window types.
#ifndef COMMON_COREWINDOWNATIVEWINDOW_H_
#define COMMON_COREWINDOWNATIVEWINDOW_H_
#include "common/winrt/IInspectableNativeWindow.h"
#include <memory>
typedef ABI::Windows::Foundation::__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowSizeChangedEventArgs_t IWindowSizeChangedEventHandler;
long ConvertDipsToPixels(float dips);
class CoreWindowNativeWindow : public IInspectableNativeWindow, public std::enable_shared_from_this<CoreWindowNativeWindow>
{
public:
~CoreWindowNativeWindow();
bool initialize(EGLNativeWindowType window, IPropertySet *propertySet);
bool registerForSizeChangeEvents();
void unregisterForSizeChangeEvents();
HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain);
private:
ComPtr<ABI::Windows::UI::Core::ICoreWindow> mCoreWindow;
ComPtr<IMap<HSTRING, IInspectable*>> mPropertyMap;
};
[uuid(7F924F66-EBAE-40E5-A10B-B8F35E245190)]
class CoreWindowSizeChangedHandler :
public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, IWindowSizeChangedEventHandler>
{
public:
CoreWindowSizeChangedHandler() { }
HRESULT RuntimeClassInitialize(std::shared_ptr<IInspectableNativeWindow> host)
{
if (!host)
{
return E_INVALIDARG;
}
mHost = host;
return S_OK;
}
// IWindowSizeChangedEventHandler
IFACEMETHOD(Invoke)(ABI::Windows::UI::Core::ICoreWindow *sender, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *e)
{
std::shared_ptr<IInspectableNativeWindow> host = mHost.lock();
if (host)
{
ABI::Windows::Foundation::Size windowSize;
if (SUCCEEDED(e->get_Size(&windowSize)))
{
SIZE windowSizeInPixels = { ConvertDipsToPixels(windowSize.Width), ConvertDipsToPixels(windowSize.Height) };
host->setNewClientSize(windowSizeInPixels);
}
}
return S_OK;
}
private:
std::weak_ptr<IInspectableNativeWindow> mHost;
};
HRESULT getCoreWindowSizeInPixels(const ComPtr<ABI::Windows::UI::Core::ICoreWindow>& coreWindow, RECT *windowSize);
#endif // COMMON_COREWINDOWNATIVEWINDOW_H_
//
// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// iinspectablehost.cpp: NativeWindow base class for managing IInspectable native window types.
#include "common/winrt/CoreWindowNativeWindow.h"
namespace rx
{
NativeWindow::NativeWindow(EGLNativeWindowType window)
{
mWindow = window;
}
bool NativeWindow::initialize()
{
// If the native window type is a IPropertySet, extract the
// EGLNativeWindowType (IInspectable) and initialize the
// proper host with this IPropertySet.
ComPtr<ABI::Windows::Foundation::Collections::IPropertySet> propertySet;
ComPtr<IInspectable> eglNativeWindow;
if (isEGLConfiguredPropertySet(mWindow, &propertySet, &eglNativeWindow))
{
// A property set was found and the EGLNativeWindowType was
// retrieved. The mWindow member of the host to must be updated
// to use the EGLNativeWindowType specified in the property set.
// mWindow is treated as a raw pointer not an AddRef'd interface, so
// the old mWindow does not need a Release() before this assignment.
mWindow = eglNativeWindow.Get();
}
// If the native window is a ICoreWindow, initialize a CoreWindowNativeWindow
ComPtr<ABI::Windows::UI::Core::ICoreWindow> coreWindow;
if (isCoreWindow(mWindow, &coreWindow))
{
mImpl = std::make_shared<CoreWindowNativeWindow>();
if (mImpl)
{
return mImpl->initialize(mWindow, propertySet.Get());
}
}
else
{
ERR("Invalid IInspectable EGLNativeWindowType detected. Valid IInspectables include ICoreWindow and IPropertySet");
}
return false;
}
bool NativeWindow::getClientRect(RECT *rect)
{
if (mImpl)
{
return mImpl->getClientRect(rect);
}
return false;
}
bool NativeWindow::isIconic()
{
return false;
}
HRESULT NativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
{
if (mImpl)
{
return mImpl->createSwapChain(device, factory, format, width, height, swapChain);
}
return E_UNEXPECTED;
}
}
bool isCoreWindow(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Core::ICoreWindow> *coreWindow)
{
if (!window)
{
return false;
}
ComPtr<IInspectable> win = window;
ComPtr<ABI::Windows::UI::Core::ICoreWindow> coreWin;
if (SUCCEEDED(win.As(&coreWin)))
{
if (coreWindow != nullptr)
{
*coreWindow = coreWin.Detach();
}
return true;
}
return false;
}
bool isEGLConfiguredPropertySet(EGLNativeWindowType window, ABI::Windows::Foundation::Collections::IPropertySet **propertySet, IInspectable **eglNativeWindow)
{
if (!window)
{
return false;
}
ComPtr<IInspectable> props = window;
ComPtr<IPropertySet> propSet;
ComPtr<IInspectable> nativeWindow;
ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> propMap;
boolean hasEglNativeWindowPropertyKey = false;
HRESULT result = props.As(&propSet);
if (SUCCEEDED(result))
{
result = propSet.As(&propMap);
}
// Look for the presence of the EGLNativeWindowType in the property set
if (SUCCEEDED(result))
{
result = propMap->HasKey(HStringReference(EGLNativeWindowTypeProperty).Get(), &hasEglNativeWindowPropertyKey);
}
// If the IPropertySet does not contain the required EglNativeWindowType key, the property set is
// considered invalid.
if (SUCCEEDED(result) && !hasEglNativeWindowPropertyKey)
{
ERR("Could not find EGLNativeWindowTypeProperty in IPropertySet. Valid EGLNativeWindowTypeProperty values include ICoreWindow");
return false;
}
// The EglNativeWindowType property exists, so retreive the IInspectable that represents the EGLNativeWindowType
if (SUCCEEDED(result) && hasEglNativeWindowPropertyKey)
{
result = propMap->Lookup(HStringReference(EGLNativeWindowTypeProperty).Get(), &nativeWindow);
}
if (SUCCEEDED(result))
{
if (propertySet != nullptr)
{
result = propSet.CopyTo(propertySet);
}
}
if (SUCCEEDED(result))
{
if (eglNativeWindow != nullptr)
{
result = nativeWindow.CopyTo(eglNativeWindow);
}
}
if (SUCCEEDED(result))
{
return true;
}
return false;
}
// A Valid EGLNativeWindowType IInspectable can only be:
//
// ICoreWindow
// IPropertySet
//
// Anything else will be rejected as an invalid IInspectable.
bool isValidEGLNativeWindowType(EGLNativeWindowType window)
{
return isCoreWindow(window) || isEGLConfiguredPropertySet(window);
}
// Attempts to read an optional SIZE property value that is assumed to be in the form of
// an ABI::Windows::Foundation::Size. This function validates the Size value before returning
// it to the caller.
//
// Possible return values are:
// S_OK, valueExists == true - optional SIZE value was successfully retrieved and validated
// S_OK, valueExists == false - optional SIZE value was not found
// E_INVALIDARG, valueExists = false - optional SIZE value was malformed in the property set.
// * Incorrect property type ( must be PropertyType_Size)
// * Invalid property value (width/height must be > 0)
// Additional errors may be returned from IMap or IPropertyValue
//
HRESULT getOptionalSizePropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>>& propertyMap, const wchar_t *propertyName, SIZE *value, bool *valueExists)
{
if (!propertyMap || !propertyName || !value || !valueExists)
{
return false;
}
// Assume that the value does not exist
*valueExists = false;
*value = { 0, 0 };
ComPtr<ABI::Windows::Foundation::IPropertyValue> propertyValue;
ABI::Windows::Foundation::PropertyType propertyType = ABI::Windows::Foundation::PropertyType::PropertyType_Empty;
Size sizeValue = { 0, 0 };
boolean hasKey = false;
HRESULT result = propertyMap->HasKey(HStringReference(propertyName).Get(), &hasKey);
if (SUCCEEDED(result) && !hasKey)
{
// Value does not exist, so return S_OK and set the exists parameter to false to indicate
// that a the optional property does not exist.
*valueExists = false;
return S_OK;
}
if (SUCCEEDED(result))
{
result = propertyMap->Lookup(HStringReference(propertyName).Get(), &propertyValue);
}
if (SUCCEEDED(result))
{
result = propertyValue->get_Type(&propertyType);
}
// Check if the expected Size property is of PropertyType_Size type.
if (SUCCEEDED(result) && propertyType == ABI::Windows::Foundation::PropertyType::PropertyType_Size)
{
if (SUCCEEDED(propertyValue->GetSize(&sizeValue)) && (sizeValue.Width > 0 && sizeValue.Height > 0))
{
// A valid property value exists
*value = { static_cast<long>(sizeValue.Width), static_cast<long>(sizeValue.Height) };
*valueExists = true;
result = S_OK;
}
else
{
// An invalid Size property was detected. Width/Height values must > 0
result = E_INVALIDARG;
}
}
else
{
// An invalid property type was detected. Size property must be of PropertyType_Size
result = E_INVALIDARG;
}
return result;
}
\ No newline at end of file
//
// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// IInspectableNativeWindow.h: Host specific implementation interface for
// managing IInspectable native window types.
#ifndef COMMON_IINSPECTABLENATIVEWINDOW_H_
#define COMMON_IINSPECTABLENATIVEWINDOW_H_
#include "common/platform.h"
#include "common/NativeWindow.h"
#include "angle_windowsstore.h"
#include <windows.ui.xaml.h>
#include <windows.ui.xaml.media.dxinterop.h>
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::Foundation::Collections;
class IInspectableNativeWindow
{
public:
virtual bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) = 0;
virtual HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain) = 0;
virtual bool registerForSizeChangeEvents() = 0;
virtual void unregisterForSizeChangeEvents() = 0;
virtual HRESULT scaleSwapChain(const SIZE& newSize) { return S_OK; }
IInspectableNativeWindow() :
mSupportsSwapChainResize(true),
mRequiresSwapChainScaling(false),
mClientRectChanged(false),
mClientRect({0,0,0,0}),
mNewClientRect({0,0,0,0})
{
mSizeChangedEventToken.value = 0;
}
virtual ~IInspectableNativeWindow(){}
bool getClientRect(RECT *rect)
{
if (mClientRectChanged && mSupportsSwapChainResize)
{
mClientRect = mNewClientRect;
}
*rect = mClientRect;
return true;
}
void setNewClientSize(const SIZE &newSize)
{
if (mSupportsSwapChainResize && !mRequiresSwapChainScaling)
{
mNewClientRect = { 0, 0, newSize.cx, newSize.cy };
mClientRectChanged = true;
}
if (mRequiresSwapChainScaling)
{
scaleSwapChain(newSize);
}
}
protected:
bool mSupportsSwapChainResize;
bool mRequiresSwapChainScaling;
RECT mClientRect;
RECT mNewClientRect;
bool mClientRectChanged;
EventRegistrationToken mSizeChangedEventToken;
};
bool isCoreWindow(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Core::ICoreWindow> *coreWindow = nullptr);
bool isEGLConfiguredPropertySet(EGLNativeWindowType window, ABI::Windows::Foundation::Collections::IPropertySet **propertySet = nullptr, IInspectable **inspectable = nullptr);
HRESULT getOptionalSizePropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>>& propertyMap, const wchar_t *propertyName, SIZE *value, bool *valueExists);
#endif // COMMON_IINSPECTABLENATIVEWINDOW_H_
......@@ -205,6 +205,17 @@
'type': 'static_library',
'includes': [ '../build/common_defines.gypi', ],
'sources': [ '<@(angle_preprocessor_sources)', ],
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
},
{
'target_name': 'translator_lib',
......@@ -233,6 +244,17 @@
'AdditionalOptions': ['/ignore:4221']
},
},
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
},
{
......@@ -254,6 +276,17 @@
'compiler/translator/ShaderLang.cpp',
'compiler/translator/ShaderVars.cpp'
],
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
},
{
......@@ -282,6 +315,17 @@
'compiler/translator/ShaderLang.cpp',
'compiler/translator/ShaderVars.cpp'
],
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
},
],
}
......@@ -38,7 +38,6 @@
'common/utilities.cpp',
'common/utilities.h',
'common/version.h',
'common/win32/NativeWindow.cpp',
'libEGL/Config.cpp',
'libEGL/Config.h',
'libEGL/Display.cpp',
......@@ -52,6 +51,17 @@
'libEGL/main.h',
'libEGL/resource.h',
],
'angle_libegl_win32_sources':
[
'common/win32/NativeWindow.cpp',
],
'angle_libegl_winrt_sources':
[
'common/winrt/CoreWindowNativeWindow.cpp',
'common/winrt/CoreWindowNativeWindow.h',
'common/winrt/IInspectableNativeWindow.cpp',
'common/winrt/IInspectableNativeWindow.h',
],
},
# Everything below this is duplicated in the GN build. If you change
# anything also change angle/BUILD.gn
......@@ -97,15 +107,54 @@
'ANGLE_ENABLE_D3D11',
],
}],
['angle_build_winrt==0',
{
'sources':
[
'<@(angle_libegl_win32_sources)',
],
}],
['angle_build_winrt==1',
{
'defines':
[
'NTDDI_VERSION=NTDDI_WINBLUE',
],
'sources':
[
'<@(angle_libegl_winrt_sources)',
],
'msvs_enable_winrt' : '1',
'msvs_requires_importlibrary' : '1',
'msvs_settings':
{
'VCLinkerTool':
{
'EnableCOMDATFolding': '1',
'OptimizeReferences': '1',
}
},
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
'includes': [ '../build/common_defines.gypi', ],
'msvs_settings':
{
'VCLinkerTool':
{
'AdditionalDependencies':
'conditions':
[
'd3d9.lib',
['angle_build_winrt==0',
{
'AdditionalDependencies':
[
'd3d9.lib',
],
}],
],
},
},
......
......@@ -239,7 +239,7 @@ EGLNativeWindowType Surface::getWindowHandle()
return mNativeWindow.getNativeWindow();
}
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
#define kSurfaceProperty _TEXT("Egl::SurfaceOwner")
#define kParentWndProc _TEXT("Egl::SurfaceParentWndProc")
......@@ -256,9 +256,11 @@ static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam
WNDPROC prevWndFunc = reinterpret_cast<WNDPROC >(GetProp(hwnd, kParentWndProc));
return CallWindowProc(prevWndFunc, hwnd, message, wparam, lparam);
}
#endif
void Surface::subclassWindow()
{
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
HWND window = mNativeWindow.getNativeWindow();
if (!window)
{
......@@ -283,6 +285,7 @@ void Surface::subclassWindow()
SetProp(window, kSurfaceProperty, reinterpret_cast<HANDLE>(this));
SetProp(window, kParentWndProc, reinterpret_cast<HANDLE>(oldWndProc));
mWindowSubclassed = true;
#endif
}
void Surface::unsubclassWindow()
......@@ -292,6 +295,7 @@ void Surface::unsubclassWindow()
return;
}
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
HWND window = mNativeWindow.getNativeWindow();
if (!window)
{
......@@ -315,6 +319,7 @@ void Surface::unsubclassWindow()
RemoveProp(window, kSurfaceProperty);
RemoveProp(window, kParentWndProc);
#endif
mWindowSubclassed = false;
}
......
......@@ -120,11 +120,13 @@ EGLDisplay __stdcall eglGetPlatformDisplayEXT(EGLenum platform, void *native_dis
EGLNativeDisplayType displayId = static_cast<EGLNativeDisplayType>(native_display);
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
// Validate the display device context
if (WindowFromDC(displayId) == NULL)
{
return egl::success(EGL_NO_DISPLAY);
}
#endif
EGLint requestedDisplayType = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
if (attrib_list)
......
......@@ -143,6 +143,13 @@
# TODO(kbr): port NativeWindow to other EGL platforms.
'common/win32/NativeWindow.cpp',
],
'angle_libangle_winrt_sources':
[
'common/winrt/CoreWindowNativeWindow.cpp',
'common/winrt/CoreWindowNativeWindow.h',
'common/winrt/IInspectableNativeWindow.cpp',
'common/winrt/IInspectableNativeWindow.h',
],
'angle_d3d_shared_sources':
[
'libGLESv2/renderer/d3d/BufferD3D.cpp',
......@@ -399,15 +406,30 @@
{
'VCLinkerTool':
{
'AdditionalDependencies':
'conditions':
[
'dxguid.lib',
]
['angle_build_winrt==0',
{
'AdditionalDependencies':
[
'dxguid.lib',
],
}],
['angle_build_winrt==1',
{
'AdditionalDependencies':
[
'dxguid.lib',
'd3d11.lib',
'd3dcompiler.lib',
],
}],
],
}
},
},
}],
['OS=="win"',
['angle_build_winrt==0',
{
'sources':
[
......@@ -417,55 +439,119 @@
[
'copy_compiler_dll'
],
'configurations':
}],
['angle_build_winrt==1',
{
'sources':
[
'<@(angle_libangle_winrt_sources)',
],
'defines':
[
'NTDDI_VERSION=NTDDI_WINBLUE',
],
'msvs_enable_winrt' : '1',
'msvs_requires_importlibrary' : 'true',
'msvs_settings':
{
'Debug':
'VCLinkerTool':
{
'defines':
[
'ANGLE_ENABLE_PERF',
'ANGLE_GENERATE_SHADER_DEBUG_INFO'
],
'msvs_settings':
{
'VCLinkerTool':
{
'AdditionalDependencies':
[
'd3d9.lib',
]
}
},
},
'EnableCOMDATFolding': '1',
'OptimizeReferences': '1',
}
},
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
},
{
'target_name': 'libGLESv2',
'type': 'shared_library',
'dependencies': [ 'libANGLE' ],
'includes': [ '../build/common_defines.gypi', ],
'sources':
[
'libGLESv2/libGLESv2.cpp',
'libGLESv2/libGLESv2.def',
'libGLESv2/libGLESv2.rc',
],
'configurations':
{
'Debug':
{
'defines':
[
'ANGLE_ENABLE_PERF',
'ANGLE_GENERATE_SHADER_DEBUG_INFO'
],
'msvs_settings':
{
'VCLinkerTool':
{
'AdditionalDependencies':
[
'd3d9.lib',
]
}
},
},
},
},
{
'target_name': 'libGLESv2_static',
'type': 'static_library',
# make sure we depend on commit_id as a hard dependency, otherwise
# we will try to build the static_lib in parallel
'dependencies': [ 'libANGLE', 'commit_id' ],
'includes': [ '../build/common_defines.gypi', ],
'sources':
[
'libGLESv2/libGLESv2.cpp',
'libGLESv2/libGLESv2.rc',
],
{
'target_name': 'libGLESv2',
'type': 'shared_library',
'dependencies': [ 'libANGLE' ],
'includes': [ '../build/common_defines.gypi', ],
'sources':
[
'libGLESv2/libGLESv2.cpp',
'libGLESv2/libGLESv2.def',
'libGLESv2/libGLESv2.rc',
],
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'msvs_requires_importlibrary' : 'true',
'msvs_settings':
{
'VCLinkerTool':
{
'EnableCOMDATFolding': '1',
'OptimizeReferences': '1',
}
},
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
},
{
'target_name': 'libGLESv2_static',
'type': 'static_library',
# make sure we depend on commit_id as a hard dependency, otherwise
# we will try to build the static_lib in parallel
'dependencies': [ 'libANGLE', 'commit_id' ],
'includes': [ '../build/common_defines.gypi', ],
'sources':
[
'libGLESv2/libGLESv2.cpp',
'libGLESv2/libGLESv2.rc',
],
'conditions':
[
['angle_build_winrt==1',
{
'msvs_enable_winrt' : '1',
'msvs_requires_importlibrary' : 'true',
'msvs_settings':
{
'VCLinkerTool':
{
'EnableCOMDATFolding': '1',
'OptimizeReferences': '1',
}
},
],
}],
['angle_build_winphone==1',
{
'msvs_enable_winphone' : '1',
}],
],
},
],
}
......@@ -11,6 +11,7 @@
#include "libGLESv2/renderer/FenceImpl.h"
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/main.h"
#include "common/utilities.h"
#include "angle_gl.h"
......
......@@ -42,6 +42,7 @@ HLSLCompiler::~HLSLCompiler()
bool HLSLCompiler::initialize()
{
TRACE_EVENT0("gpu", "initializeCompiler");
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
#if defined(ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES)
// Find a D3DCompiler module that had already been loaded based on a predefined list of versions.
static const char *d3dCompilerNames[] = ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES;
......@@ -69,6 +70,12 @@ bool HLSLCompiler::initialize()
mD3DCompileFunc = reinterpret_cast<pD3DCompile>(GetProcAddress(mD3DCompilerModule, "D3DCompile"));
ASSERT(mD3DCompileFunc);
#else
// D3D Shader compiler is linked already into this module, so the export
// can be directly assigned.
mD3DCompilerModule = NULL;
mD3DCompileFunc = reinterpret_cast<pD3DCompile>(D3DCompile);
#endif
mD3DDisassembleFunc = reinterpret_cast<pD3DDisassemble>(GetProcAddress(mD3DCompilerModule, "D3DDisassemble"));
ASSERT(mD3DDisassembleFunc);
......@@ -91,7 +98,10 @@ gl::Error HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string
const std::vector<CompileConfig> &configs, const D3D_SHADER_MACRO *overrideMacros,
ID3DBlob **outCompiledBlob, std::string *outDebugInfo) const
{
ASSERT(mD3DCompilerModule && mD3DCompileFunc);
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
ASSERT(mD3DCompilerModule);
#endif
ASSERT(mD3DCompileFunc);
if (gl::perfActive())
{
......
......@@ -10,6 +10,7 @@
#include "libGLESv2/renderer/d3d/d3d11/Renderer11.h"
#include "libGLESv2/renderer/d3d/d3d11/renderer11_utils.h"
#include "libGLESv2/main.h"
#include "common/utilities.h"
#include <GLES2/gl2ext.h>
......
......@@ -40,6 +40,7 @@
#include "libEGL/Display.h"
#include "common/utilities.h"
#include "common/tls.h"
#include <EGL/eglext.h>
......@@ -167,6 +168,7 @@ EGLint Renderer11::initialize()
return EGL_NOT_INITIALIZED;
}
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
mDxgiModule = LoadLibrary(TEXT("dxgi.dll"));
mD3d11Module = LoadLibrary(TEXT("d3d11.dll"));
......@@ -185,6 +187,7 @@ EGLint Renderer11::initialize()
ERR("Could not retrieve D3D11CreateDevice address - aborting!\n");
return EGL_NOT_INITIALIZED;
}
#endif
D3D_FEATURE_LEVEL featureLevels[] =
{
......@@ -239,6 +242,7 @@ EGLint Renderer11::initialize()
}
}
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
#if !ANGLE_SKIP_DXGI_1_2_CHECK
// In order to create a swap chain for an HWND owned by another process, DXGI 1.2 is required.
// The easiest way to check is to query for a IDXGIDevice2.
......@@ -268,6 +272,7 @@ EGLint Renderer11::initialize()
SafeRelease(dxgiDevice2);
}
#endif
#endif
IDXGIDevice *dxgiDevice = NULL;
result = mDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice);
......
......@@ -181,7 +181,7 @@ class Renderer11 : public Renderer
// D3D11-renderer specific methods
ID3D11Device *getDevice() { return mDevice; }
ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; };
IDXGIFactory *getDxgiFactory() { return mDxgiFactory; };
DXGIFactory *getDxgiFactory() { return mDxgiFactory; };
Blit11 *getBlitter() { return mBlit; }
......@@ -343,7 +343,7 @@ class Renderer11 : public Renderer
IDXGIAdapter *mDxgiAdapter;
DXGI_ADAPTER_DESC mAdapterDescription;
char mDescription[128];
IDXGIFactory *mDxgiFactory;
DXGIFactory *mDxgiFactory;
};
}
......
......@@ -332,8 +332,10 @@ EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight)
SafeRelease(mBackBufferRTView);
// Resize swap chain
DXGI_SWAP_CHAIN_DESC desc;
mSwapChain->GetDesc(&desc);
const d3d11::TextureFormat &backbufferFormatInfo = d3d11::GetTextureFormatInfo(mBackBufferFormat);
HRESULT result = mSwapChain->ResizeBuffers(1, backbufferWidth, backbufferHeight, backbufferFormatInfo.texFormat, 0);
HRESULT result = mSwapChain->ResizeBuffers(desc.BufferCount, backbufferWidth, backbufferHeight, backbufferFormatInfo.texFormat, 0);
if (FAILED(result))
{
......
......@@ -56,7 +56,7 @@ class SwapChain11 : public SwapChain
unsigned int mSwapInterval;
bool mPassThroughResourcesInit;
IDXGISwapChain *mSwapChain;
DXGISwapChain *mSwapChain;
ID3D11Texture2D *mBackBufferTexture;
ID3D11RenderTargetView *mBackBufferRTView;
......
......@@ -17,6 +17,12 @@ void LoadA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
{
#if defined(_M_ARM)
// Ensure that this function is reported as not implemented for ARM builds because
// the instructions below are not present for that architecture.
UNIMPLEMENTED();
return;
#else
__m128i zeroWide = _mm_setzero_si128();
for (size_t z = 0; z < depth; z++)
......@@ -54,12 +60,19 @@ void LoadA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
}
}
}
#endif
}
void LoadRGBA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
{
#if defined(_M_ARM)
// Ensure that this function is reported as not implemented for ARM builds because
// the instructions below are not present for that architecture.
UNIMPLEMENTED();
return;
#else
__m128i brMask = _mm_set1_epi32(0x00ff00ff);
for (size_t z = 0; z < depth; z++)
......@@ -99,6 +112,7 @@ void LoadRGBA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
}
}
}
#endif
}
}
......@@ -24,6 +24,7 @@
*/
#include <windows.h>
#include "common/platform.h"
#if _WIN32_WINNT_WINBLUE
#include <versionhelpers.h>
......@@ -52,7 +53,11 @@ bool isWindowsVistaOrGreater()
if (!initialized) {
initialized = true;
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
cachedIsWindowsVistaOrGreater = true;
#else
cachedIsWindowsVistaOrGreater = IsWindowsVistaOrGreater();
#endif
}
return cachedIsWindowsVistaOrGreater;
}
......
......@@ -5,9 +5,7 @@
{
'sources':
[
'<!@(python <(angle_path)/enumerate_files.py \
-dirs <(angle_path)/tests/angle_implementation_unit_tests \
-types *.cpp *.h \
-excludes <(angle_path)/tests/angle_implementation_unit_tests/angle_implementation_unit_tests_main.cpp)'
'ImageIndexIterator_unittest.cpp',
'TransformFeedback_unittest.cpp'
],
}
......@@ -88,7 +88,6 @@
'preprocessor_tests/preprocessor_test_main.cpp',
],
},
{
'target_name': 'compiler_tests',
'type': 'executable',
......@@ -112,6 +111,22 @@
[
'compiler_tests/compiler_test_main.cpp',
],
'msvs_settings':
{
'VCLinkerTool':
{
'conditions':
[
['angle_build_winrt==1',
{
'AdditionalDependencies':
[
'runtimeobject.lib',
],
}],
],
},
},
},
],
......@@ -220,6 +235,30 @@
[
'angle_implementation_unit_tests/angle_implementation_unit_tests_main.cpp',
],
'conditions':
[
['angle_build_winrt==1',
{
'sources':
[
'angle_implementation_unit_tests/CoreWindowNativeWindow_unittest.cpp',
],
'defines':
[
'ANGLE_ENABLE_D3D11',
],
'msvs_settings':
{
'VCLinkerTool':
{
'AdditionalDependencies':
[
'runtimeobject.lib',
],
},
},
}],
],
},
],
'conditions':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment