├── LICENSE.txt ├── README.md ├── ags_lib ├── LICENSE.txt ├── doc │ ├── README.txt │ └── amd_ags.chm ├── hlsl │ ├── ags_shader_intrinsics_dx11.hlsl │ └── ags_shader_intrinsics_dx12.hlsl ├── inc │ └── amd_ags.h └── lib │ ├── amd_ags_x64.dll │ ├── amd_ags_x64.lib │ ├── amd_ags_x64_2017_MD.lib │ ├── amd_ags_x64_2017_MDd.lib │ ├── amd_ags_x64_2017_MT.lib │ ├── amd_ags_x64_2017_MTd.lib │ ├── amd_ags_x64_2019_MD.lib │ ├── amd_ags_x64_2019_MDd.lib │ ├── amd_ags_x64_2019_MT.lib │ ├── amd_ags_x64_2019_MTd.lib │ ├── amd_ags_x64_2022_MD.lib │ ├── amd_ags_x64_2022_MDd.lib │ ├── amd_ags_x64_2022_MT.lib │ ├── amd_ags_x64_2022_MTd.lib │ ├── amd_ags_x86.dll │ ├── amd_ags_x86.lib │ ├── amd_ags_x86_2017_MD.lib │ ├── amd_ags_x86_2017_MDd.lib │ ├── amd_ags_x86_2017_MT.lib │ ├── amd_ags_x86_2017_MTd.lib │ ├── amd_ags_x86_2019_MD.lib │ ├── amd_ags_x86_2019_MDd.lib │ ├── amd_ags_x86_2019_MT.lib │ ├── amd_ags_x86_2019_MTd.lib │ ├── amd_ags_x86_2022_MD.lib │ ├── amd_ags_x86_2022_MDd.lib │ ├── amd_ags_x86_2022_MT.lib │ └── amd_ags_x86_2022_MTd.lib ├── ags_sample ├── CMakeLists.txt ├── build │ └── GenerateSolutions.bat └── src │ └── AGSSample.cpp ├── crossfire_sample ├── CMakeLists.txt ├── Readme.html ├── build │ └── GenerateSolutions.bat ├── media │ └── cfx-api.svg └── src │ ├── CFXAPISample.cpp │ ├── CFXAPISample.h │ ├── Shaders │ └── shaders.hlsl │ ├── Window.cpp │ └── Window.h ├── extensions_sample_dx12 ├── CMakeLists.txt ├── build │ └── GenerateSolutions.bat └── src │ ├── D3D12Sample.cpp │ ├── D3D12Sample.h │ ├── ExtensionsSample12.cpp │ ├── ExtensionsSample12.h │ ├── Main.cpp │ ├── Window.cpp │ ├── Window.h │ ├── d3dx12.h │ └── shaders.hlsl └── eyefinity_sample ├── CMakeLists.txt ├── build └── GenerateSolutions.bat ├── dxut ├── Core │ ├── DDSTextureLoader.cpp │ ├── DDSTextureLoader.h │ ├── DXUT.cpp │ ├── DXUT.h │ ├── DXUTDevice11.cpp │ ├── DXUTDevice11.h │ ├── DXUT_2013.vcxproj │ ├── DXUT_2015.vcxproj │ ├── DXUT_2017.vcxproj │ ├── DXUT_2019.vcxproj │ ├── DXUTmisc.cpp │ ├── DXUTmisc.h │ ├── ScreenGrab.cpp │ ├── ScreenGrab.h │ ├── WICTextureLoader.cpp │ ├── WICTextureLoader.h │ ├── Windows10SDKVS13_x64.props │ ├── Windows81SDKVS12_x64.props │ ├── Windows81SDK_x64.props │ ├── Windows8SDK_x64.props │ ├── dxerr.cpp │ └── dxerr.h ├── MIT.txt ├── Optional │ ├── DXUTLockFreePipe.h │ ├── DXUTOpt_2013.vcxproj │ ├── DXUTOpt_2015.vcxproj │ ├── DXUTOpt_2017.vcxproj │ ├── DXUTOpt_2019.vcxproj │ ├── DXUTcamera.cpp │ ├── DXUTcamera.h │ ├── DXUTgui.cpp │ ├── DXUTgui.h │ ├── DXUTguiIME.cpp │ ├── DXUTguiIME.h │ ├── DXUTres.cpp │ ├── DXUTres.h │ ├── DXUTsettingsdlg.cpp │ ├── DXUTsettingsdlg.h │ ├── ImeUi.cpp │ ├── ImeUi.h │ ├── SDKmesh.cpp │ ├── SDKmesh.h │ ├── SDKmisc.cpp │ ├── SDKmisc.h │ ├── Windows10SDKVS13_x64.props │ ├── Windows81SDKVS12_x64.props │ ├── Windows81SDK_x64.props │ ├── Windows8SDK_x64.props │ └── directx.ico └── ReadMe.txt ├── media ├── amd │ └── AMD.ico ├── microscopecity │ ├── MIT.txt │ ├── city.dds │ ├── column.dds │ ├── column.sdkmesh │ ├── occcity.sdkmesh │ ├── occluder.sdkmesh │ ├── scanner.dds │ └── scanner.sdkmesh ├── readme.txt └── ui │ ├── Font.dds │ ├── MIT.txt │ └── dxutcontrols.dds └── src ├── EyefinitySample.cpp ├── ResourceFiles ├── EyefinitySample.rc ├── dpiaware.manifest └── resource.h └── Shaders ├── EyefinitySample.hlsl └── Line.hlsl /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /ags_lib/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /ags_lib/doc/README.txt: -------------------------------------------------------------------------------- 1 | Documentation can be found online here: 2 | http://gpuopen-librariesandsdks.github.io/ags/ 3 | 4 | You can also find a chm file in the doc directory. 5 | 6 | If the content is blank when trying to view the chm file, 7 | you may need to unblock it: 8 | 1. Right-click on the .chm file and select "Properties". 9 | 2. In the resulting "Properties" dialog, click the "Unblock" 10 | button near the bottom of the "General" tab, and then click OK. 11 | -------------------------------------------------------------------------------- /ags_lib/doc/amd_ags.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/doc/amd_ags.chm -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64.dll -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64_2017_MD.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64_2017_MD.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64_2017_MDd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64_2017_MDd.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64_2017_MT.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64_2017_MT.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64_2017_MTd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64_2017_MTd.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64_2019_MD.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64_2019_MD.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64_2019_MDd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64_2019_MDd.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64_2019_MT.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64_2019_MT.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64_2019_MTd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64_2019_MTd.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64_2022_MD.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64_2022_MD.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64_2022_MDd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64_2022_MDd.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64_2022_MT.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64_2022_MT.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x64_2022_MTd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x64_2022_MTd.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86.dll -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86_2017_MD.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86_2017_MD.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86_2017_MDd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86_2017_MDd.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86_2017_MT.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86_2017_MT.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86_2017_MTd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86_2017_MTd.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86_2019_MD.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86_2019_MD.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86_2019_MDd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86_2019_MDd.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86_2019_MT.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86_2019_MT.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86_2019_MTd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86_2019_MTd.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86_2022_MD.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86_2022_MD.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86_2022_MDd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86_2022_MDd.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86_2022_MT.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86_2022_MT.lib -------------------------------------------------------------------------------- /ags_lib/lib/amd_ags_x86_2022_MTd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/lib/amd_ags_x86_2022_MTd.lib -------------------------------------------------------------------------------- /ags_sample/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | set(CMAKE_GENERATOR_PLATFORM x64) 3 | set(CMAKE_CONFIGURATION_TYPES Debug Release) 4 | 5 | if(AGS_INTERNAL_DEBUG) 6 | project(ags_sample_internal VERSION 6.3.0) 7 | else() 8 | project(ags_sample VERSION 6.3.0) 9 | endif() 10 | 11 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) 12 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 13 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 14 | 15 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/inc) 16 | 17 | set(AGS_SOURCES src/AGSSample.cpp) 18 | set(AGS_PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/inc/amd_ags.h) 19 | 20 | if(AGS_INTERNAL_DEBUG) 21 | add_subdirectory(../ags_lib ags_internal) 22 | add_executable(${PROJECT_NAME} ${AGS_SOURCES} ${AGS_PUBLIC_HEADER}) 23 | target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/lib/amd_ags_x64_2022_MDd.lib) 24 | 25 | else() 26 | add_library(amd_ags SHARED IMPORTED GLOBAL) 27 | set_property(TARGET amd_ags PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/lib/amd_ags_x64.lib) 28 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/lib/amd_ags_x64.dll DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 29 | 30 | add_executable(${PROJECT_NAME} ${AGS_SOURCES} ${AGS_PUBLIC_HEADER}) 31 | target_link_libraries(${PROJECT_NAME} LINK_PUBLIC amd_ags) 32 | endif() 33 | 34 | 35 | 36 | set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX d) 37 | set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME}) 38 | 39 | source_group("Source" FILES ${AGS_SOURCES}) 40 | source_group("Inc" FILES ${AGS_PUBLIC_HEADER}) 41 | -------------------------------------------------------------------------------- /ags_sample/build/GenerateSolutions.bat: -------------------------------------------------------------------------------- 1 | mkdir VS2022 2 | cd VS2022 3 | cmake ..\.. -G "Visual Studio 17 2022" -A x64 4 | cd .. -------------------------------------------------------------------------------- /ags_sample/src/AGSSample.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | //----------------------------------------------------------------------------- 24 | // File: AGSSample.cpp 25 | //----------------------------------------------------------------------------- 26 | 27 | #define WIN32_LEAN_AND_MEAN 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | 35 | 36 | const char* getVendorName( int vendorId ) 37 | { 38 | switch ( vendorId ) 39 | { 40 | case 0x1002: return "AMD"; 41 | case 0x8086: return "INTEL"; 42 | case 0x10DE: return "NVIDIA"; 43 | default: return "unknown"; 44 | } 45 | } 46 | 47 | 48 | void PrintDisplayInfo( const AGSGPUInfo& gpuInfo ) 49 | { 50 | for ( int gpuIndex = 0; gpuIndex < gpuInfo.numDevices; gpuIndex++ ) 51 | { 52 | const AGSDeviceInfo& device = gpuInfo.devices[ gpuIndex ]; 53 | 54 | printf( "\n---------- Device %d%s, %s\n", gpuIndex, device.isPrimaryDevice ? " [primary]" : "", device.adapterString ); 55 | 56 | printf( "Vendor id: 0x%04X (%s)\n", device.vendorId, getVendorName( device.vendorId ) ); 57 | printf( "Device id: 0x%04X\n", device.deviceId ); 58 | printf( "Revision id: 0x%04X\n\n", device.revisionId ); 59 | 60 | const char* asicFamily[] = 61 | { 62 | "unknown", 63 | "Pre GCN", 64 | "GCN Gen1", 65 | "GCN Gen2", 66 | "GCN Gen3", 67 | "GCN Gen4", 68 | "Vega", 69 | "RDNA", 70 | "RDNA2", 71 | "RDNA3", 72 | "RDNA4" 73 | }; 74 | 75 | static_assert( _countof( asicFamily ) == AGSAsicFamily_Count, "asic family table out of date" ); 76 | 77 | if ( device.vendorId == 0x1002 ) 78 | { 79 | char wgpInfo[ 256 ] = {}; 80 | if ( device.asicFamily >= AGSAsicFamily_RDNA ) 81 | { 82 | sprintf_s( wgpInfo, ", %d WGPs", device.numWGPs ); 83 | } 84 | 85 | printf( "Architecture: %s, %s%s%d CUs%s, %d ROPs\n", asicFamily[ device.asicFamily ], device.isAPU ? "(APU), " : "", device.isExternal ? "(External), " : "", device.numCUs, wgpInfo, device.numROPs ); 86 | printf( " core clock %d MHz, memory clock %d MHz\n", device.coreClock, device.memoryClock ); 87 | printf( " %.1f Tflops\n", device.teraFlops ); 88 | printf( "local memory: %d MBs (%.1f GB/s), shared memory: %d MBs\n\n", (int)( device.localMemoryInBytes / ( 1024 * 1024 ) ), (float)device.memoryBandwidth / 1024.0f, (int)( device.sharedMemoryInBytes / ( 1024 * 1024 ) ) ); 89 | } 90 | 91 | printf( "\n" ); 92 | 93 | if ( device.eyefinityEnabled ) 94 | { 95 | printf( "SLS grid is %d displays wide by %d displays tall\n", device.eyefinityGridWidth, device.eyefinityGridHeight ); 96 | printf( "SLS resolution is %d x %d pixels%s\n", device.eyefinityResolutionX, device.eyefinityResolutionY, device.eyefinityBezelCompensated ? ", bezel-compensated" : "" ); 97 | } 98 | else 99 | { 100 | printf( "Eyefinity not enabled on this device\n" ); 101 | } 102 | 103 | printf( "\n" ); 104 | 105 | for ( int i = 0; i < device.numDisplays; i++ ) 106 | { 107 | const AGSDisplayInfo& display = device.displays[ i ]; 108 | 109 | printf( "\t---------- Display %d %s----------------------------------------\n", i, display.isPrimaryDisplay ? "[primary]" : "---------" ); 110 | 111 | printf( "\tdevice name: %s\n", display.displayDeviceName ); 112 | printf( "\tmonitor name: %s\n\n", display.name ); 113 | 114 | printf( "\tMax resolution: %d x %d, %.1f Hz\n", display.maxResolutionX, display.maxResolutionY, display.maxRefreshRate ); 115 | printf( "\tCurrent resolution: %d x %d, Offset (%d, %d), %.1f Hz\n", display.currentResolution.width, display.currentResolution.height, display.currentResolution.offsetX, display.currentResolution.offsetY, display.currentRefreshRate ); 116 | printf( "\tVisible resolution: %d x %d, Offset (%d, %d)\n\n", display.visibleResolution.width, display.visibleResolution.height, display.visibleResolution.offsetX, display.visibleResolution.offsetY ); 117 | 118 | printf( "\tchromaticity red: %f, %f\n", display.chromaticityRedX, display.chromaticityRedY ); 119 | printf( "\tchromaticity green: %f, %f\n", display.chromaticityGreenX, display.chromaticityGreenY ); 120 | printf( "\tchromaticity blue: %f, %f\n", display.chromaticityBlueX, display.chromaticityBlueY ); 121 | printf( "\tchromaticity white point: %f, %f\n\n", display.chromaticityWhitePointX, display.chromaticityWhitePointY ); 122 | 123 | printf( "\tluminance: [min, max, avg] %f, %f, %f\n", display.minLuminance, display.maxLuminance, display.avgLuminance ); 124 | 125 | printf( "\tscreen reflectance diffuse %f\n", display.screenDiffuseReflectance ); 126 | printf( "\tscreen reflectance specular %f\n\n", display.screenSpecularReflectance ); 127 | 128 | if ( display.HDR10 ) 129 | printf( "\tHDR10 supported\n" ); 130 | 131 | if ( display.dolbyVision ) 132 | printf( "\tDolby Vision supported\n" ); 133 | 134 | if ( display.freesync ) 135 | printf( "\tFreesync supported\n" ); 136 | 137 | if ( display.freesyncHDR ) 138 | printf( "\tFreesync HDR supported\n" ); 139 | 140 | printf( "\n" ); 141 | 142 | if ( display.eyefinityInGroup ) 143 | { 144 | printf( "\tEyefinity Display [%s mode] %s\n", display.eyefinityInPortraitMode ? "portrait" : "landscape", display.eyefinityPreferredDisplay ? " (preferred display)" : "" ); 145 | 146 | printf( "\tGrid coord [%d, %d]\n", display.eyefinityGridCoordX, display.eyefinityGridCoordY ); 147 | } 148 | 149 | printf( "\tlogical display index: %d\n", display.logicalDisplayIndex ); 150 | printf( "\tADL adapter index: %d\n\n", display.adlAdapterIndex ); 151 | 152 | printf( "\n" ); 153 | } 154 | } 155 | } 156 | 157 | 158 | void testRadeonSoftwareVersion( const char* driver, unsigned int driverToCompareAgainst ) 159 | { 160 | AGSDriverVersionResult result = agsCheckDriverVersion( driver, driverToCompareAgainst ); 161 | 162 | int major = (driverToCompareAgainst & 0xFFC00000) >> 22; 163 | int minor = (driverToCompareAgainst & 0x003FF000) >> 12; 164 | int patch = (driverToCompareAgainst & 0x00000FFF); 165 | 166 | if ( result == AGS_SOFTWAREVERSIONCHECK_UNDEFINED ) 167 | { 168 | printf( "Driver check could not determine the driver version for %s\n", driver ); 169 | } 170 | else 171 | { 172 | printf( "Driver check shows the installed %s driver is %s the %d.%d.%d required version\n", driver, result == AGS_SOFTWAREVERSIONCHECK_OK ? "newer or the same as" : "older than", major, minor, patch ); 173 | } 174 | } 175 | 176 | 177 | int main(int , char**) 178 | { 179 | // Enable run-time memory check for debug builds. 180 | // (When _DEBUG is not defined, calls to _CrtSetDbgFlag are removed during preprocessing.) 181 | _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); 182 | 183 | int displayIndex = 0; 184 | DISPLAY_DEVICEA displayDevice = {}; 185 | displayDevice.cb = sizeof( displayDevice ); 186 | while ( EnumDisplayDevicesA( 0, displayIndex, &displayDevice, 0 ) ) 187 | { 188 | printf( "Display Device: %d: %s, %s %s%s\n", displayIndex, displayDevice.DeviceString, displayDevice.DeviceName, displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE ? "(primary)" : "", displayDevice.StateFlags & DISPLAY_DEVICE_ACTIVE ? "" : " [disabled]" ); 189 | displayIndex++; 190 | } 191 | 192 | AGSContext* agsContext = nullptr; 193 | AGSGPUInfo gpuInfo = {}; 194 | AGSConfiguration config = {}; 195 | if ( agsInitialize( AGS_CURRENT_VERSION, &config, &agsContext, &gpuInfo ) == AGS_SUCCESS ) 196 | { 197 | printf( "\nAGS Library initialized: v%d.%d.%d\n", AMD_AGS_VERSION_MAJOR, AMD_AGS_VERSION_MINOR, AMD_AGS_VERSION_PATCH ); 198 | printf( "-----------------------------------------------------------------\n" ); 199 | 200 | printf( "Radeon Software Version: %s\n", gpuInfo.radeonSoftwareVersion ); 201 | printf( "Driver Version: %s\n", gpuInfo.driverVersion ); 202 | printf( "-----------------------------------------------------------------\n" ); 203 | PrintDisplayInfo( gpuInfo ); 204 | printf( "-----------------------------------------------------------------\n" ); 205 | 206 | if ( 0 ) 207 | { 208 | // It should be noted that the Radeon Software Version can be empty, or just have the internal driver string in this field. 209 | // Therefore, it is recommended to use the internal driver version as a minimum driver version check. 210 | printf( "\n" ); 211 | testRadeonSoftwareVersion( gpuInfo.radeonSoftwareVersion, AGS_MAKE_VERSION( 24, 1, 1 ) ); 212 | testRadeonSoftwareVersion( "24.1.randombetadriver", AGS_MAKE_VERSION( 24, 1, 1 ) ); 213 | testRadeonSoftwareVersion( "24.1.123randomdriver", AGS_MAKE_VERSION( 24, 1, 1 ) ); 214 | testRadeonSoftwareVersion( "24.2.randomdriver", AGS_MAKE_VERSION( 24, 1, 1 ) ); 215 | testRadeonSoftwareVersion( "24.Q1", AGS_MAKE_VERSION( 24, 1, 1 ) ); 216 | testRadeonSoftwareVersion( "24.1.1", AGS_MAKE_VERSION( 24, 1, 1 ) ); 217 | testRadeonSoftwareVersion( "24.1.1", AGS_MAKE_VERSION( 23, 12, 1 ) ); 218 | testRadeonSoftwareVersion( "24.1.1", AGS_MAKE_VERSION( 25, 2, 4 ) ); 219 | printf( "\n" ); 220 | } 221 | 222 | if ( agsDeInitialize( agsContext ) != AGS_SUCCESS ) 223 | { 224 | printf( "Failed to cleanup AGS Library\n" ); 225 | } 226 | } 227 | else 228 | { 229 | printf( "Failed to initialize AGS Library\n" ); 230 | } 231 | 232 | printf( "\ndone\n" ); 233 | 234 | return 0; 235 | } 236 | 237 | -------------------------------------------------------------------------------- /crossfire_sample/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | set(CMAKE_GENERATOR_PLATFORM x64) 3 | set(CMAKE_CONFIGURATION_TYPES Debug Release) 4 | 5 | project(crossfire_sample VERSION 6.3.0) 6 | 7 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) 8 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 9 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 10 | 11 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/inc) 12 | 13 | file( GLOB AGS_SOURCES 14 | "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h" 15 | "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp" 16 | ) 17 | set(AGS_PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/inc/amd_ags.h) 18 | 19 | add_library(amd_ags SHARED IMPORTED GLOBAL) 20 | set_property(TARGET amd_ags PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/lib/amd_ags_x64.lib) 21 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/lib/amd_ags_x64.dll DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 22 | 23 | 24 | add_executable(${PROJECT_NAME} ${AGS_SOURCES} ${AGS_PUBLIC_HEADER}) 25 | target_link_libraries(${PROJECT_NAME} LINK_PUBLIC amd_ags D3D11 d3dcompiler) 26 | 27 | set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX d) 28 | set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME}) 29 | 30 | source_group("Source" FILES ${AGS_SOURCES}) 31 | source_group("Inc" FILES ${AGS_PUBLIC_HEADER}) 32 | 33 | -------------------------------------------------------------------------------- /crossfire_sample/Readme.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Readme 6 | 38 | 39 | 40 |
41 |

Crossfire API sample

42 |

Welcome to the Crossfire API sample, which shows how to use the Crossfire API.

43 |
44 |

Installation

45 |

Make sure a driver with Crossfire API support is installed and that Crossfire is enabled in Radeon Settings.

46 |

If Crossfire is not enabled in Radeon Settings, the extension will not load, and the AGS_DX11_EXTENSION_CROSSFIRE_API flag will not be set.

47 |
48 | 49 |
50 |

How does the sample work?

51 |

The sample has a texture/render-target (texture_) which is updated in every odd frame by rendering into it. On a Crossfire system running in alternate frame rendering (AFR), the rendering will happen only on one GPU and hence the application will exhibit flickering.

52 |

The Crossfire API solves this by allowing the developer to mark up the resource for copy.

53 |

The Crossfire API consists of three main entry points:

54 |
    55 |
  • NotifyResourceBeginAllAccess: Called before the first use of a resource. Ensures a copy is finished at this point.
  • 56 |
  • NotifyResourceEndWrites: Called after the last write access to a resource. After this point, the resource can be copied.
  • 57 |
  • NotifyResourceEndAllAccess: Called after the last read access to a resource. While a resource is being accessed, it cannot be updated from another GPU.
  • 58 |
59 |

Here's an illustration of the process. The boxes indicate frames, the orange area is the time between begin/end any access and the striped region is the time between begin and end write access. The left-hand side is the normal case, where the copy is initiated immediately after the write access has ended so it's available in time on the second GPU.

60 |

The right-hand side illustrates why the EndAnyAccess is needed. Without it, the copy would overwrite the resource while it's still in use on GPU 0. With EndAnyAccess, it can be properly delayed until GPU 0 is done using it.

61 |
62 | 63 |
64 |
65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /crossfire_sample/build/GenerateSolutions.bat: -------------------------------------------------------------------------------- 1 | mkdir VS2022 2 | cd VS2022 3 | cmake ..\.. -G "Visual Studio 17 2022" -A x64 4 | cd .. 5 | -------------------------------------------------------------------------------- /crossfire_sample/src/CFXAPISample.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | #ifndef AMD_AGS_CFX_API_SAMPLE_MAIN_H 23 | #define AMD_AGS_CFX_API_SAMPLE_MAIN_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "amd_ags.h" 31 | 32 | namespace AMD { 33 | class Window; 34 | 35 | /////////////////////////////////////////////////////////////////////////////// 36 | class CFXAPISample 37 | { 38 | private: 39 | public: 40 | 41 | CFXAPISample (); 42 | ~CFXAPISample (); 43 | 44 | void Run (const int frameCount); 45 | 46 | protected: 47 | IDXGISwapChain* m_swapChain = nullptr; 48 | ID3D11Device* m_device = nullptr; 49 | ID3D11DeviceContext* m_deviceContext = nullptr; 50 | ID3D11Texture2D* m_renderTarget = nullptr; 51 | ID3D11RenderTargetView* m_renderTargetView = nullptr; 52 | 53 | ID3D11InputLayout* m_inputLayout = nullptr; 54 | ID3D11PixelShader* m_pixelShader = nullptr; 55 | ID3D11VertexShader* m_vertexShader = nullptr; 56 | 57 | ID3D11DepthStencilState* m_depthStencilState = nullptr; 58 | 59 | ID3D11Texture2D* m_texture = nullptr; 60 | ID3D11ShaderResourceView* m_textureSRV = nullptr; 61 | ID3D11RenderTargetView* m_textureRTV = nullptr; 62 | 63 | ID3D11Texture2D* m_uploadTexture = nullptr; 64 | ID3D11ShaderResourceView* m_uploadTextureSRV = nullptr; 65 | 66 | private: 67 | void Initialize(); 68 | void Shutdown(); 69 | 70 | void PrepareRender(); 71 | void FinalizeRender(); 72 | 73 | void Render(); 74 | void Present(); 75 | void CreateDeviceAndSwapChain(); 76 | void CreateMeshBuffers(); 77 | 78 | std::unique_ptr m_window; 79 | 80 | ID3D11Buffer* m_vertexBuffer = nullptr; 81 | ID3D11Buffer* m_indexBuffer = nullptr; 82 | 83 | AGSContext* m_agsContext = nullptr; 84 | AGSGPUInfo m_agsGPUInfo = {}; 85 | bool m_cfxEnabled = false; 86 | }; 87 | } 88 | 89 | #endif -------------------------------------------------------------------------------- /crossfire_sample/src/Shaders/shaders.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | struct VertexShaderOutput 24 | { 25 | float4 position : SV_POSITION; 26 | float2 uv : TEXCOORD; 27 | }; 28 | 29 | VertexShaderOutput VS_main( 30 | float4 position : POSITION, 31 | float2 uv : TEXCOORD) 32 | { 33 | VertexShaderOutput output; 34 | 35 | output.position = position; 36 | output.uv = uv; 37 | 38 | return output; 39 | } 40 | 41 | Texture2D testTexture : register(t0); 42 | 43 | float4 PS_main (float4 position : SV_POSITION, 44 | float2 uv : TEXCOORD) : SV_TARGET 45 | { 46 | return testTexture.Load (int3(0,0,0)); 47 | } 48 | -------------------------------------------------------------------------------- /crossfire_sample/src/Window.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | #include "Window.h" 23 | 24 | namespace AMD { 25 | namespace { 26 | /////////////////////////////////////////////////////////////////////////////// 27 | LRESULT CALLBACK cfxWindowWndProc( 28 | HWND hwnd, 29 | UINT uMsg, 30 | WPARAM wParam, 31 | LPARAM lParam 32 | ) 33 | { 34 | auto ptr = ::GetWindowLongPtr(hwnd, GWLP_USERDATA); 35 | auto window = reinterpret_cast (ptr); 36 | 37 | switch (uMsg) { 38 | case WM_CLOSE: 39 | window->OnClose(); 40 | return 0; 41 | } 42 | 43 | return ::DefWindowProcA(hwnd, uMsg, wParam, lParam); 44 | } 45 | } 46 | 47 | /////////////////////////////////////////////////////////////////////////////// 48 | IWindow::IWindow () 49 | { 50 | } 51 | 52 | /////////////////////////////////////////////////////////////////////////////// 53 | IWindow::~IWindow() 54 | { 55 | } 56 | 57 | /////////////////////////////////////////////////////////////////////////////// 58 | int IWindow::GetWidth() const 59 | { 60 | return GetWidthImpl(); 61 | } 62 | 63 | /////////////////////////////////////////////////////////////////////////////// 64 | int IWindow::GetHeight() const 65 | { 66 | return GetHeightImpl(); 67 | } 68 | 69 | /////////////////////////////////////////////////////////////////////////////// 70 | Window::Window(const std::string& title, const int width, const int height) 71 | : isClosed_ (false) 72 | , width_ (width) 73 | , height_ (height) 74 | { 75 | DWORD style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; 76 | 77 | ::RECT rect; 78 | ::SetRect(&rect, 0, 0, width, height); 79 | ::AdjustWindowRect(&rect, style, FALSE); 80 | 81 | windowClass_.reset(new WindowClass("CFX API Test Window", cfxWindowWndProc)); 82 | 83 | // Create the main window. 84 | hwnd_ = CreateWindowA(windowClass_->GetName().c_str(), 85 | title.c_str (), 86 | style, CW_USEDEFAULT, CW_USEDEFAULT, 87 | rect.right - rect.left, rect.bottom - rect.top, (HWND)NULL, 88 | (HMENU)NULL, NULL, (LPVOID)NULL); 89 | 90 | ::SetWindowLongPtr(hwnd_, GWLP_USERDATA, reinterpret_cast (this)); 91 | 92 | // Show the window and paint its contents. 93 | ::ShowWindow(hwnd_, SW_SHOWDEFAULT); 94 | ::UpdateWindow(hwnd_); 95 | } 96 | 97 | /////////////////////////////////////////////////////////////////////////////// 98 | bool IWindow::IsClosed() const 99 | { 100 | return IsClosedImpl(); 101 | } 102 | 103 | /////////////////////////////////////////////////////////////////////////////// 104 | HWND Window::GetHWND () const 105 | { 106 | return hwnd_; 107 | } 108 | 109 | ///////////////////////////////////////////////////////////////////////// 110 | WindowClass::WindowClass(const std::string& name, ::WNDPROC procedure) 111 | : name_(name) 112 | { 113 | ::WNDCLASSA wc; 114 | 115 | // Register the window class for the main window. 116 | wc.style = 0; 117 | wc.lpfnWndProc = procedure; 118 | wc.cbClsExtra = 0; 119 | wc.cbWndExtra = 0; 120 | wc.hInstance = NULL; 121 | wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); 122 | wc.hCursor = LoadCursor(NULL, IDC_ARROW); 123 | wc.hbrBackground = NULL; 124 | wc.lpszMenuName = NULL; 125 | wc.lpszClassName = name_.c_str(); 126 | 127 | ::RegisterClassA(&wc); 128 | } 129 | 130 | ///////////////////////////////////////////////////////////////////////// 131 | const std::string& WindowClass::GetName() const 132 | { 133 | return name_; 134 | } 135 | 136 | ///////////////////////////////////////////////////////////////////////// 137 | WindowClass::~WindowClass() 138 | { 139 | ::UnregisterClassA(name_.c_str(), 140 | (HINSTANCE)::GetModuleHandle(NULL)); 141 | } 142 | } -------------------------------------------------------------------------------- /crossfire_sample/src/Window.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | #ifndef AMD_AGS_CFX_API_SAMPLE_WINDOW_H 23 | #define AMD_AGS_CFX_API_SAMPLE_WINDOW_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace AMD { 30 | /** 31 | * Encapsulate a window class. 32 | * 33 | * Calls ::RegisterClass() on create, and ::UnregisterClass() 34 | * on destruction. 35 | */ 36 | struct WindowClass final 37 | { 38 | public: 39 | WindowClass (const std::string& name, 40 | ::WNDPROC procedure = ::DefWindowProc); 41 | ~WindowClass (); 42 | 43 | const std::string& GetName () const; 44 | 45 | WindowClass (const WindowClass&); 46 | WindowClass& operator= (const WindowClass&); 47 | 48 | private: 49 | std::string name_; 50 | }; 51 | 52 | struct IWindow 53 | { 54 | public: 55 | IWindow (); 56 | IWindow (const IWindow&); 57 | IWindow& operator=(const IWindow&); 58 | 59 | virtual ~IWindow (); 60 | 61 | bool IsClosed () const; 62 | virtual void OnClose () = 0; 63 | 64 | int GetWidth () const; 65 | int GetHeight () const; 66 | 67 | private: 68 | virtual bool IsClosedImpl () const = 0; 69 | virtual int GetWidthImpl () const = 0; 70 | virtual int GetHeightImpl () const = 0; 71 | }; 72 | 73 | class Window : public IWindow 74 | { 75 | public: 76 | Window (const std::string& title, int width, int height); 77 | 78 | HWND GetHWND () const; 79 | 80 | void OnClose () override 81 | { 82 | isClosed_ = true; 83 | } 84 | 85 | private: 86 | bool IsClosedImpl () const override 87 | { 88 | return isClosed_; 89 | } 90 | 91 | int GetWidthImpl () const override 92 | { 93 | return width_; 94 | } 95 | 96 | int GetHeightImpl () const override 97 | { 98 | return height_; 99 | } 100 | 101 | std::unique_ptr windowClass_; 102 | HWND hwnd_; 103 | bool isClosed_; 104 | int width_; 105 | int height_; 106 | }; 107 | } 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /extensions_sample_dx12/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | set(CMAKE_GENERATOR_PLATFORM x64) 3 | set(CMAKE_CONFIGURATION_TYPES Debug Release) 4 | 5 | if(AGS_INTERNAL_DEBUG) 6 | project(ExtensionsSample12_internal VERSION 6.3.0) 7 | else() 8 | project(ExtensionsSample12 VERSION 6.3.0) 9 | endif() 10 | 11 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) 12 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 13 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 14 | 15 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/inc) 16 | 17 | file( GLOB EXTENSIONSSAMPLE12_SOURCES 18 | "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h" 19 | "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp" 20 | ) 21 | file( GLOB EXTENSIONSSAMPLE12_HLSL 22 | "${CMAKE_CURRENT_SOURCE_DIR}/src/*.hlsl" 23 | ) 24 | set(AGS_PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/inc/amd_ags.h) 25 | 26 | source_group("Source" FILES ${EXTENSIONSSAMPLE12_SOURCES}) 27 | source_group("Inc" FILES ${AGS_PUBLIC_HEADER}) 28 | source_group("Shaders" FILES ${EXTENSIONSSAMPLE12_HLSL}) 29 | 30 | set_source_files_properties(${EXTENSIONSSAMPLE12_HLSL} PROPERTIES VS_TOOL_OVERRIDE "Text") 31 | 32 | 33 | if(AGS_INTERNAL_DEBUG) 34 | add_subdirectory(../ags_lib ags_internal) 35 | add_executable(${PROJECT_NAME} WIN32 ${EXTENSIONSSAMPLE12_SOURCES} ${EXTENSIONSSAMPLE12_HLSL} ${AGS_PUBLIC_HEADER}) 36 | target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/lib/amd_ags_x64_2022_MDd.lib d3d12 dxgi d3dcompiler dxguid) 37 | 38 | else() 39 | add_library(amd_ags SHARED IMPORTED GLOBAL) 40 | set_property(TARGET amd_ags PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/lib/amd_ags_x64.lib) 41 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/lib/amd_ags_x64.dll DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 42 | 43 | add_executable(${PROJECT_NAME} WIN32 ${EXTENSIONSSAMPLE12_SOURCES} ${EXTENSIONSSAMPLE12_HLSL} ${AGS_PUBLIC_HEADER}) 44 | target_link_libraries(${PROJECT_NAME} LINK_PUBLIC amd_ags d3d12 dxgi d3dcompiler dxguid) 45 | endif() 46 | 47 | set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") 48 | 49 | set_property(DIRECTORY ${CMAKE_PROJECT_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME}) 50 | -------------------------------------------------------------------------------- /extensions_sample_dx12/build/GenerateSolutions.bat: -------------------------------------------------------------------------------- 1 | mkdir VS2022 2 | cd VS2022 3 | cmake ..\.. -G "Visual Studio 17 2022" -A x64 4 | cd .. 5 | -------------------------------------------------------------------------------- /extensions_sample_dx12/src/D3D12Sample.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #pragma once 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include "amd_ags.h" 30 | 31 | namespace AMD 32 | { 33 | class Window; 34 | 35 | /////////////////////////////////////////////////////////////////////////////// 36 | class D3D12Sample 37 | { 38 | public: 39 | D3D12Sample (const D3D12Sample&) = delete; 40 | D3D12Sample& operator= (const D3D12Sample&) = delete; 41 | 42 | D3D12Sample (); 43 | virtual ~D3D12Sample (); 44 | 45 | void Run (); 46 | 47 | protected: 48 | int GetQueueSlot () const 49 | { 50 | return m_currentBackBuffer; 51 | } 52 | 53 | static const int QUEUE_SLOT_COUNT = 3; 54 | 55 | static int GetQueueSlotCount () 56 | { 57 | return QUEUE_SLOT_COUNT; 58 | } 59 | 60 | D3D12_VIEWPORT m_viewport = {}; 61 | D3D12_RECT m_rectScissor = {}; 62 | Microsoft::WRL::ComPtr m_swapChain = {}; 63 | Microsoft::WRL::ComPtr m_device = {}; 64 | Microsoft::WRL::ComPtr m_renderTargets [QUEUE_SLOT_COUNT] = {}; 65 | Microsoft::WRL::ComPtr m_commandQueue = {}; 66 | 67 | HANDLE m_frameFenceEvents [QUEUE_SLOT_COUNT] = {}; 68 | Microsoft::WRL::ComPtr m_frameFences [QUEUE_SLOT_COUNT] = {}; 69 | UINT64 m_currentFenceValue = 0; 70 | UINT64 m_fenceValues[QUEUE_SLOT_COUNT] = {}; 71 | 72 | Microsoft::WRL::ComPtr m_renderTargetDescriptorHeap = {}; 73 | 74 | Microsoft::WRL::ComPtr m_rootSignature = {}; 75 | 76 | AGSContext* m_agsContext = nullptr; 77 | AGSGPUInfo m_agsGPUInfo = {}; 78 | AGSDX12ExtensionsSupported m_agsDeviceExtensions = {}; 79 | 80 | virtual void InitializeImpl(ID3D12GraphicsCommandList* uploadCommandList) = 0; 81 | virtual void ShutdownImpl() = 0; 82 | virtual void RenderImpl(ID3D12GraphicsCommandList* commandList) = 0; 83 | 84 | private: 85 | void Initialize (); 86 | void Shutdown (); 87 | 88 | void PrepareRender (); 89 | void FinalizeRender (); 90 | 91 | void Render (); 92 | void Present (); 93 | 94 | void CreateDeviceAndSwapChain (); 95 | void CreateAllocatorsAndCommandLists (); 96 | void CreateViewportScissor (); 97 | void SetupSwapChain (); 98 | void SetupRenderTargets (); 99 | 100 | std::unique_ptr m_window = {}; 101 | 102 | Microsoft::WRL::ComPtr m_commandAllocators[QUEUE_SLOT_COUNT] = {}; 103 | Microsoft::WRL::ComPtr m_commandLists[QUEUE_SLOT_COUNT] = {}; 104 | 105 | int m_currentBackBuffer = 0; 106 | 107 | unsigned int m_renderTargetViewDescriptorSize = 0; 108 | }; 109 | } // namespace AMD 110 | -------------------------------------------------------------------------------- /extensions_sample_dx12/src/ExtensionsSample12.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #pragma once 24 | 25 | #include "D3D12Sample.h" 26 | 27 | // 28 | // This SDK sample shows how to use shader intrinsic instructions on GCN GPU's in DX12. 29 | // Just for clarity the code required to enable the intrinsic instructions is ifdef'ed. 30 | // 31 | // When enabled the pixel shader will use the barycentric instruction, 32 | // when disabled it will just render a triangle using a checker board texture. 33 | // 34 | 35 | #include 36 | 37 | namespace AMD 38 | { 39 | class ExtensionsSample12 : public D3D12Sample 40 | { 41 | private: 42 | 43 | void CreateTexture(ID3D12GraphicsCommandList* uploadCommandList); 44 | void CreateMeshBuffers(ID3D12GraphicsCommandList* uploadCommandList); 45 | void UpdateConstantBuffer( ID3D12GraphicsCommandList* commandList, float x, float y, float scale ); 46 | void CreateRootSignature(); 47 | void CreatePipelineStateObject(); 48 | void RenderImpl(ID3D12GraphicsCommandList* commandList) override; 49 | void InitializeImpl(ID3D12GraphicsCommandList* uploadCommandList) override; 50 | void ShutdownImpl() override; 51 | 52 | Microsoft::WRL::ComPtr m_uploadBuffer; 53 | 54 | Microsoft::WRL::ComPtr m_triVertexBuffer; 55 | D3D12_VERTEX_BUFFER_VIEW m_triVertexBufferView; 56 | 57 | Microsoft::WRL::ComPtr m_indexBuffer; 58 | D3D12_INDEX_BUFFER_VIEW m_indexBufferView; 59 | 60 | Microsoft::WRL::ComPtr m_image; 61 | Microsoft::WRL::ComPtr m_uploadImage; 62 | 63 | Microsoft::WRL::ComPtr m_srvDescriptorHeap; 64 | 65 | Microsoft::WRL::ComPtr m_dummyUAV; 66 | D3D12_GPU_DESCRIPTOR_HANDLE m_dummyUAVGPUHandle; 67 | 68 | Microsoft::WRL::ComPtr m_triPSO; 69 | }; 70 | } // namespace AMD 71 | 72 | -------------------------------------------------------------------------------- /extensions_sample_dx12/src/Main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #include "ExtensionsSample12.h" 24 | #include 25 | #include 26 | 27 | int WinMain ( 28 | _In_ HINSTANCE, 29 | _In_opt_ HINSTANCE, 30 | _In_ LPSTR, 31 | _In_ int 32 | ) 33 | { 34 | // Enable run-time memory check for debug builds. 35 | // (When _DEBUG is not defined, calls to _CrtSetDbgFlag are removed during preprocessing.) 36 | _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); 37 | 38 | AMD::D3D12Sample* sample = new AMD::ExtensionsSample12; 39 | 40 | if (sample == nullptr) 41 | { 42 | return 1; 43 | } 44 | 45 | try 46 | { 47 | sample->Run(); 48 | } 49 | catch (const std::runtime_error& error) 50 | { 51 | MessageBoxA(0, error.what(), "Error", 0); 52 | } 53 | 54 | delete sample; 55 | 56 | //check refleaks 57 | HMODULE dxgidebug = LoadLibraryEx("dxgidebug.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); 58 | if (dxgidebug) 59 | { 60 | typedef HRESULT(WINAPI * LPDXGIGETDEBUGINTERFACE)(REFIID, void **); 61 | auto dxgiGetDebugInterface = reinterpret_cast( 62 | reinterpret_cast(GetProcAddress(dxgidebug, "DXGIGetDebugInterface"))); 63 | 64 | IDXGIDebug* debugController; 65 | if (dxgiGetDebugInterface(IID_PPV_ARGS(&debugController)) == S_OK) 66 | { 67 | debugController->ReportLiveObjects(DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL); 68 | debugController->Release(); 69 | } 70 | } 71 | 72 | return 0; 73 | } 74 | -------------------------------------------------------------------------------- /extensions_sample_dx12/src/Window.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #include "Window.h" 24 | 25 | namespace AMD 26 | { 27 | namespace 28 | { 29 | /////////////////////////////////////////////////////////////////////////////// 30 | LRESULT CALLBACK amdWndProc( 31 | HWND hwnd, 32 | UINT uMsg, 33 | WPARAM wParam, 34 | LPARAM lParam 35 | ) 36 | { 37 | auto ptr = ::GetWindowLongPtr(hwnd, GWLP_USERDATA); 38 | auto window = reinterpret_cast (ptr); 39 | 40 | switch (uMsg) 41 | { 42 | case WM_CLOSE: 43 | { 44 | window->OnClose(); 45 | PostQuitMessage(0); 46 | return 0; 47 | } 48 | case WM_KEYDOWN: 49 | { 50 | switch (wParam) 51 | { 52 | case VK_ESCAPE: 53 | { 54 | window->OnClose(); 55 | PostQuitMessage(0); 56 | return 0; 57 | } 58 | } 59 | } 60 | } 61 | 62 | return ::DefWindowProcA(hwnd, uMsg, wParam, lParam); 63 | } 64 | } // namespace 65 | 66 | /////////////////////////////////////////////////////////////////////////////// 67 | IWindow::~IWindow() 68 | { 69 | } 70 | 71 | /////////////////////////////////////////////////////////////////////////////// 72 | int IWindow::GetWidth() const 73 | { 74 | return GetWidthImpl(); 75 | } 76 | 77 | /////////////////////////////////////////////////////////////////////////////// 78 | int IWindow::GetHeight() const 79 | { 80 | return GetHeightImpl(); 81 | } 82 | 83 | /////////////////////////////////////////////////////////////////////////////// 84 | Window::Window(const std::string& title, const int width, const int height) 85 | : m_width (width) 86 | , m_height (height) 87 | { 88 | DWORD style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; 89 | 90 | ::RECT rect; 91 | ::SetRect(&rect, 0, 0, width, height); 92 | ::AdjustWindowRect(&rect, style, FALSE); 93 | 94 | m_windowClass.reset(new WindowClass("D3D12SampleWindowClass", amdWndProc)); 95 | 96 | // Create the main window. 97 | m_hwnd = ::CreateWindowA(m_windowClass->GetName().c_str(), 98 | title.c_str(), 99 | style, CW_USEDEFAULT, CW_USEDEFAULT, 100 | rect.right - rect.left, rect.bottom - rect.top, (HWND)NULL, 101 | (HMENU)NULL, NULL, (LPVOID)NULL); 102 | 103 | ::SetWindowLongPtr(m_hwnd, GWLP_USERDATA, reinterpret_cast (this)); 104 | 105 | // Show the window and paint its contents. 106 | ::ShowWindow(m_hwnd, SW_SHOWDEFAULT); 107 | ::UpdateWindow(m_hwnd); 108 | } 109 | 110 | /////////////////////////////////////////////////////////////////////////////// 111 | bool Window::MessagePump() const 112 | { 113 | MSG msg = { 0 }; 114 | 115 | while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) 116 | { 117 | TranslateMessage(&msg); 118 | DispatchMessage(&msg); 119 | 120 | if (WM_QUIT == msg.message) 121 | { 122 | return false; 123 | } 124 | } 125 | 126 | return true; 127 | } 128 | 129 | /////////////////////////////////////////////////////////////////////////////// 130 | bool IWindow::IsClosed() const 131 | { 132 | return IsClosedImpl(); 133 | } 134 | 135 | /////////////////////////////////////////////////////////////////////////////// 136 | HWND Window::GetHWND () const 137 | { 138 | return m_hwnd; 139 | } 140 | 141 | ///////////////////////////////////////////////////////////////////////// 142 | WindowClass::WindowClass(const std::string& name, ::WNDPROC procedure) 143 | : m_name(name) 144 | { 145 | ::WNDCLASSA wc; 146 | 147 | // Register the window class for the main window. 148 | wc.style = 0; 149 | wc.lpfnWndProc = procedure; 150 | wc.cbClsExtra = 0; 151 | wc.cbWndExtra = 0; 152 | wc.hInstance = NULL; 153 | wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); 154 | wc.hCursor = LoadCursor(NULL, IDC_ARROW); 155 | wc.hbrBackground = NULL; 156 | wc.lpszMenuName = NULL; 157 | wc.lpszClassName = m_name.c_str(); 158 | 159 | ::RegisterClassA(&wc); 160 | } 161 | 162 | ///////////////////////////////////////////////////////////////////////// 163 | const std::string& WindowClass::GetName() const 164 | { 165 | return m_name; 166 | } 167 | 168 | ///////////////////////////////////////////////////////////////////////// 169 | WindowClass::~WindowClass() 170 | { 171 | ::UnregisterClassA(m_name.c_str(), 172 | (HINSTANCE)::GetModuleHandle(NULL)); 173 | } 174 | } // namespace AMD 175 | -------------------------------------------------------------------------------- /extensions_sample_dx12/src/Window.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifndef AMD_BARYCENTRICS_WINDOW_H_ 24 | #define AMD_BARYCENTRICS_WINDOW_H_ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace AMD 31 | { 32 | /** 33 | * Encapsulate a window class. 34 | * 35 | * Calls ::RegisterClass() on create, and ::UnregisterClass() 36 | * on destruction. 37 | */ 38 | struct WindowClass final 39 | { 40 | public: 41 | WindowClass (const std::string& name, WNDPROC procedure = ::DefWindowProc); 42 | ~WindowClass (); 43 | 44 | const std::string& GetName () const; 45 | 46 | WindowClass (const WindowClass&) = delete; 47 | WindowClass& operator= (const WindowClass&) = delete; 48 | 49 | private: 50 | std::string m_name; 51 | }; 52 | 53 | struct IWindow 54 | { 55 | public: 56 | IWindow () = default; 57 | IWindow (const IWindow&) = delete; 58 | IWindow& operator=(const IWindow&) = delete; 59 | 60 | virtual ~IWindow (); 61 | 62 | bool IsClosed () const; 63 | virtual void OnClose () = 0; 64 | virtual bool MessagePump() const = 0; 65 | int GetWidth () const; 66 | int GetHeight () const; 67 | 68 | private: 69 | virtual bool IsClosedImpl () const = 0; 70 | virtual int GetWidthImpl () const = 0; 71 | virtual int GetHeightImpl () const = 0; 72 | }; 73 | 74 | class Window : public IWindow 75 | { 76 | public: 77 | Window (const std::string& title, int width, int height); 78 | 79 | HWND GetHWND () const; 80 | 81 | void OnClose () override 82 | { 83 | m_isClosed = true; 84 | } 85 | 86 | bool MessagePump() const; 87 | 88 | private: 89 | bool IsClosedImpl () const override 90 | { 91 | return m_isClosed; 92 | } 93 | 94 | int GetWidthImpl () const override 95 | { 96 | return m_width; 97 | } 98 | 99 | int GetHeightImpl () const override 100 | { 101 | return m_height; 102 | } 103 | 104 | std::unique_ptr m_windowClass; 105 | HWND m_hwnd = 0; 106 | bool m_isClosed = false; 107 | int m_width = -1, m_height = -1; 108 | }; 109 | } // namespace AMD 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /extensions_sample_dx12/src/shaders.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifdef AMD_USE_SHADER_INTRINSICS 24 | #include "../../ags_lib/hlsl/ags_shader_intrinsics_dx12.hlsl" 25 | #endif 26 | 27 | Texture2D Texture : register(t0); 28 | SamplerState texureSampler : register(s0); 29 | 30 | cbuffer PerFrameConstants : register (b0) 31 | { 32 | float4x4 transform; 33 | } 34 | 35 | struct TriVertexShaderOutput 36 | { 37 | float4 position : SV_POSITION; 38 | float2 uv : TEXCOORD; 39 | }; 40 | 41 | 42 | TriVertexShaderOutput VS_tri( float4 position : POSITION, float2 uv : TEXCOORD ) 43 | { 44 | TriVertexShaderOutput output; 45 | 46 | output.position = mul(transform, position); 47 | output.uv = uv; 48 | 49 | return output; 50 | } 51 | 52 | 53 | float4 PS_tri(float4 position : SV_POSITION, float2 uv : TEXCOORD) : SV_TARGET 54 | { 55 | float4 col = float4(Texture.Sample(texureSampler, uv).rgb, 1.0); 56 | #ifdef AMD_USE_SHADER_INTRINSICS 57 | 58 | //fade the checker board texture 59 | col.rgb *= 0.2; 60 | 61 | //col.r += AmdExtD3DShaderIntrinsics_ReadfirstlaneF( col.r ); 62 | //col.g += AmdExtD3DShaderIntrinsics_ReadfirstlaneF( col.g ); 63 | //col.b += AmdExtD3DShaderIntrinsics_ReadfirstlaneF( col.b ); 64 | 65 | // Use the barycentric intrinsic instrunction 66 | float2 barycentric = AmdExtD3DShaderIntrinsics_IjBarycentricCoords(AmdExtD3DShaderIntrinsicsBarycentric_LinearCenter); 67 | col.rgb += float3(barycentric.x, barycentric.y, 1.0 - (barycentric.x + barycentric.y)); 68 | 69 | //col.r = AmdExtD3DShaderIntrinsics_BallotAny( col.r > 0.5 ); 70 | //col.g = AmdExtD3DShaderIntrinsics_BallotAny( col.g > 0.5 ); 71 | //col.b = AmdExtD3DShaderIntrinsics_BallotAny( col.b > 0.5 ); 72 | 73 | #endif 74 | return col; 75 | } -------------------------------------------------------------------------------- /eyefinity_sample/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | set(CMAKE_GENERATOR_PLATFORM x64) 3 | set(CMAKE_CONFIGURATION_TYPES Debug Release) 4 | 5 | project(eyefinity_sample VERSION 6.3.0) 6 | 7 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) 8 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 9 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 10 | 11 | add_compile_definitions(_UNICODE) 12 | add_compile_definitions(UNICODE) 13 | 14 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/inc ${CMAKE_CURRENT_SOURCE_DIR}/src/ResourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/DXUT/Core ${CMAKE_CURRENT_SOURCE_DIR}/DXUT/Optional ) 15 | 16 | set(AGS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/EyefinitySample.cpp) 17 | set(AGS_PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/inc/amd_ags.h) 18 | 19 | file( GLOB AGS_DXUT_CORE 20 | "${CMAKE_CURRENT_SOURCE_DIR}/DXUT/Core/*.h" 21 | "${CMAKE_CURRENT_SOURCE_DIR}/DXUT/Core/*.cpp" 22 | ) 23 | 24 | file( GLOB AGS_DXUT_OPTIONAL 25 | "${CMAKE_CURRENT_SOURCE_DIR}/DXUT/Optional/*.h" 26 | "${CMAKE_CURRENT_SOURCE_DIR}/DXUT/Optional/*.cpp" 27 | ) 28 | 29 | add_library(amd_ags SHARED IMPORTED GLOBAL) 30 | set_property(TARGET amd_ags PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/lib/amd_ags_x64.lib) 31 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../ags_lib/lib/amd_ags_x64.dll DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) 32 | 33 | 34 | add_executable(${PROJECT_NAME} WIN32 ${AGS_SOURCES} ${AGS_PUBLIC_HEADER} ${AGS_DXUT_CORE} ${AGS_DXUT_OPTIONAL}) 35 | target_link_libraries(${PROJECT_NAME} LINK_PUBLIC amd_ags D3D11 d3dcompiler comctl32 Imm32 Version winmm Usp10 Shlwapi) 36 | 37 | set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX d) 38 | set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME}) 39 | 40 | source_group("Source" FILES ${AGS_SOURCES}) 41 | source_group("Inc" FILES ${AGS_PUBLIC_HEADER}) 42 | source_group("DXUT Core" FILES ${AGS_DXUT_CORE}) 43 | source_group("DXUT Optional" FILES ${AGS_DXUT_OPTIONAL}) 44 | 45 | -------------------------------------------------------------------------------- /eyefinity_sample/build/GenerateSolutions.bat: -------------------------------------------------------------------------------- 1 | mkdir VS2022 2 | cd VS2022 3 | cmake ..\.. -G "Visual Studio 17 2022" -A x64 4 | cd .. 5 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/DDSTextureLoader.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DDSTextureLoader.h 3 | // 4 | // Functions for loading a DDS texture and creating a Direct3D 11 runtime resource for it 5 | // 6 | // Note these functions are useful as a light-weight runtime loader for DDS files. For 7 | // a full-featured DDS file reader, writer, and texture processing pipeline see 8 | // the 'Texconv' sample and the 'DirectXTex' library. 9 | // 10 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 11 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 12 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 13 | // PARTICULAR PURPOSE. 14 | // 15 | // Copyright (c) Microsoft Corporation. All rights reserved. 16 | // 17 | // http://go.microsoft.com/fwlink/?LinkId=248926 18 | // http://go.microsoft.com/fwlink/?LinkId=248929 19 | //-------------------------------------------------------------------------------------- 20 | 21 | #ifdef _MSC_VER 22 | #pragma once 23 | #endif 24 | 25 | #include 26 | 27 | #pragma warning(push) 28 | #pragma warning(disable : 4005) 29 | #include 30 | #pragma warning(pop) 31 | 32 | #if defined(_MSC_VER) && (_MSC_VER<1610) && !defined(_In_reads_) 33 | #define _In_reads_(exp) 34 | #define _Out_writes_(exp) 35 | #define _In_reads_bytes_(exp) 36 | #define _In_reads_opt_(exp) 37 | #define _Outptr_opt_ 38 | #endif 39 | 40 | #ifndef _Use_decl_annotations_ 41 | #define _Use_decl_annotations_ 42 | #endif 43 | 44 | namespace DirectX 45 | { 46 | enum DDS_ALPHA_MODE 47 | { 48 | DDS_ALPHA_MODE_UNKNOWN = 0, 49 | DDS_ALPHA_MODE_STRAIGHT = 1, 50 | DDS_ALPHA_MODE_PREMULTIPLIED = 2, 51 | DDS_ALPHA_MODE_OPAQUE = 3, 52 | DDS_ALPHA_MODE_CUSTOM = 4, 53 | }; 54 | 55 | // Standard version 56 | HRESULT CreateDDSTextureFromMemory( _In_ ID3D11Device* d3dDevice, 57 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 58 | _In_ size_t ddsDataSize, 59 | _Outptr_opt_ ID3D11Resource** texture, 60 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 61 | _In_ size_t maxsize = 0, 62 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr 63 | ); 64 | 65 | HRESULT CreateDDSTextureFromFile( _In_ ID3D11Device* d3dDevice, 66 | _In_z_ const wchar_t* szFileName, 67 | _Outptr_opt_ ID3D11Resource** texture, 68 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 69 | _In_ size_t maxsize = 0, 70 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr 71 | ); 72 | 73 | // Standard version with optional auto-gen mipmap support 74 | HRESULT CreateDDSTextureFromMemory( _In_ ID3D11Device* d3dDevice, 75 | _In_opt_ ID3D11DeviceContext* d3dContext, 76 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 77 | _In_ size_t ddsDataSize, 78 | _Outptr_opt_ ID3D11Resource** texture, 79 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 80 | _In_ size_t maxsize = 0, 81 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr 82 | ); 83 | 84 | HRESULT CreateDDSTextureFromFile( _In_ ID3D11Device* d3dDevice, 85 | _In_opt_ ID3D11DeviceContext* d3dContext, 86 | _In_z_ const wchar_t* szFileName, 87 | _Outptr_opt_ ID3D11Resource** texture, 88 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 89 | _In_ size_t maxsize = 0, 90 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr 91 | ); 92 | 93 | // Extended version 94 | HRESULT CreateDDSTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice, 95 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 96 | _In_ size_t ddsDataSize, 97 | _In_ size_t maxsize, 98 | _In_ D3D11_USAGE usage, 99 | _In_ unsigned int bindFlags, 100 | _In_ unsigned int cpuAccessFlags, 101 | _In_ unsigned int miscFlags, 102 | _In_ bool forceSRGB, 103 | _Outptr_opt_ ID3D11Resource** texture, 104 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 105 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr 106 | ); 107 | 108 | HRESULT CreateDDSTextureFromFileEx( _In_ ID3D11Device* d3dDevice, 109 | _In_z_ const wchar_t* szFileName, 110 | _In_ size_t maxsize, 111 | _In_ D3D11_USAGE usage, 112 | _In_ unsigned int bindFlags, 113 | _In_ unsigned int cpuAccessFlags, 114 | _In_ unsigned int miscFlags, 115 | _In_ bool forceSRGB, 116 | _Outptr_opt_ ID3D11Resource** texture, 117 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 118 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr 119 | ); 120 | 121 | // Extended version with optional auto-gen mipmap support 122 | HRESULT CreateDDSTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice, 123 | _In_opt_ ID3D11DeviceContext* d3dContext, 124 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 125 | _In_ size_t ddsDataSize, 126 | _In_ size_t maxsize, 127 | _In_ D3D11_USAGE usage, 128 | _In_ unsigned int bindFlags, 129 | _In_ unsigned int cpuAccessFlags, 130 | _In_ unsigned int miscFlags, 131 | _In_ bool forceSRGB, 132 | _Outptr_opt_ ID3D11Resource** texture, 133 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 134 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr 135 | ); 136 | 137 | HRESULT CreateDDSTextureFromFileEx( _In_ ID3D11Device* d3dDevice, 138 | _In_opt_ ID3D11DeviceContext* d3dContext, 139 | _In_z_ const wchar_t* szFileName, 140 | _In_ size_t maxsize, 141 | _In_ D3D11_USAGE usage, 142 | _In_ unsigned int bindFlags, 143 | _In_ unsigned int cpuAccessFlags, 144 | _In_ unsigned int miscFlags, 145 | _In_ bool forceSRGB, 146 | _Outptr_opt_ ID3D11Resource** texture, 147 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 148 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr 149 | ); 150 | } -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/DXUTDevice11.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DXUTDevice11.h 3 | // 4 | // Enumerates D3D adapters, devices, modes, etc. 5 | // 6 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 7 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 8 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 9 | // PARTICULAR PURPOSE. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | // 13 | // http://go.microsoft.com/fwlink/?LinkId=320437 14 | //-------------------------------------------------------------------------------------- 15 | #pragma once 16 | 17 | void DXUTApplyDefaultDeviceSettings(DXUTDeviceSettings *modifySettings); 18 | 19 | //-------------------------------------------------------------------------------------- 20 | // Functions to get bit depth from formats 21 | //-------------------------------------------------------------------------------------- 22 | HRESULT WINAPI DXUTGetD3D11AdapterDisplayMode( _In_ UINT AdapterOrdinal, _In_ UINT Output, _Out_ DXGI_MODE_DESC* pModeDesc ); 23 | 24 | 25 | 26 | 27 | //-------------------------------------------------------------------------------------- 28 | // Optional memory create/destory functions. If not call, these will be called automatically 29 | //-------------------------------------------------------------------------------------- 30 | HRESULT WINAPI DXUTCreateD3D11Enumeration(); 31 | void WINAPI DXUTDestroyD3D11Enumeration(); 32 | 33 | 34 | 35 | 36 | //-------------------------------------------------------------------------------------- 37 | // Forward declarations 38 | //-------------------------------------------------------------------------------------- 39 | class CD3D11EnumAdapterInfo; 40 | class CD3D11EnumDeviceInfo; 41 | class CD3D11EnumOutputInfo; 42 | struct CD3D11EnumDeviceSettingsCombo; 43 | 44 | 45 | 46 | //-------------------------------------------------------------------------------------- 47 | // Enumerates available Direct3D11 adapters, devices, modes, etc. 48 | //-------------------------------------------------------------------------------------- 49 | class CD3D11Enumeration 50 | { 51 | public: 52 | // These should be called before Enumerate(). 53 | // 54 | // Use these calls and the IsDeviceAcceptable to control the contents of 55 | // the enumeration object, which affects the device selection and the device settings dialog. 56 | void SetResolutionMinMax( _In_ UINT nMinWidth, _In_ UINT nMinHeight, _In_ UINT nMaxWidth, _In_ UINT nMaxHeight ); 57 | void SetRefreshMinMax( _In_ UINT nMin, _In_ UINT nMax ); 58 | void SetForceFeatureLevel( _In_ D3D_FEATURE_LEVEL forceFL) { m_forceFL = forceFL; } 59 | void SetMultisampleQualityMax( _In_ UINT nMax ); 60 | void ResetPossibleDepthStencilFormats(); 61 | void SetEnumerateAllAdapterFormats( _In_ bool bEnumerateAllAdapterFormats ); 62 | 63 | // Call Enumerate() to enumerate available D3D11 adapters, devices, modes, etc. 64 | bool HasEnumerated() { return m_bHasEnumerated; } 65 | HRESULT Enumerate( _In_ LPDXUTCALLBACKISD3D11DEVICEACCEPTABLE IsD3D11DeviceAcceptableFunc, 66 | _In_opt_ void* pIsD3D11DeviceAcceptableFuncUserContext ); 67 | 68 | // These should be called after Enumerate() is called 69 | std::vector* GetAdapterInfoList(); 70 | CD3D11EnumAdapterInfo* GetAdapterInfo( _In_ UINT AdapterOrdinal ) const; 71 | CD3D11EnumDeviceInfo* GetDeviceInfo( _In_ UINT AdapterOrdinal, _In_ D3D_DRIVER_TYPE DeviceType ) const; 72 | CD3D11EnumOutputInfo* GetOutputInfo( _In_ UINT AdapterOrdinal, _In_ UINT Output ) const; 73 | CD3D11EnumDeviceSettingsCombo* GetDeviceSettingsCombo( _In_ DXUTD3D11DeviceSettings* pDeviceSettings ) const { return GetDeviceSettingsCombo( pDeviceSettings->AdapterOrdinal, pDeviceSettings->sd.BufferDesc.Format, pDeviceSettings->sd.Windowed ); } 74 | CD3D11EnumDeviceSettingsCombo* GetDeviceSettingsCombo( _In_ UINT AdapterOrdinal, _In_ DXGI_FORMAT BackBufferFormat, _In_ BOOL Windowed ) const; 75 | D3D_FEATURE_LEVEL GetWARPFeaturevel() const { return m_warpFL; } 76 | D3D_FEATURE_LEVEL GetREFFeaturevel() const { return m_refFL; } 77 | 78 | ~CD3D11Enumeration(); 79 | 80 | private: 81 | friend HRESULT WINAPI DXUTCreateD3D11Enumeration(); 82 | 83 | // Use DXUTGetD3D11Enumeration() to access global instance 84 | CD3D11Enumeration(); 85 | 86 | bool m_bHasEnumerated; 87 | LPDXUTCALLBACKISD3D11DEVICEACCEPTABLE m_IsD3D11DeviceAcceptableFunc; 88 | void* m_pIsD3D11DeviceAcceptableFuncUserContext; 89 | 90 | std::vector m_DepthStencilPossibleList; 91 | 92 | bool m_bEnumerateAllAdapterFormats; 93 | D3D_FEATURE_LEVEL m_forceFL; 94 | D3D_FEATURE_LEVEL m_warpFL; 95 | D3D_FEATURE_LEVEL m_refFL; 96 | 97 | std::vector m_AdapterInfoList; 98 | 99 | HRESULT EnumerateOutputs( _In_ CD3D11EnumAdapterInfo *pAdapterInfo ); 100 | HRESULT EnumerateDevices( _In_ CD3D11EnumAdapterInfo *pAdapterInfo ); 101 | HRESULT EnumerateDeviceCombos( _In_ CD3D11EnumAdapterInfo* pAdapterInfo ); 102 | HRESULT EnumerateDeviceCombosNoAdapter( _In_ CD3D11EnumAdapterInfo* pAdapterInfo ); 103 | 104 | HRESULT EnumerateDisplayModes( _In_ CD3D11EnumOutputInfo *pOutputInfo ); 105 | void BuildMultiSampleQualityList( _In_ DXGI_FORMAT fmt, _In_ CD3D11EnumDeviceSettingsCombo* pDeviceCombo ); 106 | void ClearAdapterInfoList(); 107 | }; 108 | 109 | CD3D11Enumeration* WINAPI DXUTGetD3D11Enumeration(_In_ bool bForceEnumerate = false, _In_ bool EnumerateAllAdapterFormats = true, _In_ D3D_FEATURE_LEVEL forceFL = ((D3D_FEATURE_LEVEL )0) ); 110 | 111 | 112 | #define DXGI_MAX_DEVICE_IDENTIFIER_STRING 128 113 | 114 | //-------------------------------------------------------------------------------------- 115 | // A class describing an adapter which contains a unique adapter ordinal 116 | // that is installed on the system 117 | //-------------------------------------------------------------------------------------- 118 | class CD3D11EnumAdapterInfo 119 | { 120 | const CD3D11EnumAdapterInfo &operator = ( const CD3D11EnumAdapterInfo &rhs ); 121 | 122 | public: 123 | CD3D11EnumAdapterInfo() : 124 | AdapterOrdinal( 0 ), 125 | m_pAdapter( nullptr ), 126 | bAdapterUnavailable(false) 127 | { 128 | *szUniqueDescription = 0; 129 | memset( &AdapterDesc, 0, sizeof(AdapterDesc) ); 130 | } 131 | ~CD3D11EnumAdapterInfo(); 132 | 133 | UINT AdapterOrdinal; 134 | DXGI_ADAPTER_DESC AdapterDesc; 135 | WCHAR szUniqueDescription[DXGI_MAX_DEVICE_IDENTIFIER_STRING]; 136 | IDXGIAdapter *m_pAdapter; 137 | bool bAdapterUnavailable; 138 | 139 | std::vector outputInfoList; // Array of CD3D11EnumOutputInfo* 140 | std::vector deviceInfoList; // Array of CD3D11EnumDeviceInfo* 141 | // List of CD3D11EnumDeviceSettingsCombo* with a unique set 142 | // of BackBufferFormat, and Windowed 143 | std::vector deviceSettingsComboList; 144 | }; 145 | 146 | 147 | class CD3D11EnumOutputInfo 148 | { 149 | const CD3D11EnumOutputInfo &operator = ( const CD3D11EnumOutputInfo &rhs ); 150 | 151 | public: 152 | CD3D11EnumOutputInfo() : 153 | AdapterOrdinal( 0 ), 154 | Output( 0 ), 155 | m_pOutput( nullptr ) {} 156 | ~CD3D11EnumOutputInfo(); 157 | 158 | UINT AdapterOrdinal; 159 | UINT Output; 160 | IDXGIOutput* m_pOutput; 161 | DXGI_OUTPUT_DESC Desc; 162 | 163 | std::vector displayModeList; // Array of supported D3DDISPLAYMODEs 164 | }; 165 | 166 | 167 | //-------------------------------------------------------------------------------------- 168 | // A class describing a Direct3D11 device that contains a unique supported driver type 169 | //-------------------------------------------------------------------------------------- 170 | class CD3D11EnumDeviceInfo 171 | { 172 | const CD3D11EnumDeviceInfo& operator =( const CD3D11EnumDeviceInfo& rhs ); 173 | 174 | public: 175 | ~CD3D11EnumDeviceInfo(); 176 | 177 | UINT AdapterOrdinal; 178 | D3D_DRIVER_TYPE DeviceType; 179 | D3D_FEATURE_LEVEL SelectedLevel; 180 | D3D_FEATURE_LEVEL MaxLevel; 181 | BOOL ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x; 182 | }; 183 | 184 | 185 | //-------------------------------------------------------------------------------------- 186 | // A struct describing device settings that contains a unique combination of 187 | // adapter format, back buffer format, and windowed that is compatible with a 188 | // particular Direct3D device and the app. 189 | //-------------------------------------------------------------------------------------- 190 | struct CD3D11EnumDeviceSettingsCombo 191 | { 192 | UINT AdapterOrdinal; 193 | D3D_DRIVER_TYPE DeviceType; 194 | DXGI_FORMAT BackBufferFormat; 195 | BOOL Windowed; 196 | UINT Output; 197 | 198 | std::vector multiSampleCountList; // List of valid sampling counts (multisampling) 199 | std::vector multiSampleQualityList; // List of number of quality levels for each multisample count 200 | 201 | CD3D11EnumAdapterInfo* pAdapterInfo; 202 | CD3D11EnumDeviceInfo* pDeviceInfo; 203 | CD3D11EnumOutputInfo* pOutputInfo; 204 | }; 205 | 206 | float DXUTRankD3D11DeviceCombo( _In_ CD3D11EnumDeviceSettingsCombo* pDeviceSettingsCombo, 207 | _In_ DXUTD3D11DeviceSettings* pOptimalDeviceSettings, 208 | _Out_ int &bestModeIndex, 209 | _Out_ int &bestMSAAIndex 210 | ); 211 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/DXUT_2013.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | {85344B7F-5AA0-4E12-A065-D1333D11F6CA} 15 | true 16 | Win32Proj 17 | DXUT 18 | DXUT 19 | 20 | 21 | 22 | StaticLibrary 23 | true 24 | Unicode 25 | v120 26 | 27 | 28 | StaticLibrary 29 | false 30 | Unicode 31 | v120 32 | true 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | Bin\Desktop_2013\x64\Debug\ 48 | Bin\Desktop_2013\x64\Debug\ 49 | DXUT 50 | .lib 51 | 52 | 53 | Bin\Desktop_2013\x64\Release\ 54 | Bin\Desktop_2013\x64\Release\ 55 | DXUT 56 | .lib 57 | 58 | 59 | 60 | Use 61 | DXUT.h 62 | Level4 63 | true 64 | WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 65 | ProgramDatabase 66 | Disabled 67 | Fast 68 | 69 | 70 | Windows 71 | true 72 | 73 | 74 | true 75 | 76 | 77 | 78 | 79 | Use 80 | DXUT.h 81 | Level4 82 | true 83 | WIN32;NDEBUG;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 84 | ProgramDatabase 85 | Full 86 | true 87 | true 88 | false 89 | true 90 | Fast 91 | 92 | 93 | Windows 94 | true 95 | true 96 | true 97 | 98 | 99 | true 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | Create 115 | Create 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/DXUT_2015.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | {85344B7F-5AA0-4E12-A065-D1333D11F6CA} 15 | true 16 | Win32Proj 17 | DXUT 18 | DXUT 19 | 20 | 21 | 22 | StaticLibrary 23 | true 24 | Unicode 25 | v140 26 | 27 | 28 | StaticLibrary 29 | false 30 | Unicode 31 | v140 32 | true 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Bin\Desktop_2015\x64\Debug\ 46 | Bin\Desktop_2015\x64\Debug\ 47 | DXUT 48 | .lib 49 | 50 | 51 | Bin\Desktop_2015\x64\Release\ 52 | Bin\Desktop_2015\x64\Release\ 53 | DXUT 54 | .lib 55 | 56 | 57 | 58 | Use 59 | DXUT.h 60 | Level4 61 | true 62 | WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 63 | EditAndContinue 64 | Disabled 65 | Fast 66 | 67 | 68 | Windows 69 | true 70 | 71 | 72 | true 73 | 74 | 75 | 76 | 77 | Use 78 | DXUT.h 79 | Level4 80 | true 81 | WIN32;NDEBUG;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 82 | ProgramDatabase 83 | Full 84 | true 85 | true 86 | false 87 | true 88 | Fast 89 | 90 | 91 | Windows 92 | true 93 | true 94 | true 95 | 96 | 97 | true 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | Create 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/DXUT_2017.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | {85344B7F-5AA0-4E12-A065-D1333D11F6CA} 15 | true 16 | Win32Proj 17 | DXUT 18 | DXUT 19 | 10.0.18362.0 20 | 21 | 22 | 23 | StaticLibrary 24 | true 25 | Unicode 26 | v141 27 | 28 | 29 | StaticLibrary 30 | false 31 | Unicode 32 | v141 33 | true 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Bin\Desktop_2017\x64\Debug\ 47 | Bin\Desktop_2017\x64\Debug\ 48 | DXUT 49 | .lib 50 | 51 | 52 | Bin\Desktop_2017\x64\Release\ 53 | Bin\Desktop_2017\x64\Release\ 54 | DXUT 55 | .lib 56 | 57 | 58 | 59 | Use 60 | DXUT.h 61 | Level4 62 | true 63 | WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 64 | EditAndContinue 65 | Disabled 66 | Fast 67 | 68 | 69 | Windows 70 | true 71 | 72 | 73 | true 74 | 75 | 76 | $(ProjectDir)Bin\Desktop_2017\x64\Debug\$(MSBuildProjectName).log 77 | 78 | 79 | 80 | 81 | Use 82 | DXUT.h 83 | Level4 84 | true 85 | WIN32;NDEBUG;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 86 | ProgramDatabase 87 | Full 88 | true 89 | true 90 | false 91 | true 92 | Fast 93 | 94 | 95 | Windows 96 | true 97 | true 98 | true 99 | 100 | 101 | true 102 | 103 | 104 | $(ProjectDir)Bin\Desktop_2017\x64\Release\$(MSBuildProjectName).log 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | Create 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/DXUT_2019.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | {85344B7F-5AA0-4E12-A065-D1333D11F6CA} 15 | true 16 | Win32Proj 17 | DXUT 18 | DXUT 19 | 10.0 20 | 21 | 22 | 23 | StaticLibrary 24 | true 25 | Unicode 26 | v142 27 | 28 | 29 | StaticLibrary 30 | false 31 | Unicode 32 | v142 33 | true 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Bin\Desktop_2019\x64\Debug\ 47 | Bin\Desktop_2019\x64\Debug\ 48 | DXUT 49 | .lib 50 | 51 | 52 | Bin\Desktop_2019\x64\Release\ 53 | Bin\Desktop_2019\x64\Release\ 54 | DXUT 55 | .lib 56 | 57 | 58 | 59 | Use 60 | DXUT.h 61 | Level4 62 | true 63 | WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 64 | EditAndContinue 65 | Disabled 66 | Fast 67 | 68 | 69 | Windows 70 | true 71 | 72 | 73 | true 74 | 75 | 76 | 77 | 78 | Use 79 | DXUT.h 80 | Level4 81 | true 82 | WIN32;NDEBUG;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 83 | ProgramDatabase 84 | Full 85 | true 86 | true 87 | false 88 | true 89 | Fast 90 | 91 | 92 | Windows 93 | true 94 | true 95 | true 96 | 97 | 98 | true 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | Create 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/ScreenGrab.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/eyefinity_sample/dxut/Core/ScreenGrab.cpp -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/ScreenGrab.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: ScreenGrab.h 3 | // 4 | // Function for capturing a 2D texture and saving it to a file (aka a 'screenshot' 5 | // when used on a Direct3D 11 Render Target). 6 | // 7 | // Note these functions are useful as a light-weight runtime screen grabber. For 8 | // full-featured texture capture, DDS writer, and texture processing pipeline, 9 | // see the 'Texconv' sample and the 'DirectXTex' library. 10 | // 11 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 12 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 13 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 14 | // PARTICULAR PURPOSE. 15 | // 16 | // Copyright (c) Microsoft Corporation. All rights reserved. 17 | // 18 | // http://go.microsoft.com/fwlink/?LinkId=248926 19 | // http://go.microsoft.com/fwlink/?LinkId=248929 20 | //-------------------------------------------------------------------------------------- 21 | 22 | #ifdef _MSC_VER 23 | #pragma once 24 | #endif 25 | 26 | #include 27 | 28 | #include 29 | 30 | #pragma warning(push) 31 | #pragma warning(disable : 4005) 32 | #include 33 | #pragma warning(pop) 34 | 35 | #include 36 | 37 | namespace DirectX 38 | { 39 | HRESULT SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, 40 | _In_ ID3D11Resource* pSource, 41 | _In_z_ LPCWSTR fileName ); 42 | 43 | HRESULT SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, 44 | _In_ ID3D11Resource* pSource, 45 | _In_ REFGUID guidContainerFormat, 46 | _In_z_ LPCWSTR fileName, 47 | _In_opt_ const GUID* targetFormat = nullptr, 48 | _In_opt_ std::function setCustomProps = nullptr ); 49 | } -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/WICTextureLoader.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: WICTextureLoader.h 3 | // 4 | // Function for loading a WIC image and creating a Direct3D 11 runtime texture for it 5 | // (auto-generating mipmaps if possible) 6 | // 7 | // Note: Assumes application has already called CoInitializeEx 8 | // 9 | // Warning: CreateWICTexture* functions are not thread-safe if given a d3dContext instance for 10 | // auto-gen mipmap support. 11 | // 12 | // Note these functions are useful for images created as simple 2D textures. For 13 | // more complex resources, DDSTextureLoader is an excellent light-weight runtime loader. 14 | // For a full-featured DDS file reader, writer, and texture processing pipeline see 15 | // the 'Texconv' sample and the 'DirectXTex' library. 16 | // 17 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 18 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 19 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 20 | // PARTICULAR PURPOSE. 21 | // 22 | // Copyright (c) Microsoft Corporation. All rights reserved. 23 | // 24 | // http://go.microsoft.com/fwlink/?LinkId=248926 25 | // http://go.microsoft.com/fwlink/?LinkId=248929 26 | //-------------------------------------------------------------------------------------- 27 | 28 | #ifdef _MSC_VER 29 | #pragma once 30 | #endif 31 | 32 | #include 33 | 34 | #pragma warning(push) 35 | #pragma warning(disable : 4005) 36 | #include 37 | #pragma warning(pop) 38 | 39 | #if defined(_MSC_VER) && (_MSC_VER<1610) && !defined(_In_reads_) 40 | #define _In_reads_(exp) 41 | #define _Out_writes_(exp) 42 | #define _In_reads_bytes_(exp) 43 | #endif 44 | 45 | #ifndef _Use_decl_annotations_ 46 | #define _Use_decl_annotations_ 47 | #endif 48 | 49 | namespace DirectX 50 | { 51 | // Standard version 52 | HRESULT CreateWICTextureFromMemory( _In_ ID3D11Device* d3dDevice, 53 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 54 | _In_ size_t wicDataSize, 55 | _Out_opt_ ID3D11Resource** texture, 56 | _Out_opt_ ID3D11ShaderResourceView** textureView, 57 | _In_ size_t maxsize = 0 58 | ); 59 | 60 | HRESULT CreateWICTextureFromFile( _In_ ID3D11Device* d3dDevice, 61 | _In_z_ const wchar_t* szFileName, 62 | _Out_opt_ ID3D11Resource** texture, 63 | _Out_opt_ ID3D11ShaderResourceView** textureView, 64 | _In_ size_t maxsize = 0 65 | ); 66 | 67 | // Standard version with optional auto-gen mipmap support 68 | HRESULT CreateWICTextureFromMemory( _In_ ID3D11Device* d3dDevice, 69 | _In_opt_ ID3D11DeviceContext* d3dContext, 70 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 71 | _In_ size_t wicDataSize, 72 | _Out_opt_ ID3D11Resource** texture, 73 | _Out_opt_ ID3D11ShaderResourceView** textureView, 74 | _In_ size_t maxsize = 0 75 | ); 76 | 77 | HRESULT CreateWICTextureFromFile( _In_ ID3D11Device* d3dDevice, 78 | _In_opt_ ID3D11DeviceContext* d3dContext, 79 | _In_z_ const wchar_t* szFileName, 80 | _Out_opt_ ID3D11Resource** texture, 81 | _Out_opt_ ID3D11ShaderResourceView** textureView, 82 | _In_ size_t maxsize = 0 83 | ); 84 | 85 | // Extended version 86 | HRESULT CreateWICTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice, 87 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 88 | _In_ size_t wicDataSize, 89 | _In_ size_t maxsize, 90 | _In_ D3D11_USAGE usage, 91 | _In_ unsigned int bindFlags, 92 | _In_ unsigned int cpuAccessFlags, 93 | _In_ unsigned int miscFlags, 94 | _In_ bool forceSRGB, 95 | _Out_opt_ ID3D11Resource** texture, 96 | _Out_opt_ ID3D11ShaderResourceView** textureView 97 | ); 98 | 99 | HRESULT CreateWICTextureFromFileEx( _In_ ID3D11Device* d3dDevice, 100 | _In_z_ const wchar_t* szFileName, 101 | _In_ size_t maxsize, 102 | _In_ D3D11_USAGE usage, 103 | _In_ unsigned int bindFlags, 104 | _In_ unsigned int cpuAccessFlags, 105 | _In_ unsigned int miscFlags, 106 | _In_ bool forceSRGB, 107 | _Out_opt_ ID3D11Resource** texture, 108 | _Out_opt_ ID3D11ShaderResourceView** textureView 109 | ); 110 | 111 | // Extended version with optional auto-gen mipmap support 112 | HRESULT CreateWICTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice, 113 | _In_opt_ ID3D11DeviceContext* d3dContext, 114 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 115 | _In_ size_t wicDataSize, 116 | _In_ size_t maxsize, 117 | _In_ D3D11_USAGE usage, 118 | _In_ unsigned int bindFlags, 119 | _In_ unsigned int cpuAccessFlags, 120 | _In_ unsigned int miscFlags, 121 | _In_ bool forceSRGB, 122 | _Out_opt_ ID3D11Resource** texture, 123 | _Out_opt_ ID3D11ShaderResourceView** textureView 124 | ); 125 | 126 | HRESULT CreateWICTextureFromFileEx( _In_ ID3D11Device* d3dDevice, 127 | _In_opt_ ID3D11DeviceContext* d3dContext, 128 | _In_z_ const wchar_t* szFileName, 129 | _In_ size_t maxsize, 130 | _In_ D3D11_USAGE usage, 131 | _In_ unsigned int bindFlags, 132 | _In_ unsigned int cpuAccessFlags, 133 | _In_ unsigned int miscFlags, 134 | _In_ bool forceSRGB, 135 | _Out_opt_ ID3D11Resource** texture, 136 | _Out_opt_ ID3D11ShaderResourceView** textureView 137 | ); 138 | } -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/Windows10SDKVS13_x64.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(ProgramFiles)\Windows Kits\10\bin\x86;$(ExecutablePath) 7 | $(ProgramFiles)\Windows Kits\10\Include\10.0.15063.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.15063.0\shared;$(ProgramFiles)\Windows Kits\10\Include\10.0.15063.0\winrt;$(IncludePath) 8 | $(ProgramFiles)\Windows Kits\10\lib\10.0.15063.0\um\x64;$(LibraryPath) 9 | $(ProgramFiles)\Windows Kits\10\Include\10.0.15063.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.15063.0\shared;$(ProgramFiles)\Windows Kits\10\Include\10.0.15063.0\winrt;$(ExcludePath) 10 | 11 | 12 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/Windows81SDKVS12_x64.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(ProgramFiles)\Windows Kits\8.1\bin\x86;$(ExecutablePath) 7 | $(ProgramFiles)\Windows Kits\8.1\Include\um;$(ProgramFiles)\Windows Kits\8.1\Include\shared;$(ProgramFiles)\Windows Kits\8.1\Include\winrt;$(IncludePath) 8 | $(ProgramFiles)\Windows Kits\8.1\lib\winv6.3\um\x64;$(LibraryPath) 9 | $(ProgramFiles)\Windows Kits\8.1\Include\um;$(ProgramFiles)\Windows Kits\8.1\Include\shared;$(ProgramFiles)\Windows Kits\8.1\Include\winrt;$(ExcludePath) 10 | 11 | 12 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/Windows81SDK_x64.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(VCInstallDir)bin\x86_amd64;$(VCInstallDir)bin;$(WindowsSdkDir)bin\NETFX 4.0 Tools;$(ProgramFiles)\Windows Kits\8.1\bin\x86;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)\bin;$(MSBuildToolsPath32);$(VSInstallDir);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH) 7 | $(ProgramFiles)\Windows Kits\8.1\Include\um;$(ProgramFiles)\Windows Kits\8.1\Include\shared;$(ProgramFiles)\Windows Kits\8.1\Include\winrt;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(FrameworkSDKDir)\include; 8 | $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(ProgramFiles)\Windows Kits\8.1\lib\winv6.3\um\x64;$(FrameworkSDKDir)\lib\x64 9 | $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(ProgramFiles)\Windows Kits\8.1\Include\um;$(ProgramFiles)\Windows Kits\8.1\Include\shared;$(ProgramFiles)\Windows Kits\8.1\Include\winrt;$(FrameworkSDKDir)\include;$(MSBuildToolsPath32);$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib; 10 | 11 | 12 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/Windows8SDK_x64.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(VCInstallDir)bin\x86_amd64;$(VCInstallDir)bin;$(WindowsSdkDir)bin\NETFX 4.0 Tools;$(ProgramFiles)\Windows Kits\8.0\bin\x86;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)\bin;$(MSBuildToolsPath32);$(VSInstallDir);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH) 7 | $(ProgramFiles)\Windows Kits\8.0\Include\um;$(ProgramFiles)\Windows Kits\8.0\Include\shared;$(ProgramFiles)\Windows Kits\8.0\Include\winrt;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(FrameworkSDKDir)\include; 8 | $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(ProgramFiles)\Windows Kits\8.0\lib\win8\um\x64;$(FrameworkSDKDir)\lib\x64 9 | $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(ProgramFiles)\Windows Kits\8.0\Include\um;$(ProgramFiles)\Windows Kits\8.0\Include\shared;$(ProgramFiles)\Windows Kits\8.0\Include\winrt;$(FrameworkSDKDir)\include;$(MSBuildToolsPath32);$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib; 10 | 11 | 12 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Core/dxerr.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DXErr.h 3 | // 4 | // DirectX Error Library 5 | // 6 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 7 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 8 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 9 | // PARTICULAR PURPOSE. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | //-------------------------------------------------------------------------------------- 13 | 14 | // This version only supports UNICODE. 15 | 16 | #pragma once 17 | 18 | #include 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | //-------------------------------------------------------------------------------------- 26 | // DXGetErrorString 27 | //-------------------------------------------------------------------------------------- 28 | const WCHAR* WINAPI DXGetErrorStringW( _In_ HRESULT hr ); 29 | 30 | #define DXGetErrorString DXGetErrorStringW 31 | 32 | //-------------------------------------------------------------------------------------- 33 | // DXGetErrorDescription has to be modified to return a copy in a buffer rather than 34 | // the original static string. 35 | //-------------------------------------------------------------------------------------- 36 | void WINAPI DXGetErrorDescriptionW( _In_ HRESULT hr, _Out_cap_(count) WCHAR* desc, _In_ size_t count ); 37 | 38 | #define DXGetErrorDescription DXGetErrorDescriptionW 39 | 40 | //-------------------------------------------------------------------------------------- 41 | // DXTrace 42 | // 43 | // Desc: Outputs a formatted error message to the debug stream 44 | // 45 | // Args: WCHAR* strFile The current file, typically passed in using the 46 | // __FILEW__ macro. 47 | // DWORD dwLine The current line number, typically passed in using the 48 | // __LINE__ macro. 49 | // HRESULT hr An HRESULT that will be traced to the debug stream. 50 | // CHAR* strMsg A string that will be traced to the debug stream (may be NULL) 51 | // BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. 52 | // 53 | // Return: The hr that was passed in. 54 | //-------------------------------------------------------------------------------------- 55 | HRESULT WINAPI DXTraceW( _In_z_ const WCHAR* strFile, _In_ DWORD dwLine, _In_ HRESULT hr, _In_opt_ const WCHAR* strMsg, _In_ bool bPopMsgBox ); 56 | 57 | #define DXTrace DXTraceW 58 | 59 | //-------------------------------------------------------------------------------------- 60 | // 61 | // Helper macros 62 | // 63 | //-------------------------------------------------------------------------------------- 64 | #if defined(DEBUG) || defined(_DEBUG) 65 | #define DXTRACE_MSG(str) DXTrace( __FILEW__, (DWORD)__LINE__, 0, str, false ) 66 | #define DXTRACE_ERR(str,hr) DXTrace( __FILEW__, (DWORD)__LINE__, hr, str, false ) 67 | #define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILEW__, (DWORD)__LINE__, hr, str, true ) 68 | #else 69 | #define DXTRACE_MSG(str) (0L) 70 | #define DXTRACE_ERR(str,hr) (hr) 71 | #define DXTRACE_ERR_MSGBOX(str,hr) (hr) 72 | #endif 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif //__cplusplus 77 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/MIT.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Microsoft Corp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | software and associated documentation files (the "Software"), to deal in the Software 7 | without restriction, including without limitation the rights to use, copy, modify, 8 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies 13 | or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 17 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 19 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 20 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/DXUTLockFreePipe.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // DXUTLockFreePipe.h 3 | // 4 | // See the "Lockless Programming Considerations for Xbox 360 and Microsoft Windows" 5 | // article for more details. 6 | // 7 | // http://msdn.microsoft.com/en-us/library/ee418650.aspx 8 | // 9 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 10 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 11 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 12 | // PARTICULAR PURPOSE. 13 | // 14 | // Copyright (c) Microsoft Corporation. All rights reserved. 15 | // 16 | // http://go.microsoft.com/fwlink/?LinkId=320437 17 | //-------------------------------------------------------------------------------------- 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | #pragma pack(push) 24 | #pragma pack(8) 25 | #include 26 | #pragma pack (pop) 27 | 28 | extern "C" 29 | void _ReadWriteBarrier(); 30 | #pragma intrinsic(_ReadWriteBarrier) 31 | 32 | // Prevent the compiler from rearranging loads 33 | // and stores, sufficiently for read-acquire 34 | // and write-release. This is sufficient on 35 | // x86 and x64. 36 | #define DXUTImportBarrier _ReadWriteBarrier 37 | #define DXUTExportBarrier _ReadWriteBarrier 38 | 39 | // 40 | // Pipe class designed for use by at most two threads: one reader, one writer. 41 | // Access by more than two threads isn't guaranteed to be safe. 42 | // 43 | // In order to provide efficient access the size of the buffer is passed 44 | // as a template parameter and restricted to powers of two less than 31. 45 | // 46 | 47 | template class DXUTLockFreePipe 48 | { 49 | public: 50 | DXUTLockFreePipe() : m_readOffset( 0 ), 51 | m_writeOffset( 0 ) 52 | { 53 | } 54 | 55 | DWORD GetBufferSize() const 56 | { 57 | return c_cbBufferSize; 58 | } 59 | 60 | __forceinline unsigned long BytesAvailable() const 61 | { 62 | return m_writeOffset - m_readOffset; 63 | } 64 | 65 | bool __forceinline Read( _Out_writes_(cbDest) void* pvDest, _In_ unsigned long cbDest ) 66 | { 67 | // Store the read and write offsets into local variables--this is 68 | // essentially a snapshot of their values so that they stay constant 69 | // for the duration of the function (and so we don't end up with cache 70 | // misses due to false sharing). 71 | DWORD readOffset = m_readOffset; 72 | DWORD writeOffset = m_writeOffset; 73 | 74 | // Compare the two offsets to see if we have anything to read. 75 | // Note that we don't do anything to synchronize the offsets here. 76 | // Really there's not much we *can* do unless we're willing to completely 77 | // synchronize access to the entire object. We have to assume that as we 78 | // read, someone else may be writing, and the write offset we have now 79 | // may be out of date by the time we read it. Fortunately that's not a 80 | // very big deal. We might miss reading some data that was just written. 81 | // But the assumption is that we'll be back before long to grab more data 82 | // anyway. 83 | // 84 | // Note that this comparison works because we're careful to constrain 85 | // the total buffer size to be a power of 2, which means it will divide 86 | // evenly into ULONG_MAX+1. That, and the fact that the offsets are 87 | // unsigned, means that the calculation returns correct results even 88 | // when the values wrap around. 89 | DWORD cbAvailable = writeOffset - readOffset; 90 | if( cbDest > cbAvailable ) 91 | { 92 | return false; 93 | } 94 | 95 | // The data has been made available, but we need to make sure 96 | // that our view on the data is up to date -- at least as up to 97 | // date as the control values we just read. We need to prevent 98 | // the compiler or CPU from moving any of the data reads before 99 | // the control value reads. This import barrier serves this 100 | // purpose, on Xbox 360 and on Windows. 101 | 102 | // Reading a control value and then having a barrier is known 103 | // as a "read-acquire." 104 | DXUTImportBarrier(); 105 | 106 | unsigned char* pbDest = ( unsigned char* )pvDest; 107 | 108 | unsigned long actualReadOffset = readOffset & c_sizeMask; 109 | unsigned long bytesLeft = cbDest; 110 | 111 | // 112 | // Copy from the tail, then the head. Note that there's no explicit 113 | // check to see if the write offset comes between the read offset 114 | // and the end of the buffer--that particular condition is implicitly 115 | // checked by the comparison with AvailableToRead(), above. If copying 116 | // cbDest bytes off the tail would cause us to cross the write offset, 117 | // then the previous comparison would have failed since that would imply 118 | // that there were less than cbDest bytes available to read. 119 | // 120 | unsigned long cbTailBytes = std::min( bytesLeft, c_cbBufferSize - actualReadOffset ); 121 | memcpy( pbDest, m_pbBuffer + actualReadOffset, cbTailBytes ); 122 | bytesLeft -= cbTailBytes; 123 | 124 | if( bytesLeft ) 125 | { 126 | memcpy( pbDest + cbTailBytes, m_pbBuffer, bytesLeft ); 127 | } 128 | 129 | // When we update the read offset we are, effectively, 'freeing' buffer 130 | // memory so that the writing thread can use it. We need to make sure that 131 | // we don't free the memory before we have finished reading it. That is, 132 | // we need to make sure that the write to m_readOffset can't get reordered 133 | // above the reads of the buffer data. The only way to guarantee this is to 134 | // have an export barrier to prevent both compiler and CPU rearrangements. 135 | DXUTExportBarrier(); 136 | 137 | // Advance the read offset. From the CPUs point of view this is several 138 | // operations--read, modify, store--and we'd normally want to make sure that 139 | // all of the operations happened atomically. But in the case of a single 140 | // reader, only one thread updates this value and so the only operation that 141 | // must be atomic is the store. That's lucky, because 32-bit aligned stores are 142 | // atomic on all modern processors. 143 | // 144 | readOffset += cbDest; 145 | m_readOffset = readOffset; 146 | 147 | return true; 148 | } 149 | 150 | bool __forceinline Write( _In_reads_(cbSrc) const void* pvSrc, _In_ unsigned long cbSrc ) 151 | { 152 | // Reading the read offset here has the same caveats as reading 153 | // the write offset had in the Read() function above. 154 | DWORD readOffset = m_readOffset; 155 | DWORD writeOffset = m_writeOffset; 156 | 157 | // Compute the available write size. This comparison relies on 158 | // the fact that the buffer size is always a power of 2, and the 159 | // offsets are unsigned integers, so that when the write pointer 160 | // wraps around the subtraction still yields a value (assuming 161 | // we haven't messed up somewhere else) between 0 and c_cbBufferSize - 1. 162 | DWORD cbAvailable = c_cbBufferSize - ( writeOffset - readOffset ); 163 | if( cbSrc > cbAvailable ) 164 | { 165 | return false; 166 | } 167 | 168 | // It is theoretically possible for writes of the data to be reordered 169 | // above the reads to see if the data is available. Improbable perhaps, 170 | // but possible. This barrier guarantees that the reordering will not 171 | // happen. 172 | DXUTImportBarrier(); 173 | 174 | // Write the data 175 | const unsigned char* pbSrc = ( const unsigned char* )pvSrc; 176 | unsigned long actualWriteOffset = writeOffset & c_sizeMask; 177 | unsigned long bytesLeft = cbSrc; 178 | 179 | // See the explanation in the Read() function as to why we don't 180 | // explicitly check against the read offset here. 181 | unsigned long cbTailBytes = std::min( bytesLeft, c_cbBufferSize - actualWriteOffset ); 182 | memcpy( m_pbBuffer + actualWriteOffset, pbSrc, cbTailBytes ); 183 | bytesLeft -= cbTailBytes; 184 | 185 | if( bytesLeft ) 186 | { 187 | memcpy( m_pbBuffer, pbSrc + cbTailBytes, bytesLeft ); 188 | } 189 | 190 | // Now it's time to update the write offset, but since the updated position 191 | // of the write offset will imply that there's data to be read, we need to 192 | // make sure that the data all actually gets written before the update to 193 | // the write offset. The writes could be reordered by the compiler (on any 194 | // platform) or by the CPU (on Xbox 360). We need a barrier which prevents 195 | // the writes from being reordered past each other. 196 | // 197 | // Having a barrier and then writing a control value is called "write-release." 198 | DXUTExportBarrier(); 199 | 200 | // See comments in Read() as to why this operation isn't interlocked. 201 | writeOffset += cbSrc; 202 | m_writeOffset = writeOffset; 203 | 204 | return true; 205 | } 206 | 207 | private: 208 | // Values derived from the buffer size template parameter 209 | // 210 | const static BYTE c_cbBufferSizeLog2 = __min( cbBufferSizeLog2, 31 ); 211 | const static DWORD c_cbBufferSize = ( 1 << c_cbBufferSizeLog2 ); 212 | const static DWORD c_sizeMask = c_cbBufferSize - 1; 213 | 214 | // Leave these private and undefined to prevent their use 215 | DXUTLockFreePipe( const DXUTLockFreePipe& ); 216 | DXUTLockFreePipe& operator =( const DXUTLockFreePipe& ); 217 | 218 | // Member data 219 | // 220 | BYTE m_pbBuffer[c_cbBufferSize]; 221 | // Note that these offsets are not clamped to the buffer size. 222 | // Instead the calculations rely on wrapping at ULONG_MAX+1. 223 | // See the comments in Read() for details. 224 | volatile DWORD __declspec( align( 4 ) ) m_readOffset; 225 | volatile DWORD __declspec( align( 4 ) ) m_writeOffset; 226 | }; -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/DXUTOpt_2013.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | {61B333C2-C4F7-4CC1-A9BF-83F6D95588EB} 15 | true 16 | Win32Proj 17 | DXUTOpt 18 | DXUTOpt 19 | 20 | 21 | 22 | StaticLibrary 23 | true 24 | Unicode 25 | v120 26 | 27 | 28 | StaticLibrary 29 | false 30 | Unicode 31 | v120 32 | true 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | Bin\Desktop_2013\x64\Debug\ 48 | Bin\Desktop_2013\x64\Debug\ 49 | DXUTOpt 50 | .lib 51 | 52 | 53 | Bin\Desktop_2013\x64\Release\ 54 | Bin\Desktop_2013\x64\Release\ 55 | DXUTOpt 56 | .lib 57 | 58 | 59 | 60 | Use 61 | DXUT.h 62 | Level4 63 | true 64 | WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 65 | ..\Core;%(AdditionalIncludeDirectories) 66 | ProgramDatabase 67 | Disabled 68 | Fast 69 | 70 | 71 | Windows 72 | true 73 | 74 | 75 | true 76 | 77 | 78 | 79 | 80 | Use 81 | DXUT.h 82 | Level4 83 | true 84 | WIN32;NDEBUG;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 85 | ..\Core;%(AdditionalIncludeDirectories) 86 | ProgramDatabase 87 | Full 88 | true 89 | true 90 | false 91 | true 92 | Fast 93 | 94 | 95 | Windows 96 | true 97 | true 98 | true 99 | 100 | 101 | true 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | Create 121 | Create 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/DXUTOpt_2015.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | {61B333C2-C4F7-4CC1-A9BF-83F6D95588EB} 15 | true 16 | Win32Proj 17 | DXUTOpt 18 | DXUTOpt 19 | 20 | 21 | 22 | StaticLibrary 23 | true 24 | Unicode 25 | v140 26 | 27 | 28 | StaticLibrary 29 | false 30 | Unicode 31 | v140 32 | true 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Bin\Desktop_2015\x64\Debug\ 46 | Bin\Desktop_2015\x64\Debug\ 47 | DXUTOpt 48 | .lib 49 | 50 | 51 | Bin\Desktop_2015\x64\Release\ 52 | Bin\Desktop_2015\x64\Release\ 53 | DXUTOpt 54 | .lib 55 | 56 | 57 | 58 | Use 59 | DXUT.h 60 | Level4 61 | true 62 | WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 63 | ..\Core;%(AdditionalIncludeDirectories) 64 | EditAndContinue 65 | Disabled 66 | Fast 67 | 68 | 69 | Windows 70 | true 71 | 72 | 73 | true 74 | 75 | 76 | 77 | 78 | Use 79 | DXUT.h 80 | Level4 81 | true 82 | WIN32;NDEBUG;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 83 | ..\Core;%(AdditionalIncludeDirectories) 84 | ProgramDatabase 85 | Full 86 | true 87 | true 88 | false 89 | true 90 | Fast 91 | 92 | 93 | Windows 94 | true 95 | true 96 | true 97 | 98 | 99 | true 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | Create 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/DXUTOpt_2017.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | {61B333C2-C4F7-4CC1-A9BF-83F6D95588EB} 15 | true 16 | Win32Proj 17 | DXUTOpt 18 | DXUTOpt 19 | 10.0.18362.0 20 | 21 | 22 | 23 | StaticLibrary 24 | true 25 | Unicode 26 | v141 27 | 28 | 29 | StaticLibrary 30 | false 31 | Unicode 32 | v141 33 | true 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Bin\Desktop_2017\x64\Debug\ 47 | Bin\Desktop_2017\x64\Debug\ 48 | DXUTOpt 49 | .lib 50 | 51 | 52 | Bin\Desktop_2017\x64\Release\ 53 | Bin\Desktop_2017\x64\Release\ 54 | DXUTOpt 55 | .lib 56 | 57 | 58 | 59 | Use 60 | DXUT.h 61 | Level4 62 | true 63 | WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 64 | ..\Core;%(AdditionalIncludeDirectories) 65 | EditAndContinue 66 | Disabled 67 | Fast 68 | 69 | 70 | Windows 71 | true 72 | 73 | 74 | true 75 | 76 | 77 | $(ProjectDir)Bin\Desktop_2017\x64\Debug\$(MSBuildProjectName).log 78 | 79 | 80 | 81 | 82 | Use 83 | DXUT.h 84 | Level4 85 | true 86 | WIN32;NDEBUG;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 87 | ..\Core;%(AdditionalIncludeDirectories) 88 | ProgramDatabase 89 | Full 90 | true 91 | true 92 | false 93 | true 94 | Fast 95 | 96 | 97 | Windows 98 | true 99 | true 100 | true 101 | 102 | 103 | true 104 | 105 | 106 | $(ProjectDir)Bin\Desktop_2017\x64\Release\$(MSBuildProjectName).log 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | Create 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/DXUTOpt_2019.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | {61B333C2-C4F7-4CC1-A9BF-83F6D95588EB} 15 | true 16 | Win32Proj 17 | DXUTOpt 18 | DXUTOpt 19 | 10.0 20 | 21 | 22 | 23 | StaticLibrary 24 | true 25 | Unicode 26 | v142 27 | 28 | 29 | StaticLibrary 30 | false 31 | Unicode 32 | v142 33 | true 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Bin\Desktop_2019\x64\Debug\ 47 | Bin\Desktop_2019\x64\Debug\ 48 | DXUTOpt 49 | .lib 50 | 51 | 52 | Bin\Desktop_2019\x64\Release\ 53 | Bin\Desktop_2019\x64\Release\ 54 | DXUTOpt 55 | .lib 56 | 57 | 58 | 59 | Use 60 | DXUT.h 61 | Level4 62 | true 63 | WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 64 | ..\Core;%(AdditionalIncludeDirectories) 65 | EditAndContinue 66 | Disabled 67 | Fast 68 | 69 | 70 | Windows 71 | true 72 | 73 | 74 | true 75 | 76 | 77 | 78 | 79 | Use 80 | DXUT.h 81 | Level4 82 | true 83 | WIN32;NDEBUG;_WINDOWS;_LIB;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) 84 | ..\Core;%(AdditionalIncludeDirectories) 85 | ProgramDatabase 86 | Full 87 | true 88 | true 89 | false 90 | true 91 | Fast 92 | 93 | 94 | Windows 95 | true 96 | true 97 | true 98 | 99 | 100 | true 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | Create 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/DXUTguiIME.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DXUTguiIME.h 3 | // 4 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 6 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 7 | // PARTICULAR PURPOSE. 8 | // 9 | // Copyright (c) Microsoft Corporation. All rights reserved. 10 | // 11 | // http://go.microsoft.com/fwlink/?LinkId=320437 12 | //-------------------------------------------------------------------------------------- 13 | #pragma once 14 | 15 | #include 16 | #include 17 | #include "ImeUi.h" 18 | 19 | //-------------------------------------------------------------------------------------- 20 | // Forward declarations 21 | //-------------------------------------------------------------------------------------- 22 | class CDXUTIMEEditBox; 23 | 24 | 25 | //----------------------------------------------------------------------------- 26 | // IME-enabled EditBox control 27 | //----------------------------------------------------------------------------- 28 | #define MAX_COMPSTRING_SIZE 256 29 | 30 | 31 | class CDXUTIMEEditBox : public CDXUTEditBox 32 | { 33 | public: 34 | 35 | static HRESULT CreateIMEEditBox( _In_ CDXUTDialog* pDialog, _In_ int ID, _In_z_ LPCWSTR strText, _In_ int x, _In_ int y, _In_ int width, 36 | _In_ int height, _In_ bool bIsDefault=false, _Outptr_opt_ CDXUTIMEEditBox** ppCreated=nullptr ); 37 | 38 | CDXUTIMEEditBox( _In_opt_ CDXUTDialog* pDialog = nullptr ); 39 | virtual ~CDXUTIMEEditBox(); 40 | 41 | static void InitDefaultElements( _In_ CDXUTDialog* pDialog ); 42 | 43 | static void WINAPI Initialize( _In_ HWND hWnd ); 44 | static void WINAPI Uninitialize(); 45 | 46 | static HRESULT WINAPI StaticOnCreateDevice(); 47 | static bool WINAPI StaticMsgProc( _In_ HWND hWnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam ); 48 | 49 | static void WINAPI SetImeEnableFlag( _In_ bool bFlag ); 50 | 51 | virtual void Render( _In_ float fElapsedTime ) override; 52 | virtual bool MsgProc( _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam ) override; 53 | virtual bool HandleMouse( _In_ UINT uMsg, _In_ const POINT& pt, _In_ WPARAM wParam, _In_ LPARAM lParam ) override; 54 | virtual void UpdateRects() override; 55 | virtual void OnFocusIn() override; 56 | virtual void OnFocusOut() override; 57 | 58 | void PumpMessage(); 59 | 60 | virtual void RenderCandidateReadingWindow( _In_ bool bReading ); 61 | virtual void RenderComposition(); 62 | virtual void RenderIndicator( _In_ float fElapsedTime ); 63 | 64 | protected: 65 | static void WINAPI EnableImeSystem( _In_ bool bEnable ); 66 | 67 | static WORD WINAPI GetLanguage() 68 | { 69 | return ImeUi_GetLanguage(); 70 | } 71 | static WORD WINAPI GetPrimaryLanguage() 72 | { 73 | return ImeUi_GetPrimaryLanguage(); 74 | } 75 | static void WINAPI SendKey( _In_ BYTE nVirtKey ); 76 | static DWORD WINAPI GetImeId( _In_ UINT uIndex = 0 ) 77 | { 78 | return ImeUi_GetImeId( uIndex ); 79 | }; 80 | static void WINAPI CheckInputLocale(); 81 | static void WINAPI CheckToggleState(); 82 | static void WINAPI SetupImeApi(); 83 | static void WINAPI ResetCompositionString(); 84 | 85 | 86 | static void SetupImeUiCallback(); 87 | 88 | protected: 89 | enum 90 | { 91 | INDICATOR_NON_IME, 92 | INDICATOR_CHS, 93 | INDICATOR_CHT, 94 | INDICATOR_KOREAN, 95 | INDICATOR_JAPANESE 96 | }; 97 | 98 | struct CCandList 99 | { 100 | CUniBuffer HoriCand; // Candidate list string (for horizontal candidate window) 101 | int nFirstSelected; // First character position of the selected string in HoriCand 102 | int nHoriSelectedLen; // Length of the selected string in HoriCand 103 | RECT rcCandidate; // Candidate rectangle computed and filled each time before rendered 104 | }; 105 | 106 | static POINT s_ptCompString; // Composition string position. Updated every frame. 107 | static int s_nFirstTargetConv; // Index of the first target converted char in comp string. If none, -1. 108 | static CUniBuffer s_CompString; // Buffer to hold the composition string (we fix its length) 109 | static DWORD s_adwCompStringClause[MAX_COMPSTRING_SIZE]; 110 | static CCandList s_CandList; // Data relevant to the candidate list 111 | static WCHAR s_wszReadingString[32];// Used only with horizontal reading window (why?) 112 | static bool s_bImeFlag; // Is ime enabled 113 | 114 | // Color of various IME elements 115 | DWORD m_ReadingColor; // Reading string color 116 | DWORD m_ReadingWinColor; // Reading window color 117 | DWORD m_ReadingSelColor; // Selected character in reading string 118 | DWORD m_ReadingSelBkColor; // Background color for selected char in reading str 119 | DWORD m_CandidateColor; // Candidate string color 120 | DWORD m_CandidateWinColor; // Candidate window color 121 | DWORD m_CandidateSelColor; // Selected candidate string color 122 | DWORD m_CandidateSelBkColor; // Selected candidate background color 123 | DWORD m_CompColor; // Composition string color 124 | DWORD m_CompWinColor; // Composition string window color 125 | DWORD m_CompCaretColor; // Composition string caret color 126 | DWORD m_CompTargetColor; // Composition string target converted color 127 | DWORD m_CompTargetBkColor; // Composition string target converted background 128 | DWORD m_CompTargetNonColor; // Composition string target non-converted color 129 | DWORD m_CompTargetNonBkColor;// Composition string target non-converted background 130 | DWORD m_IndicatorImeColor; // Indicator text color for IME 131 | DWORD m_IndicatorEngColor; // Indicator text color for English 132 | DWORD m_IndicatorBkColor; // Indicator text background color 133 | 134 | // Edit-control-specific data 135 | int m_nIndicatorWidth; // Width of the indicator symbol 136 | RECT m_rcIndicator; // Rectangle for drawing the indicator button 137 | 138 | #if defined(DEBUG) || defined(_DEBUG) 139 | static bool m_bIMEStaticMsgProcCalled; 140 | #endif 141 | }; 142 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/DXUTres.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // File: dxutres.h 3 | // 4 | // Functions to create DXUT media from arrays in memory 5 | // 6 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 7 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 8 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 9 | // PARTICULAR PURPOSE. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | // 13 | // http://go.microsoft.com/fwlink/?LinkId=320437 14 | //----------------------------------------------------------------------------- 15 | #pragma once 16 | 17 | HRESULT WINAPI DXUTCreateGUITextureFromInternalArray( _In_ ID3D11Device* pd3dDevice, _Outptr_ ID3D11Texture2D** ppTexture ); 18 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/DXUTsettingsdlg.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DXUTSettingsDlg.h 3 | // 4 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 6 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 7 | // PARTICULAR PURPOSE. 8 | // 9 | // Copyright (c) Microsoft Corporation. All rights reserved. 10 | // 11 | // http://go.microsoft.com/fwlink/?LinkId=320437 12 | //-------------------------------------------------------------------------------------- 13 | #pragma once 14 | 15 | //-------------------------------------------------------------------------------------- 16 | // Header Includes 17 | //-------------------------------------------------------------------------------------- 18 | #include "DXUTgui.h" 19 | 20 | //-------------------------------------------------------------------------------------- 21 | // Control IDs 22 | //-------------------------------------------------------------------------------------- 23 | #define DXUTSETTINGSDLG_STATIC -1 24 | #define DXUTSETTINGSDLG_OK 1 25 | #define DXUTSETTINGSDLG_CANCEL 2 26 | #define DXUTSETTINGSDLG_ADAPTER 3 27 | #define DXUTSETTINGSDLG_DEVICE_TYPE 4 28 | #define DXUTSETTINGSDLG_WINDOWED 5 29 | #define DXUTSETTINGSDLG_FULLSCREEN 6 30 | #define DXUTSETTINGSDLG_RESOLUTION_SHOW_ALL 26 31 | #define DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT 28 32 | #define DXUTSETTINGSDLG_D3D11_ADAPTER_OUTPUT_LABEL 29 33 | #define DXUTSETTINGSDLG_D3D11_RESOLUTION 30 34 | #define DXUTSETTINGSDLG_D3D11_RESOLUTION_LABEL 31 35 | #define DXUTSETTINGSDLG_D3D11_REFRESH_RATE 32 36 | #define DXUTSETTINGSDLG_D3D11_REFRESH_RATE_LABEL 33 37 | #define DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT 34 38 | #define DXUTSETTINGSDLG_D3D11_BACK_BUFFER_FORMAT_LABEL 35 39 | #define DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT 36 40 | #define DXUTSETTINGSDLG_D3D11_MULTISAMPLE_COUNT_LABEL 37 41 | #define DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY 38 42 | #define DXUTSETTINGSDLG_D3D11_MULTISAMPLE_QUALITY_LABEL 39 43 | #define DXUTSETTINGSDLG_D3D11_PRESENT_INTERVAL 40 44 | #define DXUTSETTINGSDLG_D3D11_PRESENT_INTERVAL_LABEL 41 45 | #define DXUTSETTINGSDLG_D3D11_DEBUG_DEVICE 42 46 | #define DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL 43 47 | #define DXUTSETTINGSDLG_D3D11_FEATURE_LEVEL_LABEL 44 48 | 49 | #define DXUTSETTINGSDLG_MODE_CHANGE_ACCEPT 58 50 | #define DXUTSETTINGSDLG_MODE_CHANGE_REVERT 59 51 | #define DXUTSETTINGSDLG_STATIC_MODE_CHANGE_TIMEOUT 60 52 | #define DXUTSETTINGSDLG_WINDOWED_GROUP 0x0100 53 | 54 | #ifdef USE_DIRECT3D11_3 55 | #define TOTAL_FEATURE_LEVELS 9 56 | #else 57 | #ifdef USE_DIRECT3D11_1 58 | #define TOTAL_FEATURE_LEVELS 7 59 | #else 60 | #define TOTAL_FEATURE_LEVELS 6 61 | #endif 62 | #endif 63 | 64 | //-------------------------------------------------------------------------------------- 65 | // Dialog for selection of device settings 66 | // Use DXUTGetD3DSettingsDialog() to access global instance 67 | // To control the contents of the dialog, use the CD3D11Enumeration class. 68 | //-------------------------------------------------------------------------------------- 69 | class CD3DSettingsDlg 70 | { 71 | public: 72 | CD3DSettingsDlg(); 73 | ~CD3DSettingsDlg(); 74 | 75 | void Init( _In_ CDXUTDialogResourceManager* pManager ); 76 | void Init( _In_ CDXUTDialogResourceManager* pManager, _In_z_ LPCWSTR szControlTextureFileName ); 77 | void Init( _In_ CDXUTDialogResourceManager* pManager, _In_z_ LPCWSTR pszControlTextureResourcename, 78 | _In_ HMODULE hModule ); 79 | 80 | HRESULT Refresh(); 81 | void OnRender( _In_ float fElapsedTime ); 82 | 83 | HRESULT OnD3D11CreateDevice( _In_ ID3D11Device* pd3dDevice ); 84 | HRESULT OnD3D11ResizedSwapChain( _In_ ID3D11Device* pd3dDevice, 85 | _In_ const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc ); 86 | void OnD3D11DestroyDevice(); 87 | 88 | CDXUTDialog* GetDialogControl() { return &m_Dialog; } 89 | bool IsActive() const { return m_bActive; } 90 | void SetActive( _In_ bool bActive ) 91 | { 92 | m_bActive = bActive; 93 | if( bActive ) Refresh(); 94 | } 95 | 96 | LRESULT MsgProc( _In_ HWND hWnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam ); 97 | 98 | protected: 99 | friend CD3DSettingsDlg* WINAPI DXUTGetD3DSettingsDialog(); 100 | 101 | void CreateControls(); 102 | void SetSelectedD3D11RefreshRate( _In_ DXGI_RATIONAL RefreshRate ); 103 | HRESULT UpdateD3D11Resolutions(); 104 | HRESULT UpdateD3D11RefreshRates(); 105 | 106 | void OnEvent( _In_ UINT nEvent, _In_ int nControlID, _In_ CDXUTControl* pControl ); 107 | 108 | static void WINAPI StaticOnEvent( _In_ UINT nEvent, _In_ int nControlID, _In_ CDXUTControl* pControl, _In_opt_ void* pUserData ); 109 | static void WINAPI StaticOnModeChangeTimer( _In_ UINT nIDEvent, _In_opt_ void* pUserContext ); 110 | 111 | CD3D11EnumAdapterInfo* GetCurrentD3D11AdapterInfo() const; 112 | CD3D11EnumDeviceInfo* GetCurrentD3D11DeviceInfo() const; 113 | CD3D11EnumOutputInfo* GetCurrentD3D11OutputInfo() const; 114 | CD3D11EnumDeviceSettingsCombo* GetCurrentD3D11DeviceSettingsCombo() const; 115 | 116 | void AddAdapter( _In_z_ const WCHAR* strDescription, _In_ UINT iAdapter ); 117 | UINT GetSelectedAdapter() const; 118 | 119 | void SetWindowed( _In_ bool bWindowed ); 120 | bool IsWindowed() const; 121 | 122 | // D3D11 123 | void AddD3D11DeviceType( _In_ D3D_DRIVER_TYPE devType ); 124 | D3D_DRIVER_TYPE GetSelectedD3D11DeviceType() const; 125 | 126 | void AddD3D11AdapterOutput( _In_z_ const WCHAR* strName, _In_ UINT nOutput ); 127 | UINT GetSelectedD3D11AdapterOutput() const; 128 | 129 | void AddD3D11Resolution( _In_ DWORD dwWidth, _In_ DWORD dwHeight ); 130 | void GetSelectedD3D11Resolution( _Out_ DWORD* pdwWidth, _Out_ DWORD* pdwHeight ) const; 131 | 132 | void AddD3D11FeatureLevel( _In_ D3D_FEATURE_LEVEL fl ); 133 | D3D_FEATURE_LEVEL GetSelectedFeatureLevel() const; 134 | 135 | void AddD3D11RefreshRate( _In_ DXGI_RATIONAL RefreshRate ); 136 | DXGI_RATIONAL GetSelectedD3D11RefreshRate() const; 137 | 138 | void AddD3D11BackBufferFormat( _In_ DXGI_FORMAT format ); 139 | DXGI_FORMAT GetSelectedD3D11BackBufferFormat() const; 140 | 141 | void AddD3D11MultisampleCount( _In_ UINT count ); 142 | UINT GetSelectedD3D11MultisampleCount() const; 143 | 144 | void AddD3D11MultisampleQuality( _In_ UINT Quality ); 145 | UINT GetSelectedD3D11MultisampleQuality() const; 146 | 147 | DWORD GetSelectedD3D11PresentInterval() const; 148 | bool GetSelectedDebugDeviceValue() const; 149 | 150 | HRESULT OnD3D11ResolutionChanged (); 151 | HRESULT OnFeatureLevelChanged(); 152 | HRESULT OnAdapterChanged(); 153 | HRESULT OnDeviceTypeChanged(); 154 | HRESULT OnWindowedFullScreenChanged(); 155 | HRESULT OnAdapterOutputChanged(); 156 | HRESULT OnRefreshRateChanged(); 157 | HRESULT OnBackBufferFormatChanged(); 158 | HRESULT OnMultisampleTypeChanged(); 159 | HRESULT OnMultisampleQualityChanged(); 160 | HRESULT OnPresentIntervalChanged(); 161 | HRESULT OnDebugDeviceChanged(); 162 | 163 | void UpdateModeChangeTimeoutText( _In_ int nSecRemaining ); 164 | 165 | CDXUTDialog* m_pActiveDialog; 166 | CDXUTDialog m_Dialog; 167 | CDXUTDialog m_RevertModeDialog; 168 | int m_nRevertModeTimeout; 169 | UINT m_nIDEvent; 170 | bool m_bActive; 171 | 172 | D3D_FEATURE_LEVEL m_Levels[TOTAL_FEATURE_LEVELS]; 173 | 174 | }; 175 | 176 | 177 | CD3DSettingsDlg* WINAPI DXUTGetD3DSettingsDialog(); 178 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/ImeUi.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: ImeUi.h 3 | // 4 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 6 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 7 | // PARTICULAR PURPOSE. 8 | // 9 | // Copyright (c) Microsoft Corporation. All rights reserved. 10 | // 11 | // http://go.microsoft.com/fwlink/?LinkId=320437 12 | //-------------------------------------------------------------------------------------- 13 | #pragma once 14 | 15 | #include 16 | 17 | class CImeUiFont_Base 18 | { 19 | public: 20 | virtual void SetHeight( _In_ UINT uHeight ) 21 | { 22 | UNREFERENCED_PARAMETER(uHeight); 23 | }; // for backward compatibility 24 | virtual void SetColor( _In_ DWORD color ) = 0; 25 | virtual void SetPosition( _In_ int x, _In_ int y ) = 0; 26 | virtual void GetTextExtent( _In_z_ LPCTSTR szText, _Out_ DWORD* puWidth, _Out_ DWORD* puHeight ) = 0; 27 | virtual void DrawText( _In_z_ LPCTSTR pszText ) = 0; 28 | }; 29 | 30 | typedef struct 31 | { 32 | // symbol (Henkan-kyu) 33 | DWORD symbolColor; 34 | DWORD symbolColorOff; 35 | DWORD symbolColorText; 36 | BYTE symbolHeight; 37 | BYTE symbolTranslucence; 38 | BYTE symbolPlacement; 39 | CImeUiFont_Base* symbolFont; 40 | 41 | // candidate list 42 | DWORD candColorBase; 43 | DWORD candColorBorder; 44 | DWORD candColorText; 45 | 46 | // composition string 47 | DWORD compColorInput; 48 | DWORD compColorTargetConv; 49 | DWORD compColorConverted; 50 | DWORD compColorTargetNotConv; 51 | DWORD compColorInputErr; 52 | BYTE compTranslucence; 53 | DWORD compColorText; 54 | 55 | // caret 56 | BYTE caretWidth; 57 | BYTE caretYMargin; 58 | } IMEUI_APPEARANCE; 59 | 60 | typedef struct // D3DTLVERTEX compatible 61 | { 62 | float sx; 63 | float sy; 64 | float sz; 65 | float rhw; 66 | DWORD color; 67 | DWORD specular; 68 | float tu; 69 | float tv; 70 | } IMEUI_VERTEX; 71 | 72 | // IME States 73 | #define IMEUI_STATE_OFF 0 74 | #define IMEUI_STATE_ON 1 75 | #define IMEUI_STATE_ENGLISH 2 76 | 77 | // IME const 78 | #define MAX_CANDLIST 10 79 | 80 | // IME Flags 81 | #define IMEUI_FLAG_SUPPORT_CARET 0x00000001 82 | 83 | bool ImeUi_Initialize( _In_ HWND hwnd, _In_ bool bDisable = false ); 84 | void ImeUi_Uninitialize(); 85 | void ImeUi_SetAppearance( _In_opt_ const IMEUI_APPEARANCE* pia ); 86 | void ImeUi_GetAppearance( _Out_opt_ IMEUI_APPEARANCE* pia ); 87 | bool ImeUi_IgnoreHotKey( _In_ const MSG* pmsg ); 88 | LPARAM ImeUi_ProcessMessage( _In_ HWND hWnd, _In_ UINT uMsg, _In_ WPARAM wParam, _Inout_ LPARAM& lParam, _Out_ bool* trapped ); 89 | void ImeUi_SetScreenDimension( _In_ UINT width, _In_ UINT height ); 90 | void ImeUi_RenderUI( _In_ bool bDrawCompAttr = true, _In_ bool bDrawOtherUi = true ); 91 | void ImeUi_SetCaretPosition( _In_ UINT x, _In_ UINT y ); 92 | void ImeUi_SetCompStringAppearance( _In_ CImeUiFont_Base* pFont, _In_ DWORD color, _In_ const RECT* prc ); 93 | bool ImeUi_GetCaretStatus(); 94 | void ImeUi_SetInsertMode( _In_ bool bInsert ); 95 | void ImeUi_SetState( _In_ DWORD dwState ); 96 | DWORD ImeUi_GetState(); 97 | void ImeUi_EnableIme( _In_ bool bEnable ); 98 | bool ImeUi_IsEnabled(); 99 | void ImeUi_FinalizeString( _In_ bool bSend = false ); 100 | void ImeUi_ToggleLanguageBar( _In_ BOOL bRestore ); 101 | bool ImeUi_IsSendingKeyMessage(); 102 | void ImeUi_SetWindow( _In_ HWND hwnd ); 103 | UINT ImeUi_GetInputCodePage(); 104 | DWORD ImeUi_GetFlags(); 105 | void ImeUi_SetFlags( _In_ DWORD dwFlags, _In_ bool bSet ); 106 | 107 | WORD ImeUi_GetPrimaryLanguage(); 108 | DWORD ImeUi_GetImeId( _In_ UINT uIndex ); 109 | WORD ImeUi_GetLanguage(); 110 | LPTSTR ImeUi_GetIndicatior(); 111 | bool ImeUi_IsShowReadingWindow(); 112 | bool ImeUi_IsShowCandListWindow(); 113 | bool ImeUi_IsVerticalCand(); 114 | bool ImeUi_IsHorizontalReading(); 115 | TCHAR* ImeUi_GetCandidate( _In_ UINT idx ); 116 | TCHAR* ImeUi_GetCompositionString(); 117 | DWORD ImeUi_GetCandidateSelection(); 118 | DWORD ImeUi_GetCandidateCount(); 119 | BYTE* ImeUi_GetCompStringAttr(); 120 | DWORD ImeUi_GetImeCursorChars(); 121 | 122 | extern void ( CALLBACK*ImeUiCallback_DrawRect )( _In_ int x1, _In_ int y1, _In_ int x2, _In_ int y2, _In_ DWORD color ); 123 | extern void* ( __cdecl*ImeUiCallback_Malloc )( _In_ size_t bytes ); 124 | extern void ( __cdecl*ImeUiCallback_Free )( _In_ void* ptr ); 125 | extern void ( CALLBACK*ImeUiCallback_DrawFans )( _In_ const IMEUI_VERTEX* paVertex, _In_ UINT uNum ); 126 | extern void ( CALLBACK*ImeUiCallback_OnChar )( _In_ WCHAR wc ); 127 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/SDKmisc.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: SDKMisc.h 3 | // 4 | // Various helper functionality that is shared between SDK samples 5 | // 6 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 7 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 8 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 9 | // PARTICULAR PURPOSE. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | // 13 | // http://go.microsoft.com/fwlink/?LinkId=320437 14 | //-------------------------------------------------------------------------------------- 15 | #pragma once 16 | 17 | //----------------------------------------------------------------------------- 18 | // Resource cache for textures, fonts, meshs, and effects. 19 | // Use DXUTGetGlobalResourceCache() to access the global cache 20 | //----------------------------------------------------------------------------- 21 | 22 | struct DXUTCache_Texture 23 | { 24 | WCHAR wszSource[MAX_PATH]; 25 | bool bSRGB; 26 | ID3D11ShaderResourceView* pSRV11; 27 | 28 | DXUTCache_Texture() : 29 | pSRV11(nullptr) 30 | { 31 | } 32 | }; 33 | 34 | 35 | class CDXUTResourceCache 36 | { 37 | public: 38 | ~CDXUTResourceCache(); 39 | 40 | HRESULT CreateTextureFromFile( _In_ ID3D11Device* pDevice, _In_ ID3D11DeviceContext *pContext, _In_z_ LPCWSTR pSrcFile, 41 | _Outptr_ ID3D11ShaderResourceView** ppOutputRV, _In_ bool bSRGB=false ); 42 | HRESULT CreateTextureFromFile( _In_ ID3D11Device* pDevice, _In_ ID3D11DeviceContext *pContext, _In_z_ LPCSTR pSrcFile, 43 | _Outptr_ ID3D11ShaderResourceView** ppOutputRV, _In_ bool bSRGB=false ); 44 | public: 45 | static HRESULT OnDestroyDevice(); 46 | 47 | protected: 48 | friend CDXUTResourceCache& WINAPI DXUTGetGlobalResourceCache(); 49 | friend HRESULT WINAPI DXUTInitialize3DEnvironment(); 50 | friend HRESULT WINAPI DXUTReset3DEnvironment(); 51 | friend void WINAPI DXUTCleanup3DEnvironment( bool bReleaseSettings ); 52 | 53 | CDXUTResourceCache() { } 54 | 55 | std::vector m_TextureCache; 56 | }; 57 | 58 | CDXUTResourceCache& WINAPI DXUTGetGlobalResourceCache(); 59 | HRESULT WINAPI DXUTDestroyGlobalResourceCache(); 60 | 61 | 62 | //-------------------------------------------------------------------------------------- 63 | // Manages the insertion point when drawing text 64 | //-------------------------------------------------------------------------------------- 65 | class CDXUTDialogResourceManager; 66 | class CDXUTTextHelper 67 | { 68 | public: 69 | CDXUTTextHelper( _In_ ID3D11Device* pd3d11Device, _In_ ID3D11DeviceContext* pd3dDeviceContext, _In_ CDXUTDialogResourceManager* pManager, _In_ int nLineHeight ); 70 | ~CDXUTTextHelper(); 71 | 72 | void Init( _In_ int nLineHeight = 15 ); 73 | 74 | void SetInsertionPos( _In_ int x, _In_ int y ) 75 | { 76 | m_pt.x = x; 77 | m_pt.y = y; 78 | } 79 | void SetForegroundColor( _In_ DirectX::XMFLOAT4 clr ) { m_clr = clr; } 80 | void SetForegroundColor( _In_ DirectX::FXMVECTOR clr ) { XMStoreFloat4( &m_clr, clr ); } 81 | 82 | void Begin(); 83 | HRESULT DrawFormattedTextLine( _In_z_ const WCHAR* strMsg, ... ); 84 | HRESULT DrawTextLine( _In_z_ const WCHAR* strMsg ); 85 | HRESULT DrawFormattedTextLine( _In_ const RECT& rc, _In_z_ const WCHAR* strMsg, ... ); 86 | HRESULT DrawTextLine( _In_ const RECT& rc, _In_z_ const WCHAR* strMsg ); 87 | void End(); 88 | 89 | protected: 90 | DirectX::XMFLOAT4 m_clr; 91 | POINT m_pt; 92 | int m_nLineHeight; 93 | 94 | // D3D11 font 95 | ID3D11Device* m_pd3d11Device; 96 | ID3D11DeviceContext* m_pd3d11DeviceContext; 97 | CDXUTDialogResourceManager* m_pManager; 98 | }; 99 | 100 | 101 | //-------------------------------------------------------------------------------------- 102 | // Shared code for samples to ask user if they want to use a REF device or quit 103 | //-------------------------------------------------------------------------------------- 104 | void WINAPI DXUTDisplaySwitchingToREFWarning(); 105 | 106 | //-------------------------------------------------------------------------------------- 107 | // Tries to finds a media file by searching in common locations 108 | //-------------------------------------------------------------------------------------- 109 | HRESULT WINAPI DXUTFindDXSDKMediaFileCch( _Out_writes_(cchDest) WCHAR* strDestPath, 110 | _In_ int cchDest, 111 | _In_z_ LPCWSTR strFilename ); 112 | HRESULT WINAPI DXUTSetMediaSearchPath( _In_z_ LPCWSTR strPath ); 113 | LPCWSTR WINAPI DXUTGetMediaSearchPath(); 114 | 115 | 116 | //-------------------------------------------------------------------------------------- 117 | // Compiles HLSL shaders 118 | //-------------------------------------------------------------------------------------- 119 | HRESULT WINAPI DXUTCompileFromFile( _In_z_ LPCWSTR pFileName, 120 | _In_reads_opt_(_Inexpressible_(pDefines->Name != NULL)) const D3D_SHADER_MACRO* pDefines, 121 | _In_z_ LPCSTR pEntrypoint, _In_z_ LPCSTR pTarget, 122 | _In_ UINT Flags1, _In_ UINT Flags2, 123 | _Outptr_ ID3DBlob** ppCode ); 124 | 125 | //-------------------------------------------------------------------------------------- 126 | // Texture utilities 127 | //-------------------------------------------------------------------------------------- 128 | HRESULT WINAPI DXUTCreateShaderResourceViewFromFile( _In_ ID3D11Device* d3dDevice, _In_z_ const wchar_t* szFileName, _Outptr_ ID3D11ShaderResourceView** textureView ); 129 | HRESULT WINAPI DXUTCreateTextureFromFile( _In_ ID3D11Device* d3dDevice, _In_z_ const wchar_t* szFileName, _Outptr_ ID3D11Resource** texture ); 130 | HRESULT WINAPI DXUTSaveTextureToFile( _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, _In_ bool usedds, _In_z_ const wchar_t* szFileName ); 131 | 132 | //-------------------------------------------------------------------------------------- 133 | // Returns a view matrix for rendering to a face of a cubemap. 134 | //-------------------------------------------------------------------------------------- 135 | DirectX::XMMATRIX WINAPI DXUTGetCubeMapViewMatrix( _In_ DWORD dwFace ); 136 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/Windows10SDKVS13_x64.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(ProgramFiles)\Windows Kits\10\bin\x86;$(ExecutablePath) 7 | $(ProgramFiles)\Windows Kits\10\Include\10.0.15063.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.15063.0\shared;$(ProgramFiles)\Windows Kits\10\Include\10.0.15063.0\winrt;$(IncludePath) 8 | $(ProgramFiles)\Windows Kits\10\lib\10.0.15063.0\um\x64;$(LibraryPath) 9 | $(ProgramFiles)\Windows Kits\10\Include\10.0.15063.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.15063.0\shared;$(ProgramFiles)\Windows Kits\10\Include\10.0.15063.0\winrt;$(ExcludePath) 10 | 11 | 12 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/Windows81SDKVS12_x64.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(ProgramFiles)\Windows Kits\8.1\bin\x86;$(ExecutablePath) 7 | $(ProgramFiles)\Windows Kits\8.1\Include\um;$(ProgramFiles)\Windows Kits\8.1\Include\shared;$(ProgramFiles)\Windows Kits\8.1\Include\winrt;$(IncludePath) 8 | $(ProgramFiles)\Windows Kits\8.1\lib\winv6.3\um\x64;$(LibraryPath) 9 | $(ProgramFiles)\Windows Kits\8.1\Include\um;$(ProgramFiles)\Windows Kits\8.1\Include\shared;$(ProgramFiles)\Windows Kits\8.1\Include\winrt;$(ExcludePath) 10 | 11 | 12 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/Windows81SDK_x64.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(VCInstallDir)bin\x86_amd64;$(VCInstallDir)bin;$(WindowsSdkDir)bin\NETFX 4.0 Tools;$(ProgramFiles)\Windows Kits\8.1\bin\x86;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)\bin;$(MSBuildToolsPath32);$(VSInstallDir);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH) 7 | $(ProgramFiles)\Windows Kits\8.1\Include\um;$(ProgramFiles)\Windows Kits\8.1\Include\shared;$(ProgramFiles)\Windows Kits\8.1\Include\winrt;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(FrameworkSDKDir)\include; 8 | $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(ProgramFiles)\Windows Kits\8.1\lib\winv6.3\um\x64;$(FrameworkSDKDir)\lib\x64 9 | $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(ProgramFiles)\Windows Kits\8.1\Include\um;$(ProgramFiles)\Windows Kits\8.1\Include\shared;$(ProgramFiles)\Windows Kits\8.1\Include\winrt;$(FrameworkSDKDir)\include;$(MSBuildToolsPath32);$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib; 10 | 11 | 12 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/Windows8SDK_x64.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(VCInstallDir)bin\x86_amd64;$(VCInstallDir)bin;$(WindowsSdkDir)bin\NETFX 4.0 Tools;$(ProgramFiles)\Windows Kits\8.0\bin\x86;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)\bin;$(MSBuildToolsPath32);$(VSInstallDir);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH) 7 | $(ProgramFiles)\Windows Kits\8.0\Include\um;$(ProgramFiles)\Windows Kits\8.0\Include\shared;$(ProgramFiles)\Windows Kits\8.0\Include\winrt;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(FrameworkSDKDir)\include; 8 | $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(ProgramFiles)\Windows Kits\8.0\lib\win8\um\x64;$(FrameworkSDKDir)\lib\x64 9 | $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(ProgramFiles)\Windows Kits\8.0\Include\um;$(ProgramFiles)\Windows Kits\8.0\Include\shared;$(ProgramFiles)\Windows Kits\8.0\Include\winrt;$(FrameworkSDKDir)\include;$(MSBuildToolsPath32);$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib; 10 | 11 | 12 | -------------------------------------------------------------------------------- /eyefinity_sample/dxut/Optional/directx.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/eyefinity_sample/dxut/Optional/directx.ico -------------------------------------------------------------------------------- /eyefinity_sample/dxut/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Modified version of Microsoft DXUT. The unmodified version can be found on GitHub - https://github.com/Microsoft/DXUT 2 | 3 | DXUT is distributed under the terms of the MIT License. See MIT.txt. 4 | 5 | 6 | -------------------- 7 | DXUT FOR DIRECT3D 11 8 | -------------------- 9 | 10 | Copyright (c) Microsoft Corporation. All rights reserved. 11 | 12 | November 30, 2015 13 | 14 | DXUT is a "GLUT"-like framework for Direct3D 11.x Win32 desktop applications; primarily samples, demos, and prototypes. 15 | 16 | The source is written for Visual Studio 2012, 2013, or 2015. It is recommended that you 17 | make use of the Windows 8.1 SDK and Windows 7 Service Pack 1 or later. 18 | 19 | These components are designed to work without requiring any content from the DirectX SDK. For details, 20 | see "Where is the DirectX SDK?" . 21 | 22 | All content and source code for this package are subject to the terms of the MIT License. 23 | . 24 | 25 | For the latest version of DXUT11, more detailed documentation, etc., please visit the project site. 26 | 27 | http://go.microsoft.com/fwlink/?LinkId=320437 28 | 29 | 30 | ------- 31 | SAMPLES 32 | ------- 33 | 34 | Direct3D Tutorial08 - 10 35 | http://code.msdn.microsoft.com/DXUT-Tutorial-Win32-Sample-fe15e440 36 | 37 | BasicHLSL11, EmptyProject11, SimpleSample11 38 | http://code.msdn.microsoft.com/Basic-DXUT-Win32-Samples-e59c0682 39 | 40 | DXUT+DirectXTK Simple Sample 41 | http://code.msdn.microsoft.com/DXUTDirectXTK-Simple-Win32-9cf797e9 42 | 43 | Note: These samples are also hosted on GitHub - https://github.com/walbourn/directx-sdk-samples 44 | 45 | 46 | ---------- 47 | DISCLAIMER 48 | ---------- 49 | 50 | DXUT is being provided as a porting aid for older code that makes use of the legacy DirectX SDK, the deprecated D3DX9/D3DX11 51 | library, and the DXUT11 framework. It is a cleaned up version of the original DXUT11 that will build with the Windows 8.x SDK 52 | and does not make use of any legacy DirectX SDK or DirectSetup deployed components. 53 | 54 | The DXUT framework is for use in Win32 desktop applications. It not usable for Windows Store apps on Windows 8.x or Windows RT. 55 | It does not support Windows phone or Xbox One. 56 | 57 | This version of DXUT only supports Direct3D 11, and therefore is not compatible with Windows XP or early versions of Windows Vista. 58 | 59 | 60 | --------------- 61 | RELEASE HISTORY 62 | --------------- 63 | 64 | November 30, 2015 (11.11) 65 | Updated DDSTextureLoader, ScreenGrab, DXERR 66 | Updated for VS 2015 Update 1 and Windows 10 SDK (10586) 67 | 68 | July 29, 2015 (11.10) 69 | Updated for VS 2015 and Windows 10 SDK RTM 70 | Retired VS 2010 projects 71 | 72 | June 16, 2015 (11.09) 73 | Optional support for Direct3D 11.3 (define USE_DIRECT3D11_3 in VS 2015 projects) 74 | 75 | April 14, 2015 (11.08) 76 | Fix for auto-gen of volume textures 77 | More updates for VS 2015 78 | 79 | November 24, 2014 (11.07) 80 | Minor fix for Present usage 81 | Minor fix for CBaseCamera::GetInput 82 | Minor fix for WIC usage of IWICFormatConverter 83 | Updates for Visual Studio 2015 Technical Preview 84 | 85 | July 28, 2014 (11.06) 86 | Optional support for Direct3D 11.2 (define USE_DIRECT3D11_2 in VS 2013 projects) 87 | Fixes for various UI and F2 device settings dialog issues 88 | Fixes for device and format enumeration 89 | Changed default resolution to 800x600 90 | Code review fixes 91 | 92 | January 24, 2014 (11.05) 93 | Added use of DXGI debugging when available 94 | Resolved CRT heap leak report 95 | Fixed compile bug in DXUTLockFreePipe 96 | Fixed bug reported in DXUT's sprite implementation 97 | Code cleanup (removed DXGI_1_2_FORMATS control define; ScopedObject typedef removed) 98 | 99 | October 21, 2013 (11.04) 100 | Updated for Visual Studio 2013 and Windows 8.1 SDK RTM 101 | Minor fixes for systems which only have a "Microsoft Basic Renderer" device 102 | 103 | September 2013 (11.03) 104 | Removed dependencies on the D3DX9 and D3DX11 libraries, so DXUT no longer requires the legacy DirectX SDK to build. 105 | It does require the d3dcompiler.h header from the Windows 8.x SDK. 106 | Includes standalone DDSTextureLoader, WICTexureLoader, ScreenGrab, and DxErr modules. 107 | Removed support for Direct3D 9 and Windows XP 108 | Deleted the DXUTDevice9.h/.cpp, SDKSound.h/.cpp, and SDKWaveFile.h/.cpp files 109 | Deleted legacy support for MCE relaunch 110 | General C++ code cleanups (nullptr, auto keyword, C++ style casting, Safer CRT, etc.) which are 111 | compatible with Visual C++ 2010 and 2012 112 | SAL2 annotation and /analyze cleanup 113 | Added DXUTCompileFromFile, DXUTCreateShaderResourceViewFromFile, DXUTCreateTextureFromFile, DXUTSaveTextureToFile helpers 114 | Added '-forcewarp' command-line switch 115 | Added support for DXGI 1.1 and 1.2 formats 116 | Added Direct3D 11.1 Device/Context state 117 | Support Feature Level 11.1 when available 118 | 119 | June 2010 (11.02) 120 | The DirectX SDK (June 2010) included an update to DXUT11. This is the last version to support Visual Studio 2008, 121 | Windows XP, or Direct3D 9. The source code is located in Samples\C++\DXUT11. 122 | 123 | February 2010 (11.01) 124 | An update was shipped with the DirectX SDK (February 2010). This is the last version to support Visual Studio 2005. 125 | The source code is located in Samples\C++\DXUT11. 126 | 127 | August 2009 (11.00) 128 | The initial release of DXUT11 was in DirectX SDK (August 2009). The source code is located in Samples\C++\DXUT11. 129 | This was a port of the original DXUT which supported Direct3D 10 / Direct3D 9 applications on Windows XP and Windows Vista. 130 | -------------------------------------------------------------------------------- /eyefinity_sample/media/amd/AMD.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/eyefinity_sample/media/amd/AMD.ico -------------------------------------------------------------------------------- /eyefinity_sample/media/microscopecity/MIT.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Microsoft Corp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | software and associated documentation files (the "Software"), to deal in the Software 7 | without restriction, including without limitation the rights to use, copy, modify, 8 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies 13 | or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 17 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 19 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 20 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /eyefinity_sample/media/microscopecity/city.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/eyefinity_sample/media/microscopecity/city.dds -------------------------------------------------------------------------------- /eyefinity_sample/media/microscopecity/column.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/eyefinity_sample/media/microscopecity/column.dds -------------------------------------------------------------------------------- /eyefinity_sample/media/microscopecity/column.sdkmesh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/eyefinity_sample/media/microscopecity/column.sdkmesh -------------------------------------------------------------------------------- /eyefinity_sample/media/microscopecity/occcity.sdkmesh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/eyefinity_sample/media/microscopecity/occcity.sdkmesh -------------------------------------------------------------------------------- /eyefinity_sample/media/microscopecity/occluder.sdkmesh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/eyefinity_sample/media/microscopecity/occluder.sdkmesh -------------------------------------------------------------------------------- /eyefinity_sample/media/microscopecity/scanner.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/eyefinity_sample/media/microscopecity/scanner.dds -------------------------------------------------------------------------------- /eyefinity_sample/media/microscopecity/scanner.sdkmesh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/eyefinity_sample/media/microscopecity/scanner.sdkmesh -------------------------------------------------------------------------------- /eyefinity_sample/media/readme.txt: -------------------------------------------------------------------------------- 1 | The media files in the microscopecity and ui subfolders are from the Microsoft DirectX SDK Samples: 2 | https://github.com/walbourn/directx-sdk-samples 3 | 4 | They are distributed under the terms of the MIT License. -------------------------------------------------------------------------------- /eyefinity_sample/media/ui/Font.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/eyefinity_sample/media/ui/Font.dds -------------------------------------------------------------------------------- /eyefinity_sample/media/ui/MIT.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Microsoft Corp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | software and associated documentation files (the "Software"), to deal in the Software 7 | without restriction, including without limitation the rights to use, copy, modify, 8 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies 13 | or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 17 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 19 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 20 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /eyefinity_sample/media/ui/dxutcontrols.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/5d8812d703d0335741b6f7ffc37838eeb8b967f7/eyefinity_sample/media/ui/dxutcontrols.dds -------------------------------------------------------------------------------- /eyefinity_sample/src/ResourceFiles/EyefinitySample.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #define IDC_STATIC -1 11 | #include 12 | 13 | 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | #undef APSTUDIO_READONLY_SYMBOLS 17 | 18 | ///////////////////////////////////////////////////////////////////////////// 19 | // English (U.S.) resources 20 | 21 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 22 | #ifdef _WIN32 23 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 24 | #pragma code_page(1252) 25 | #endif //_WIN32 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | // 29 | // Icon 30 | // 31 | 32 | // Icon with lowest ID value placed first to ensure application icon 33 | // remains consistent on all systems. 34 | IDI_MAIN_ICON ICON "..\\media\\amd\\AMD.ico" 35 | 36 | #ifdef APSTUDIO_INVOKED 37 | ///////////////////////////////////////////////////////////////////////////// 38 | // 39 | // TEXTINCLUDE 40 | // 41 | 42 | 1 TEXTINCLUDE 43 | BEGIN 44 | "resource.h\0" 45 | END 46 | 47 | 2 TEXTINCLUDE 48 | BEGIN 49 | "#define IDC_STATIC -1\r\n" 50 | "#include \r\n" 51 | "\r\n" 52 | "\r\n" 53 | "\0" 54 | END 55 | 56 | 3 TEXTINCLUDE 57 | BEGIN 58 | "\r\n" 59 | "\0" 60 | END 61 | 62 | #endif // APSTUDIO_INVOKED 63 | 64 | #endif // English (U.S.) resources 65 | ///////////////////////////////////////////////////////////////////////////// 66 | 67 | 68 | 69 | #ifndef APSTUDIO_INVOKED 70 | ///////////////////////////////////////////////////////////////////////////// 71 | // 72 | // Generated from the TEXTINCLUDE 3 resource. 73 | // 74 | 75 | 76 | ///////////////////////////////////////////////////////////////////////////// 77 | #endif // not APSTUDIO_INVOKED 78 | 79 | -------------------------------------------------------------------------------- /eyefinity_sample/src/ResourceFiles/dpiaware.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True/PM 5 | 6 | 7 | -------------------------------------------------------------------------------- /eyefinity_sample/src/ResourceFiles/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by EyefinitySample.rc 4 | // 5 | #define IDI_MAIN_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 113 12 | #define _APS_NEXT_COMMAND_VALUE 40029 13 | #define _APS_NEXT_CONTROL_VALUE 1000 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /eyefinity_sample/src/Shaders/EyefinitySample.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // File: EyefinitySample.hlsl 25 | //-------------------------------------------------------------------------------------- 26 | 27 | struct VSSceneIn 28 | { 29 | float3 pos : POSITION; //position 30 | float3 norm : NORMAL; //normal 31 | float2 tex : TEXTURE0; //texture coordinate 32 | }; 33 | 34 | struct PSSceneIn 35 | { 36 | float4 pos : SV_Position; 37 | float2 tex : TEXTURE0; 38 | }; 39 | 40 | // Textures 41 | Texture2D g_txDiffuse : register( t0 ); 42 | 43 | // Samplers 44 | SamplerState g_SampleLinear : register( s0 ); 45 | 46 | // Comstant 47 | cbuffer cb0 : register( b0 ) 48 | { 49 | float4x4 g_mWorldViewProj; 50 | }; 51 | 52 | PSSceneIn VSScenemain(VSSceneIn input) 53 | { 54 | PSSceneIn output; 55 | 56 | output.pos = mul( float4(input.pos,1.0), g_mWorldViewProj ); 57 | output.tex = input.tex; 58 | 59 | return output; 60 | } 61 | 62 | float4 PSScenemain(PSSceneIn input) : SV_Target 63 | { 64 | return g_txDiffuse.Sample( g_SampleLinear, input.tex ); 65 | } -------------------------------------------------------------------------------- /eyefinity_sample/src/Shaders/Line.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | void LineVS( in float2 pos : POSITION, out float4 screenpos : SV_Position ) 24 | { 25 | screenpos = float4( pos, 0, 1 ); 26 | } 27 | 28 | 29 | float4 LinePS() : SV_Target 30 | { 31 | return float4( 1, 0, 0, 1 ); 32 | }; 33 | --------------------------------------------------------------------------------