Compare commits

...

30 commits
clean ... main

Author SHA1 Message Date
0e37c40a5e remove useless stuff from agent's main 2024-12-03 03:45:20 -05:00
96329923f6 move client and test minifb client code to seperate crates 2024-12-02 17:01:21 -05:00
0024f49df9 cleanup client 2024-12-02 16:44:11 -05:00
51af8d2f14 remove old CaptureFrame() api 2024-12-02 16:34:05 -05:00
e0e56026cb oops 2024-12-02 16:30:52 -05:00
90054015a2 bleh 2024-12-02 16:30:25 -05:00
af21cd3686 update readme 2024-12-02 03:35:15 -05:00
f04338fd2b add doc to a bit more 2024-12-02 03:27:59 -05:00
ec1649197c jazz up Rust bindings, document some 2024-12-02 03:26:01 -05:00
ea76b9f9d8 remove unneeded sdk inc/lib files 2024-12-02 01:55:14 -05:00
ba5ccea2fe heavily simplified main loop 2024-12-02 01:43:14 -05:00
5de6726140 Only copy changed tiles
this reduces the average CPU usage of the agent. Pretty cool.
2024-12-02 00:40:45 -05:00
758df315a1 working ivshmem setup 2024-12-01 22:08:11 -05:00
7a6ef52144 ivshmem work 2024-12-01 19:24:43 -05:00
11766f6385 clean up nvfbclibrary more 2024-12-01 01:39:48 -05:00
599472a176 agent-vs2022/ -> agent/ 2024-11-30 04:01:03 -05:00
c6ce36e2f0 Add README 2024-11-30 04:00:17 -05:00
af557a0dba Make vs2022 path shared 2024-11-30 03:54:47 -05:00
26fca2525c rename capture interface 2024-11-30 01:24:50 -05:00
3521879ced Clean up NvFBC interfaces 2024-11-30 01:03:26 -05:00
80190c40af remove old agent sources 2024-11-30 00:40:49 -05:00
182266ec3c agent built with clang + vs2022 libs
a better compiler. also i dont need a seperate dev machine with vs 2013 installed anymore, thank god
2024-11-30 00:40:18 -05:00
e0e78a92e9 switch protocol a bit
a frame is now
[N tiles]
then the whole framebuffer

not great for bandwidth, but it's tolerable enough and the performance of it is vastly better.
at some point we can use ivshmem to sidestep that and just make it a cpu->cpu copy I guess
2024-11-27 22:15:36 -05:00
9e1e9ddf02 fix nvfbc sdk header for correct windows.h casing 2024-11-27 21:59:20 -05:00
f0b8310822 dont need to init twice 2024-11-24 13:25:45 -05:00
d185b0e855 retapped 2024-11-23 21:46:39 -05:00
c373de1571 warnings SUCK 2024-11-23 21:31:15 -05:00
2f2114aca3 retappingly 2024-11-23 21:30:39 -05:00
c1bb08c31f agent: LARGE cleanup
interfaces are like a good thing.
2024-11-23 21:29:59 -05:00
4a37a97fee fixed agent gitignore 2024-11-23 11:52:13 -05:00
56 changed files with 1928 additions and 17514 deletions

15
.gitignore vendored
View file

@ -1,6 +1,11 @@
/target
/client/target
/testclient/target
/agent/*.sdf
/agent/x64
/agent/**/x64
/agent/ipch
# agent
/agent/.cache
/agent/bin
/agent/obj
/agent/compile_commands.json
# test stuff
/shared/src/test

View file

@ -1,8 +0,0 @@
[package]
name = "fbcserver"
version = "0.1.0"
edition = "2021"
[dependencies]
byteorder = "1.5.0"
minifb = "0.27.0"

18
README.md Normal file
View file

@ -0,0 +1,18 @@
# Hazelnut
A semi-prototype of CollabVM 3.0 agent functionality (specifically display).
Currently NVIDIA-specific (since we use NvFBC); support for DXGI duplication (for post Win7) should be added at some point.
The agent runs on Windows 7 x64 onwards. Lower (or x86) is currently not supported as a target.
The agent uses IVSHMEM to provide frames to the client in a low-latency fashion.
Later on virtio-serial may be considered for low-bandwidth additional functionality, like input. For now, however, the agent is display only.
This repository contains:
- The agent. Written in C++20.
- Shared headers and utility code, used between the agent and the client. Written in C++20, mostly so it can be shared between the agent and client.
- A Rust crate for Hazelnut clients to use. Wraps the Shared code.
- A test client written in Rust which displays the framebuffer (in a quick-and-dirty fashion.).

View file

@ -1,28 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CollabVMFbcAgent", "CollabVMFbcAgent\CollabVMFbcAgent.vcxproj", "{6DAA666B-B31A-4AE5-BC80-3F1CD728EF3E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6DAA666B-B31A-4AE5-BC80-3F1CD728EF3E}.Debug|Win32.ActiveCfg = Debug|Win32
{6DAA666B-B31A-4AE5-BC80-3F1CD728EF3E}.Debug|Win32.Build.0 = Debug|Win32
{6DAA666B-B31A-4AE5-BC80-3F1CD728EF3E}.Debug|x64.ActiveCfg = Debug|x64
{6DAA666B-B31A-4AE5-BC80-3F1CD728EF3E}.Debug|x64.Build.0 = Debug|x64
{6DAA666B-B31A-4AE5-BC80-3F1CD728EF3E}.Release|Win32.ActiveCfg = Release|Win32
{6DAA666B-B31A-4AE5-BC80-3F1CD728EF3E}.Release|Win32.Build.0 = Release|Win32
{6DAA666B-B31A-4AE5-BC80-3F1CD728EF3E}.Release|x64.ActiveCfg = Release|x64
{6DAA666B-B31A-4AE5-BC80-3F1CD728EF3E}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -1,354 +0,0 @@
// clang-format off
#pragma comment(lib, "ws2_32.lib")
#include <WinSock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <stdio.h>
#include <string>
#include <vector>
#include "Utils.hpp"
#include "NvFBCLibrary.h"
#include <NvFBC/nvFBCToSys.h>
// clang-format on
#pragma pack(push, 1)
enum class MessageType : u32 {
Resize, // tResizeMessage
Data, // tDataMessage
};
struct tMessageHeader {
MessageType type;
u32 datalen;
// data
};
struct tResizeMessage {
u32 width;
u32 height;
};
struct tTile {
u32 tile_x;
u32 tile_y;
u32 tile_width;
u32 tile_height;
// u32 tile_rgba[tile_width*tile_height]
};
struct tDataMessage {
u32 tileCount;
};
#pragma pack(pop)
struct tileRect {
u32 x, y, width, height;
};
// client for streamserver
class cStreamClient {
SOCKET tcpSocket { -1 };
public:
cStreamClient() = default;
~cStreamClient() {
if(tcpSocket != -1) {
closesocket(tcpSocket);
tcpSocket = -1;
}
}
bool Connect(const char* address, int port) {
tcpSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if(tcpSocket == -1) {
return false;
}
sockaddr_in clientSvc {};
clientSvc.sin_family = AF_INET;
inet_pton(AF_INET, address, &clientSvc.sin_addr.s_addr);
// clientSvc.sin_addr.s_addr = inet_addr(address);
clientSvc.sin_port = htons(port);
if(connect(tcpSocket, (SOCKADDR*)&clientSvc, sizeof(clientSvc)) == SOCKET_ERROR) {
printf("No connection socket. Fuck you\n");
return false;
}
// disable Nagle's alrogithm
int nodelay = 1;
setsockopt(tcpSocket, IPPROTO_TCP, TCP_NODELAY, (const char*)&nodelay, sizeof(nodelay));
return true;
}
void SendResize(const tResizeMessage& resize) {
tMessageHeader header;
header.type = MessageType::Resize;
header.datalen = sizeof(tResizeMessage);
send(tcpSocket, (const char*)&header, sizeof(header), 0);
send(tcpSocket, (const char*)&resize, sizeof(resize), 0);
}
void SendData(const unique_buffer<u32>& data, u32 width, u32 height, const std::vector<tileRect>& tiles) {
tMessageHeader header;
header.type = MessageType::Data;
// header.datalen = data.get_size() * sizeof(UINT32);
header.datalen = sizeof(tDataMessage);
auto* pData = data.data();
// send tile header
bool sendFull = false;
tDataMessage dm;
if(tiles.empty()) {
dm.tileCount = 1;
sendFull = true;
} else {
dm.tileCount = (u32)tiles.size();
}
// we have writev() at home
// writev() at home:
send(tcpSocket, (const char*)&header, sizeof(header), 0);
send(tcpSocket, (const char*)&dm, sizeof(dm), 0);
// send each tile
if(!sendFull) {
for(auto& tile : tiles) {
tTile tile_wire { tile.x, tile.y, tile.width, tile.height };
std::vector<u32> data;
data.resize(tile.width * tile.height * 4);
for(u32 y = 0; y < tile.height; ++y) {
auto* pTileLineStart = &pData[(tile.y + y) * width + tile.x];
memcpy(&data[y * tile.width], pTileLineStart, tile.width * sizeof(u32));
}
// send header
send(tcpSocket, (const char*)&tile_wire, (int)sizeof(tile_wire), 0);
send(tcpSocket, (const char*)&data[0], (int)data.size(), 0);
// send data now
/*for (auto y = tile.y; y < tile.y + tile.height; ++y) {
auto* pTileLineStart = &pData[y * width + tile.x];
send(tcpSocket, (const char*)pTileLineStart, tile.width * sizeof(UINT32), 0);
}*/
}
} else {
tTile tDummyTile { 0, 0, width, height };
send(tcpSocket, (const char*)&tDummyTile, sizeof(tDummyTile), 0);
send(tcpSocket, (const char*)&data.data()[0], (i32)(data.get_size() * sizeof(u32)), 0);
}
// send(tcpSocket, (const char*)&data.data()[0], data.get_size() * sizeof(UINT32), 0);
}
};
// FIXME: make this a class, I've clearly got the ability to pull it into one
// stuff
NvFBCLibrary* nvfbcLibrary = nullptr;
NvFBCToSys* nvfbcToSys = nullptr;
// filled in by NVFBC
unsigned char* frameBuffer = nullptr;
unsigned char* diffMap = nullptr;
bool nvfbcSetup() {
//! Setup the frame grab
NVFBC_TOSYS_SETUP_PARAMS fbcSysSetupParams = { 0 };
fbcSysSetupParams.dwVersion = NVFBC_TOSYS_SETUP_PARAMS_VER;
fbcSysSetupParams.eMode = NVFBC_TOSYS_ARGB;
fbcSysSetupParams.bWithHWCursor = true;
fbcSysSetupParams.ppBuffer = (void**)&frameBuffer;
// enable a 32x32 difference map
fbcSysSetupParams.bDiffMap = TRUE;
fbcSysSetupParams.ppDiffMap = (void**)&diffMap;
fbcSysSetupParams.eDiffMapBlockSize = NVFBC_TOSYS_DIFFMAP_BLOCKSIZE_32X32;
auto status = nvfbcToSys->NvFBCToSysSetUp(&fbcSysSetupParams);
return status == NVFBC_SUCCESS;
}
void nvfbcDestroy() {
if(nvfbcToSys) {
nvfbcToSys->NvFBCToSysRelease();
diffMap = nullptr;
frameBuffer = nullptr;
}
}
bool nvfbcCreate() {
if(nvfbcToSys) {
nvfbcDestroy();
}
DWORD maxDisplayWidth = -1, maxDisplayHeight = -1;
//! Create an instance of NvFBCToSys
nvfbcToSys = (NvFBCToSys*)nvfbcLibrary->create(NVFBC_TO_SYS, &maxDisplayWidth, &maxDisplayHeight);
if(!nvfbcToSys) {
return false;
}
return true;
}
int main(int argc, char** argv) {
WSADATA data;
if(WSAStartup(MAKEWORD(2, 2), &data) != NO_ERROR) {
return 1;
}
cStreamClient* client = new cStreamClient();
if(!client->Connect("192.168.1.149", 9438)) {
printf("conn failed\n");
return 1;
}
nvfbcLibrary = new NvFBCLibrary();
//! Load NvFBC
if(!nvfbcLibrary->load()) {
fprintf(stderr, "Unable to load the NvFBC library\n");
return -1;
}
if(!nvfbcCreate()) {
fprintf(stderr, "Unable to create an instance of NvFBC\n");
return -1;
}
u32 width = 0;
u32 height = 0;
bool firstFrame = true;
NVFBCRESULT status = NVFBC_SUCCESS;
BOOL bRecoveryDone = FALSE;
NvFBCFrameGrabInfo grabInfo;
unique_buffer<u32> buffer;
if(nvfbcSetup()) {
// Sleep so that ToSysSetUp forces a framebuffer update
Sleep(100);
NVFBC_TOSYS_GRAB_FRAME_PARAMS fbcSysGrabParams = { 0 };
std::vector<tileRect> tiles {};
// set up grab parameters
fbcSysGrabParams.dwVersion = NVFBC_TOSYS_GRAB_FRAME_PARAMS_VER;
fbcSysGrabParams.dwFlags = NVFBC_TOSYS_WAIT_WITH_TIMEOUT;
fbcSysGrabParams.dwTargetWidth = 0;
fbcSysGrabParams.dwTargetHeight = 0;
fbcSysGrabParams.dwStartX = 0;
fbcSysGrabParams.dwStartY = 0;
fbcSysGrabParams.eGMode = NVFBC_TOSYS_SOURCEMODE_FULL;
fbcSysGrabParams.pNvFBCFrameGrabInfo = &grabInfo;
fbcSysGrabParams.dwWaitTime = 16;
while(true) {
// Grab the frame
status = nvfbcToSys->NvFBCToSysGrabFrame(&fbcSysGrabParams);
if(status == NVFBC_SUCCESS) {
bRecoveryDone = FALSE;
// handle resizing the buffer
if(width != grabInfo.dwWidth || height != grabInfo.dwHeight) {
width = grabInfo.dwWidth;
height = grabInfo.dwHeight;
buffer.resize(grabInfo.dwWidth * grabInfo.dwHeight);
firstFrame = true;
client->SendResize(tResizeMessage { width, height });
}
// splat the data into an unpadded buffer
// REMOVE THIS
for(u32 y = 0; y < grabInfo.dwHeight; ++y) {
memcpy(&buffer.data()[y * grabInfo.dwWidth], &frameBuffer[(y * grabInfo.dwBufferWidth) * 4], grabInfo.dwWidth * 4);
}
tiles.clear();
// diffmap
if(firstFrame == false) {
u32 dwDiffMapWidth = (u32)ceil((f32)width / 32);
u32 dwDiffMapHeight = (u32)ceil((f32)height / 32);
for(u32 y = 0; y < dwDiffMapHeight; ++y) {
for(u32 x = 0; x < dwDiffMapWidth; ++x) {
auto& bl = diffMap[y * dwDiffMapWidth + x];
if(bl != 0) {
tiles.push_back(tileRect {
x * (width / dwDiffMapWidth), // x
y * (height / dwDiffMapHeight), // y
width / dwDiffMapWidth, // width
height / dwDiffMapHeight // height
});
}
}
}
}
// send that to the server
client->SendData(buffer, width, height, tiles);
if(firstFrame)
firstFrame = false;
} else {
if(bRecoveryDone == TRUE) {
fprintf(stderr, "Unable to recover from NvFBC Frame grab failure.\n");
break;
}
if(status == NVFBC_ERROR_DYNAMIC_DISABLE) {
fprintf(stderr, "NvFBC disabled. Quitting\n");
break;
}
// Try to recover the session
if(status == NVFBC_ERROR_INVALIDATED_SESSION) {
fprintf(stderr, "Session Invalidated. Attempting recovery\n");
if(!nvfbcCreate()) {
fprintf(stderr, "Unable to re-create NvFBC\n");
break;
}
if(nvfbcSetup()) {
bRecoveryDone = TRUE;
} else {
fprintf(stderr, "Unable to recover from NvFBC Frame grab failure.\n");
break;
}
}
}
}
}
if(status != NVFBC_SUCCESS) {
fprintf(stderr, "Unable to setup frame grab.\n");
}
nvfbcDestroy();
delete client;
delete nvfbcLibrary;
return 0;
}

View file

@ -1,166 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6DAA666B-B31A-4AE5-BC80-3F1CD728EF3E}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>CollabVMFbcAgent</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)sdk\Inc</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)sdk\Inc</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)sdk\inc</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)sdk\inc</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="NvFBCLibrary.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="Utils.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CollabVMFbcAgent.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="NvFBCLibrary.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Utils.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CollabVMFbcAgent.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -1,201 +0,0 @@
#pragma once
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
#include <string>
#include "NvFBC/nvFBC.h"
#define NVFBC64_LIBRARY_NAME "NvFBC64.dll"
#define NVFBC_LIBRARY_NAME "NvFBC.dll"
// Wraps loading and using NvFBC
class NvFBCLibrary {
NvFBCLibrary(const NvFBCLibrary&);
NvFBCLibrary& operator=(const NvFBCLibrary&);
public:
NvFBCLibrary() : m_handle(NULL), pfn_get_status(NULL), pfn_create(NULL), pfn_enable(NULL) {}
~NvFBCLibrary() {
if(NULL != m_handle)
close();
}
// Attempts to load NvFBC from system directory.
// on 32-bit OS: looks for NvFBC.dll in system32
// for 32-bit app on 64-bit OS: looks for NvFBC.dll in syswow64
// for 64-bit app on 64-bit OS: looks for NvFBC64.dll in system32
bool load(std::string fileName = std::string()) {
if(NULL != m_handle)
return true;
if(!fileName.empty())
m_handle = ::LoadLibraryA(fileName.c_str());
if(NULL == m_handle) {
m_handle = ::LoadLibraryA(getDefaultPath().c_str());
}
if(NULL == m_handle) {
fprintf(stderr, "Unable to load NvFBC.\n");
return false;
}
// Load the three functions exported by NvFBC
pfn_create = (NvFBC_CreateFunctionExType)::GetProcAddress(m_handle, "NvFBC_CreateEx");
pfn_set_global_flags = (NvFBC_SetGlobalFlagsType)::GetProcAddress(m_handle, "NvFBC_SetGlobalFlags");
pfn_get_status = (NvFBC_GetStatusExFunctionType)::GetProcAddress(m_handle, "NvFBC_GetStatusEx");
pfn_enable = (NvFBC_EnableFunctionType)::GetProcAddress(m_handle, "NvFBC_Enable");
if((NULL == pfn_create) || (NULL == pfn_set_global_flags) || (NULL == pfn_get_status) || (NULL == pfn_enable)) {
fprintf(stderr, "Unable to load the NvFBC function pointers.\n");
close();
return false;
}
return true;
}
// Close the NvFBC dll
void close() {
if(NULL != m_handle)
FreeLibrary(m_handle);
m_handle = NULL;
pfn_create = NULL;
pfn_get_status = NULL;
pfn_enable = NULL;
}
// Get the status for the provided adapter, if no adapter is
// provided the default adapter is used.
NVFBCRESULT getStatus(NvFBCStatusEx* status) { return pfn_get_status((void*)status); }
// Sets the global flags for the provided adapter, if
// no adapter is provided the default adapter is used
void setGlobalFlags(DWORD flags, int adapter = 0) {
setTargetAdapter(adapter);
pfn_set_global_flags(flags);
}
// Creates an instance of the provided NvFBC type if possible
NVFBCRESULT createEx(NvFBCCreateParams* pParams) { return pfn_create((void*)pParams); }
// Creates an instance of the provided NvFBC type if possible.
void* create(DWORD type, DWORD* maxWidth, DWORD* maxHeight, int adapter = 0, void* devicePtr = NULL) {
if(NULL == m_handle)
return NULL;
NVFBCRESULT res = NVFBC_SUCCESS;
NvFBCStatusEx status = { 0 };
status.dwVersion = NVFBC_STATUS_VER;
status.dwAdapterIdx = adapter;
res = getStatus(&status);
if(res != NVFBC_SUCCESS) {
fprintf(stderr, "NvFBC not supported on this device + driver.\r\n");
return NULL;
}
// Check to see if the device and driver are supported
if(!status.bIsCapturePossible) {
fprintf(stderr, "Unsupported device or driver.\r\n");
return NULL;
}
// Check to see if an instance can be created
if(!status.bCanCreateNow) {
fprintf(stderr, "Unable to create an instance of NvFBC.\r\n");
return NULL;
}
NvFBCCreateParams createParams;
memset(&createParams, 0, sizeof(createParams));
createParams.dwVersion = NVFBC_CREATE_PARAMS_VER;
createParams.dwInterfaceType = type;
createParams.pDevice = devicePtr;
createParams.dwAdapterIdx = adapter;
res = pfn_create(&createParams);
*maxWidth = createParams.dwMaxDisplayWidth;
*maxHeight = createParams.dwMaxDisplayHeight;
return createParams.pNvFBC;
}
// enable/disable NVFBC
void enable(NVFBC_STATE nvFBCState) {
NVFBCRESULT res = NVFBC_SUCCESS;
res = pfn_enable(nvFBCState);
if(res != NVFBC_SUCCESS) {
fprintf(stderr, "Failed to %s. Insufficient privilege\n", nvFBCState == 0 ? "disable" : "enable");
return;
} else {
fprintf(stdout, "NvFBC is %s\n", nvFBCState == 0 ? "disabled" : "enabled");
return;
}
}
protected:
// Get the default NvFBC library path
typedef BOOL(WINAPI* pfnIsWow64Process)(HANDLE, PBOOL);
pfnIsWow64Process fnIsWow64Process;
BOOL IsWow64() {
BOOL bIsWow64 = FALSE;
fnIsWow64Process = (pfnIsWow64Process)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "IsWow64Process");
if(NULL != fnIsWow64Process) {
if(!fnIsWow64Process(GetCurrentProcess(), &bIsWow64)) {
bIsWow64 = false;
}
}
return bIsWow64;
}
std::string getDefaultPath() {
std::string defaultPath;
size_t pathSize;
char* libPath;
if(0 != _dupenv_s(&libPath, &pathSize, "SystemRoot")) {
fprintf(stderr, "Unable to get the SystemRoot environment variable\n");
return defaultPath;
}
if(0 == pathSize) {
fprintf(stderr, "The SystemRoot environment variable is not set\n");
return defaultPath;
}
#ifdef _WIN64
defaultPath = std::string(libPath) + "\\System32\\" + NVFBC64_LIBRARY_NAME;
#else
if(IsWow64()) {
defaultPath = std::string(libPath) + "\\Syswow64\\" + NVFBC_LIBRARY_NAME;
} else {
defaultPath = std::string(libPath) + "\\System32\\" + NVFBC_LIBRARY_NAME;
}
#endif
return defaultPath;
}
void setTargetAdapter(int adapter = 0) {
char targetAdapter[10] = { 0 };
_snprintf_s(targetAdapter, 10, 9, "%d", adapter);
SetEnvironmentVariableA("NVFBC_TARGET_ADAPTER", targetAdapter);
}
protected:
HMODULE m_handle;
NvFBC_GetStatusExFunctionType pfn_get_status;
NvFBC_SetGlobalFlagsType pfn_set_global_flags;
NvFBC_CreateFunctionExType pfn_create;
NvFBC_EnableFunctionType pfn_enable;
};

View file

@ -1 +0,0 @@
bleh

View file

@ -1,8 +0,0 @@
// stdafx.cpp : source file that includes just the standard includes
// CollabVMFbcAgent.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View file

@ -1,15 +0,0 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here

View file

@ -1,8 +0,0 @@
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>

90
agent/Makefile Normal file
View file

@ -0,0 +1,90 @@
include build/arch.mk
include build/configs.mk
NAME = hazelnut_agent
BINDIR = bin/$(ARCH)/$(CONFIG)
OBJDIR = obj/$(ARCH)/$(CONFIG)
VPATH = src/crt \
src/base \
src/ \
../shared/src
# Objects for crt
OBJS_STARTUP := $(OBJDIR)/crt0.o \
$(OBJDIR)/ctors.o \
$(OBJDIR)/exit.o
# Objects for base/ library
OBJS_BASELIB :=
OBJS := $(OBJDIR)/capture.o \
$(OBJDIR)/capture_nvfbc.o \
$(OBJDIR)/nvfbc_library.o \
$(OBJDIR)/ivshmem.o \
$(OBJDIR)/main.o \
LINK_LIBS := $(VS2022_PATH)/ucrt/lib/$(ARCH)/libucrt$(D).lib \
$(VS2022_PATH)/crt/lib/$(ARCH)/libcmt$(D).lib \
$(VS2022_PATH)/crt/lib/$(ARCH)/libcpmt$(D).lib \
$(VS2022_PATH)/crt/lib/$(ARCH)/libvcruntime$(D).lib \
$(VS2022_PATH)/winsdk/lib/$(ARCH)/kernel32.lib \
$(VS2022_PATH)/winsdk/lib/$(ARCH)/user32.lib \
$(VS2022_PATH)/winsdk/lib/$(ARCH)/comctl32.lib \
$(VS2022_PATH)/winsdk/lib/$(ARCH)/setupapi.lib \
.PHONY: all dumpinfo clean matrix
all: dumpinfo $(BINDIR)/$(NAME).exe
publish: $(BINDIR)/$(NAME).exe
cp -rv bin /data/sda/shit/Release/clangent
chmod -Rvv 777 /data/sda/shit/Release/clangent
publish2: $(BINDIR)/$(NAME).exe
cp -rv bin/ /data/sda/shit/Release/ivshtest/
chmod -Rvv 777 /data/sda/shit/Release/ivshtest
dumpinfo:
echo -e "\e[96mBuilding configuration $(CONFIG) for arch $(ARCH) \e[0m"
matrix:
# $(MAKE) ARCH=x86 CONFIG=Debug
# $(MAKE) ARCH=x86 CONFIG=Release
$(MAKE) ARCH=x64 CONFIG=Debug
$(MAKE) ARCH=x64 CONFIG=Release
# dir rules
$(BINDIR)/:
echo -e "\e[95mMKDIR $@\e[0m"
mkdir -p $(BINDIR)
$(OBJDIR)/:
echo -e "\e[95mMKDIR $@\e[0m"
mkdir -p $(OBJDIR)
$(BINDIR)/$(NAME).exe: $(BINDIR)/ $(OBJDIR)/ $(OBJS)
echo -e "\e[92mLinking binary $@\e[0m"
$(LD) /nodefaultlib /subsystem:console,6.1 /out:$@ $(LINK_LIBS) $(OBJS)
# todo: stuff rules in build/
$(OBJDIR)/%.o: %.c
echo -e "\e[94mCompiling C source file $< ($@)\e[0m"
$(CC) -c $(BASE_CCFLAGS) -Isdk/inc $($(CONFIG)_CCFLAGS) $< -o $@
$(OBJDIR)/%.o: %.cpp
echo -e "\e[94mCompiling C++ source file $< ($@)\e[0m"
$(CC) -c $(BASE_CXXFLAGS) -Isdk/inc $($(CONFIG)_CXXFLAGS) $< -o $@
$(OBJDIR)/%.o: res/%.rc
echo -e "\e[94mCompiling Windows resource script $<\e[0m"
$(RC) $(RC_INCLUDES) /FO $@ $<
clean: dumpinfo
echo -e "\e[91mCleaning... \e[0m"
rm -rf $(BINDIR)/ $(OBJDIR)/
$V.SILENT:

20
agent/build/arch.mk Normal file
View file

@ -0,0 +1,20 @@
#x86_Valid=yes # FOR NOW
#x86_TRIPLET=i686-pc-msvc-windows
x64_Valid=yes
x64_TRIPLET=x86_64-pc-msvc-windows
ifeq ($(ARCH),)
ARCH = x64
endif
ifneq ($($(ARCH)_Valid),yes)
$(error Please select a valid target)
endif
# if we really need C
CC = clang --target=$($(ARCH)_TRIPLET)
CXX = clang++ --target=$($(ARCH)_TRIPLET)
LD := lld-link
RC := llvm-rc

41
agent/build/configs.mk Normal file
View file

@ -0,0 +1,41 @@
# Base compiler flags. Only change if you *explicitly* know what you're doing.
# replace this
VS2022_PATH := ~/vs2022
RC_INCLUDES := /I $(VS2022_PATH)/winsdk/include/um /I $(VS2022_PATH)/winsdk/include/shared
SDK_INCLUDES := -isystem $(VS2022_PATH)/ucrt/include -isystem $(VS2022_PATH)/crt/include -isystem $(VS2022_PATH)/winsdk/include/shared -isystem $(VS2022_PATH)/winsdk/include/um
# Windows 6.1
BASE_CCFLAGS := $(SDK_INCLUDES) -D_WIN32_WINNT=0x0601 -Ires -std=c17
BASE_CXXFLAGS := $(SDK_INCLUDES) -D_CRT_SECURE_NO_WARNINGS -fno-exceptions -fno-rtti -D_WIN32_WINNT=0x0601 -I../shared/src -Isrc -Ires -std=c++23
Release_Valid = yes
Release_CCFLAGS = -O3 -ffast-math -DNDEBUG
Release_CXXFLAGS = -O3 -ffast-math -DNDEBUG
#-ffunction-sections -fdata-sections
Release_LDFLAGS = -s
#-Wl,--gc-sections
Debug_Valid = yes
Debug_CCFLAGS = -O0 -g -D_DEBUG
Debug_CXXFLAGS = -O0 -g -D_DEBUG -D_ITERATOR_DEBUG_LEVEL=2
Debug_LDFLAGS =
# select a default configuration or validate configuration
ifeq ($(CONFIG),)
CONFIG = Release
endif
ifneq ($($(CONFIG)_Valid),yes)
$(error Please select a valid configuration)
endif
# for debug msvc libs. FUCK microsoft
ifeq ($(CONFIG),Debug)
D = d
else
D =
endif

View file

@ -1,506 +0,0 @@
/************************************************************************************************************************************\
|* *|
|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *|
|* *|
|* NOTICE TO USER: *|
|* *|
|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *|
|* *|
|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *|
|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *|
|* Otherwise, you have no rights to use or access this software in any manner. *|
|* *|
|* If not covered by the applicable NVIDIA software license agreement: *|
|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *|
|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *|
|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *|
|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *|
|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *|
|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *|
|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *|
|* *|
|* U.S. Government End Users. *|
|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *|
|* consisting of "commercial computer software" and "commercial computer software documentation" *|
|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *|
|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *|
|* all U.S. Government End Users acquire the software with only those rights set forth herein. *|
|* *|
|* Any use of this software in individual and commercial software must include, *|
|* in the user documentation and internal comments to the code, *|
|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *|
|* *|
\************************************************************************************************************************************/
#pragma once
#include"nvapi_lite_salstart.h"
#pragma pack(push,8)
#ifdef __cplusplus
extern "C" {
#endif
#if (defined(WIN32) || defined(_WIN32)) && defined(_MSC_VER) && (_MSC_VER > 1399) && !defined(NVAPI_INTERNAL) && !defined(NVAPI_DEPRECATED_OLD)
#ifndef __nvapi_deprecated_function
#define __nvapi_deprecated_function(message) __declspec(deprecated(message))
#endif
#ifndef __nvapi_deprecated_datatype
#define __nvapi_deprecated_datatype(FirstRelease) __declspec(deprecated("Do not use this data type - it is deprecated in release " #FirstRelease "."))
#endif
#else
#ifndef __nvapi_deprecated_function
#define __nvapi_deprecated_function(message)
#endif
#ifndef __nvapi_deprecated_datatype
#define __nvapi_deprecated_datatype(FirstRelease)
#endif
#endif
/* 64-bit types for compilers that support them, plus some obsolete variants */
#if defined(__GNUC__) || defined(__arm) || defined(__IAR_SYSTEMS_ICC__) || defined(__ghs__) || defined(_WIN64)
typedef unsigned long long NvU64; /* 0 to 18446744073709551615 */
typedef long long NvS64; /* -9223372036854775808 to 9223372036854775807 */
#else
typedef unsigned __int64 NvU64; /* 0 to 18446744073709551615 */
typedef __int64 NvS64; /* -9223372036854775808 to 9223372036854775807 */
#endif
// mac os 32-bit still needs this
#if (defined(macintosh) || defined(__APPLE__)) && !defined(__LP64__)
typedef signed long NvS32; /* -2147483648 to 2147483647 */
#else
typedef signed int NvS32; /* -2147483648 to 2147483647 */
#endif
// mac os 32-bit still needs this
#if ( (defined(macintosh) && defined(__LP64__) && (__NVAPI_RESERVED0__)) || \
(!defined(macintosh) && defined(__NVAPI_RESERVED0__)) )
typedef unsigned int NvU32; /* 0 to 4294967295 */
#else
typedef unsigned long NvU32; /* 0 to 4294967295 */
#endif
typedef signed short NvS16;
typedef unsigned short NvU16;
typedef unsigned char NvU8;
typedef signed char NvS8;
typedef struct _NV_RECT
{
NvU32 left;
NvU32 top;
NvU32 right;
NvU32 bottom;
} NV_RECT;
#define NV_DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
//! \addtogroup nvapihandles
//! NVAPI Handles - These handles are retrieved from various calls and passed in to others in NvAPI
//! These are meant to be opaque types. Do not assume they correspond to indices, HDCs,
//! display indexes or anything else.
//!
//! Most handles remain valid until a display re-configuration (display mode set) or GPU
//! reconfiguration (going into or out of SLI modes) occurs. If NVAPI_HANDLE_INVALIDATED
//! is received by an app, it should discard all handles, and re-enumerate them.
//! @{
NV_DECLARE_HANDLE(NvDisplayHandle); //!< Display Device driven by NVIDIA GPU(s) (an attached display)
NV_DECLARE_HANDLE(NvMonitorHandle); //!< Monitor handle
NV_DECLARE_HANDLE(NvUnAttachedDisplayHandle); //!< Unattached Display Device driven by NVIDIA GPU(s)
NV_DECLARE_HANDLE(NvLogicalGpuHandle); //!< One or more physical GPUs acting in concert (SLI)
NV_DECLARE_HANDLE(NvPhysicalGpuHandle); //!< A single physical GPU
NV_DECLARE_HANDLE(NvEventHandle); //!< A handle to an event registration instance
NV_DECLARE_HANDLE(NvVisualComputingDeviceHandle); //!< A handle to a Visual Computing Device
NV_DECLARE_HANDLE(NvHICHandle); //!< A handle to a Host Interface Card
NV_DECLARE_HANDLE(NvGSyncDeviceHandle); //!< A handle to a Sync device
NV_DECLARE_HANDLE(NvVioHandle); //!< A handle to an SDI device
NV_DECLARE_HANDLE(NvTransitionHandle); //!< A handle to address a single transition request
NV_DECLARE_HANDLE(NvAudioHandle); //!< NVIDIA HD Audio Device
NV_DECLARE_HANDLE(Nv3DVPContextHandle); //!< A handle for a 3D Vision Pro (3DVP) context
NV_DECLARE_HANDLE(Nv3DVPTransceiverHandle); //!< A handle for a 3DVP RF transceiver
NV_DECLARE_HANDLE(Nv3DVPGlassesHandle); //!< A handle for a pair of 3DVP RF shutter glasses
typedef void* StereoHandle; //!< A stereo handle, that corresponds to the device interface
NV_DECLARE_HANDLE(NvSourceHandle); //!< Unique source handle on the system
NV_DECLARE_HANDLE(NvTargetHandle); //!< Unique target handle on the system
NV_DECLARE_HANDLE(NVDX_SwapChainHandle); //!< DirectX SwapChain objects
static const NVDX_SwapChainHandle NVDX_SWAPCHAIN_NONE = 0;
//! @}
//! \ingroup nvapihandles
//! @{
#define NVAPI_DEFAULT_HANDLE 0
#define NV_BIT(x) (1 << (x))
//! @}
//! \addtogroup nvapitypes
//! @{
#define NVAPI_GENERIC_STRING_MAX 4096
#define NVAPI_LONG_STRING_MAX 256
#define NVAPI_SHORT_STRING_MAX 64
typedef struct
{
NvS32 sX;
NvS32 sY;
NvS32 sWidth;
NvS32 sHeight;
} NvSBox;
#ifndef NvGUID_Defined
#define NvGUID_Defined
typedef struct
{
NvU32 data1;
NvU16 data2;
NvU16 data3;
NvU8 data4[8];
} NvGUID, NvLUID;
#endif //#ifndef NvGUID_Defined
#define NVAPI_MAX_PHYSICAL_GPUS 64
#define NVAPI_MAX_PHYSICAL_BRIDGES 100
#define NVAPI_PHYSICAL_GPUS 32
#define NVAPI_MAX_LOGICAL_GPUS 64
#define NVAPI_MAX_AVAILABLE_GPU_TOPOLOGIES 256
#define NVAPI_MAX_AVAILABLE_SLI_GROUPS 256
#define NVAPI_MAX_GPU_TOPOLOGIES NVAPI_MAX_PHYSICAL_GPUS
#define NVAPI_MAX_GPU_PER_TOPOLOGY 8
#define NVAPI_MAX_DISPLAY_HEADS 2
#define NVAPI_ADVANCED_DISPLAY_HEADS 4
#define NVAPI_MAX_DISPLAYS NVAPI_PHYSICAL_GPUS * NVAPI_ADVANCED_DISPLAY_HEADS
#define NVAPI_MAX_ACPI_IDS 16
#define NVAPI_MAX_VIEW_MODES 8
#define NV_MAX_HEADS 4 //!< Maximum heads, each with NVAPI_DESKTOP_RES resolution
#define NVAPI_MAX_HEADS_PER_GPU 32
#define NV_MAX_HEADS 4 //!< Maximum number of heads, each with #NVAPI_DESKTOP_RES resolution
#define NV_MAX_VID_STREAMS 4 //!< Maximum number of input video streams, each with a #NVAPI_VIDEO_SRC_INFO
#define NV_MAX_VID_PROFILES 4 //!< Maximum number of output video profiles supported
#define NVAPI_SYSTEM_MAX_DISPLAYS NVAPI_MAX_PHYSICAL_GPUS * NV_MAX_HEADS
#define NVAPI_SYSTEM_MAX_HWBCS 128
#define NVAPI_SYSTEM_HWBC_INVALID_ID 0xffffffff
#define NVAPI_MAX_AUDIO_DEVICES 16
typedef char NvAPI_String[NVAPI_GENERIC_STRING_MAX];
typedef char NvAPI_LongString[NVAPI_LONG_STRING_MAX];
typedef char NvAPI_ShortString[NVAPI_SHORT_STRING_MAX];
//! @}
// =========================================================================================
//! NvAPI Version Definition \n
//! Maintain per structure specific version define using the MAKE_NVAPI_VERSION macro. \n
//! Usage: #define NV_GENLOCK_STATUS_VER MAKE_NVAPI_VERSION(NV_GENLOCK_STATUS, 1)
//! \ingroup nvapitypes
// =========================================================================================
#define MAKE_NVAPI_VERSION(typeName,ver) (NvU32)(sizeof(typeName) | ((ver)<<16))
//! \ingroup nvapitypes
#define GET_NVAPI_VERSION(ver) (NvU32)((ver)>>16)
//! \ingroup nvapitypes
#define GET_NVAPI_SIZE(ver) (NvU32)((ver) & 0xffff)
// ====================================================
//! NvAPI Status Values
//! All NvAPI functions return one of these codes.
//! \ingroup nvapistatus
// ====================================================
typedef enum _NvAPI_Status
{
NVAPI_OK = 0, //!< Success. Request is completed.
NVAPI_ERROR = -1, //!< Generic error
NVAPI_LIBRARY_NOT_FOUND = -2, //!< NVAPI support library cannot be loaded.
NVAPI_NO_IMPLEMENTATION = -3, //!< not implemented in current driver installation
NVAPI_API_NOT_INITIALIZED = -4, //!< NvAPI_Initialize has not been called (successfully)
NVAPI_INVALID_ARGUMENT = -5, //!< The argument/parameter value is not valid or NULL.
NVAPI_NVIDIA_DEVICE_NOT_FOUND = -6, //!< No NVIDIA display driver, or NVIDIA GPU driving a display, was found.
NVAPI_END_ENUMERATION = -7, //!< No more items to enumerate
NVAPI_INVALID_HANDLE = -8, //!< Invalid handle
NVAPI_INCOMPATIBLE_STRUCT_VERSION = -9, //!< An argument's structure version is not supported
NVAPI_HANDLE_INVALIDATED = -10, //!< The handle is no longer valid (likely due to GPU or display re-configuration)
NVAPI_OPENGL_CONTEXT_NOT_CURRENT = -11, //!< No NVIDIA OpenGL context is current (but needs to be)
NVAPI_INVALID_POINTER = -14, //!< An invalid pointer, usually NULL, was passed as a parameter
NVAPI_NO_GL_EXPERT = -12, //!< OpenGL Expert is not supported by the current drivers
NVAPI_INSTRUMENTATION_DISABLED = -13, //!< OpenGL Expert is supported, but driver instrumentation is currently disabled
NVAPI_NO_GL_NSIGHT = -15, //!< OpenGL does not support Nsight
NVAPI_EXPECTED_LOGICAL_GPU_HANDLE = -100, //!< Expected a logical GPU handle for one or more parameters
NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE = -101, //!< Expected a physical GPU handle for one or more parameters
NVAPI_EXPECTED_DISPLAY_HANDLE = -102, //!< Expected an NV display handle for one or more parameters
NVAPI_INVALID_COMBINATION = -103, //!< The combination of parameters is not valid.
NVAPI_NOT_SUPPORTED = -104, //!< Requested feature is not supported in the selected GPU
NVAPI_PORTID_NOT_FOUND = -105, //!< No port ID was found for the I2C transaction
NVAPI_EXPECTED_UNATTACHED_DISPLAY_HANDLE = -106, //!< Expected an unattached display handle as one of the input parameters.
NVAPI_INVALID_PERF_LEVEL = -107, //!< Invalid perf level
NVAPI_DEVICE_BUSY = -108, //!< Device is busy; request not fulfilled
NVAPI_NV_PERSIST_FILE_NOT_FOUND = -109, //!< NV persist file is not found
NVAPI_PERSIST_DATA_NOT_FOUND = -110, //!< NV persist data is not found
NVAPI_EXPECTED_TV_DISPLAY = -111, //!< Expected a TV output display
NVAPI_EXPECTED_TV_DISPLAY_ON_DCONNECTOR = -112, //!< Expected a TV output on the D Connector - HDTV_EIAJ4120.
NVAPI_NO_ACTIVE_SLI_TOPOLOGY = -113, //!< SLI is not active on this device.
NVAPI_SLI_RENDERING_MODE_NOTALLOWED = -114, //!< Setup of SLI rendering mode is not possible right now.
NVAPI_EXPECTED_DIGITAL_FLAT_PANEL = -115, //!< Expected a digital flat panel.
NVAPI_ARGUMENT_EXCEED_MAX_SIZE = -116, //!< Argument exceeds the expected size.
NVAPI_DEVICE_SWITCHING_NOT_ALLOWED = -117, //!< Inhibit is ON due to one of the flags in NV_GPU_DISPLAY_CHANGE_INHIBIT or SLI active.
NVAPI_TESTING_CLOCKS_NOT_SUPPORTED = -118, //!< Testing of clocks is not supported.
NVAPI_UNKNOWN_UNDERSCAN_CONFIG = -119, //!< The specified underscan config is from an unknown source (e.g. INF)
NVAPI_TIMEOUT_RECONFIGURING_GPU_TOPO = -120, //!< Timeout while reconfiguring GPUs
NVAPI_DATA_NOT_FOUND = -121, //!< Requested data was not found
NVAPI_EXPECTED_ANALOG_DISPLAY = -122, //!< Expected an analog display
NVAPI_NO_VIDLINK = -123, //!< No SLI video bridge is present
NVAPI_REQUIRES_REBOOT = -124, //!< NVAPI requires a reboot for the settings to take effect
NVAPI_INVALID_HYBRID_MODE = -125, //!< The function is not supported with the current Hybrid mode.
NVAPI_MIXED_TARGET_TYPES = -126, //!< The target types are not all the same
NVAPI_SYSWOW64_NOT_SUPPORTED = -127, //!< The function is not supported from 32-bit on a 64-bit system.
NVAPI_IMPLICIT_SET_GPU_TOPOLOGY_CHANGE_NOT_ALLOWED = -128, //!< There is no implicit GPU topology active. Use NVAPI_SetHybridMode to change topology.
NVAPI_REQUEST_USER_TO_CLOSE_NON_MIGRATABLE_APPS = -129, //!< Prompt the user to close all non-migratable applications.
NVAPI_OUT_OF_MEMORY = -130, //!< Could not allocate sufficient memory to complete the call.
NVAPI_WAS_STILL_DRAWING = -131, //!< The previous operation that is transferring information to or from this surface is incomplete.
NVAPI_FILE_NOT_FOUND = -132, //!< The file was not found.
NVAPI_TOO_MANY_UNIQUE_STATE_OBJECTS = -133, //!< There are too many unique instances of a particular type of state object.
NVAPI_INVALID_CALL = -134, //!< The method call is invalid. For example, a method's parameter may not be a valid pointer.
NVAPI_D3D10_1_LIBRARY_NOT_FOUND = -135, //!< d3d10_1.dll cannot be loaded.
NVAPI_FUNCTION_NOT_FOUND = -136, //!< Couldn't find the function in the loaded DLL.
NVAPI_INVALID_USER_PRIVILEGE = -137, //!< Current User is not Admin.
NVAPI_EXPECTED_NON_PRIMARY_DISPLAY_HANDLE = -138, //!< The handle corresponds to GDIPrimary.
NVAPI_EXPECTED_COMPUTE_GPU_HANDLE = -139, //!< Setting Physx GPU requires that the GPU is compute-capable.
NVAPI_STEREO_NOT_INITIALIZED = -140, //!< The Stereo part of NVAPI failed to initialize completely. Check if the stereo driver is installed.
NVAPI_STEREO_REGISTRY_ACCESS_FAILED = -141, //!< Access to stereo-related registry keys or values has failed.
NVAPI_STEREO_REGISTRY_PROFILE_TYPE_NOT_SUPPORTED = -142, //!< The given registry profile type is not supported.
NVAPI_STEREO_REGISTRY_VALUE_NOT_SUPPORTED = -143, //!< The given registry value is not supported.
NVAPI_STEREO_NOT_ENABLED = -144, //!< Stereo is not enabled and the function needed it to execute completely.
NVAPI_STEREO_NOT_TURNED_ON = -145, //!< Stereo is not turned on and the function needed it to execute completely.
NVAPI_STEREO_INVALID_DEVICE_INTERFACE = -146, //!< Invalid device interface.
NVAPI_STEREO_PARAMETER_OUT_OF_RANGE = -147, //!< Separation percentage or JPEG image capture quality is out of [0-100] range.
NVAPI_STEREO_FRUSTUM_ADJUST_MODE_NOT_SUPPORTED = -148, //!< The given frustum adjust mode is not supported.
NVAPI_TOPO_NOT_POSSIBLE = -149, //!< The mosaic topology is not possible given the current state of the hardware.
NVAPI_MODE_CHANGE_FAILED = -150, //!< An attempt to do a display resolution mode change has failed.
NVAPI_D3D11_LIBRARY_NOT_FOUND = -151, //!< d3d11.dll/d3d11_beta.dll cannot be loaded.
NVAPI_INVALID_ADDRESS = -152, //!< Address is outside of valid range.
NVAPI_STRING_TOO_SMALL = -153, //!< The pre-allocated string is too small to hold the result.
NVAPI_MATCHING_DEVICE_NOT_FOUND = -154, //!< The input does not match any of the available devices.
NVAPI_DRIVER_RUNNING = -155, //!< Driver is running.
NVAPI_DRIVER_NOTRUNNING = -156, //!< Driver is not running.
NVAPI_ERROR_DRIVER_RELOAD_REQUIRED = -157, //!< A driver reload is required to apply these settings.
NVAPI_SET_NOT_ALLOWED = -158, //!< Intended setting is not allowed.
NVAPI_ADVANCED_DISPLAY_TOPOLOGY_REQUIRED = -159, //!< Information can't be returned due to "advanced display topology".
NVAPI_SETTING_NOT_FOUND = -160, //!< Setting is not found.
NVAPI_SETTING_SIZE_TOO_LARGE = -161, //!< Setting size is too large.
NVAPI_TOO_MANY_SETTINGS_IN_PROFILE = -162, //!< There are too many settings for a profile.
NVAPI_PROFILE_NOT_FOUND = -163, //!< Profile is not found.
NVAPI_PROFILE_NAME_IN_USE = -164, //!< Profile name is duplicated.
NVAPI_PROFILE_NAME_EMPTY = -165, //!< Profile name is empty.
NVAPI_EXECUTABLE_NOT_FOUND = -166, //!< Application not found in the Profile.
NVAPI_EXECUTABLE_ALREADY_IN_USE = -167, //!< Application already exists in the other profile.
NVAPI_DATATYPE_MISMATCH = -168, //!< Data Type mismatch
NVAPI_PROFILE_REMOVED = -169, //!< The profile passed as parameter has been removed and is no longer valid.
NVAPI_UNREGISTERED_RESOURCE = -170, //!< An unregistered resource was passed as a parameter.
NVAPI_ID_OUT_OF_RANGE = -171, //!< The DisplayId corresponds to a display which is not within the normal outputId range.
NVAPI_DISPLAYCONFIG_VALIDATION_FAILED = -172, //!< Display topology is not valid so the driver cannot do a mode set on this configuration.
NVAPI_DPMST_CHANGED = -173, //!< Display Port Multi-Stream topology has been changed.
NVAPI_INSUFFICIENT_BUFFER = -174, //!< Input buffer is insufficient to hold the contents.
NVAPI_ACCESS_DENIED = -175, //!< No access to the caller.
NVAPI_MOSAIC_NOT_ACTIVE = -176, //!< The requested action cannot be performed without Mosaic being enabled.
NVAPI_SHARE_RESOURCE_RELOCATED = -177, //!< The surface is relocated away from video memory.
NVAPI_REQUEST_USER_TO_DISABLE_DWM = -178, //!< The user should disable DWM before calling NvAPI.
NVAPI_D3D_DEVICE_LOST = -179, //!< D3D device status is D3DERR_DEVICELOST or D3DERR_DEVICENOTRESET - the user has to reset the device.
NVAPI_INVALID_CONFIGURATION = -180, //!< The requested action cannot be performed in the current state.
NVAPI_STEREO_HANDSHAKE_NOT_DONE = -181, //!< Call failed as stereo handshake not completed.
NVAPI_EXECUTABLE_PATH_IS_AMBIGUOUS = -182, //!< The path provided was too short to determine the correct NVDRS_APPLICATION
NVAPI_DEFAULT_STEREO_PROFILE_IS_NOT_DEFINED = -183, //!< Default stereo profile is not currently defined
NVAPI_DEFAULT_STEREO_PROFILE_DOES_NOT_EXIST = -184, //!< Default stereo profile does not exist
NVAPI_CLUSTER_ALREADY_EXISTS = -185, //!< A cluster is already defined with the given configuration.
NVAPI_DPMST_DISPLAY_ID_EXPECTED = -186, //!< The input display id is not that of a multi stream enabled connector or a display device in a multi stream topology
NVAPI_INVALID_DISPLAY_ID = -187, //!< The input display id is not valid or the monitor associated to it does not support the current operation
NVAPI_STREAM_IS_OUT_OF_SYNC = -188, //!< While playing secure audio stream, stream goes out of sync
NVAPI_INCOMPATIBLE_AUDIO_DRIVER = -189, //!< Older audio driver version than required
NVAPI_VALUE_ALREADY_SET = -190, //!< Value already set, setting again not allowed.
NVAPI_TIMEOUT = -191, //!< Requested operation timed out
NVAPI_GPU_WORKSTATION_FEATURE_INCOMPLETE = -192, //!< The requested workstation feature set has incomplete driver internal allocation resources
NVAPI_STEREO_INIT_ACTIVATION_NOT_DONE = -193, //!< Call failed because InitActivation was not called.
NVAPI_SYNC_NOT_ACTIVE = -194, //!< The requested action cannot be performed without Sync being enabled.
NVAPI_SYNC_MASTER_NOT_FOUND = -195, //!< The requested action cannot be performed without Sync Master being enabled.
NVAPI_INVALID_SYNC_TOPOLOGY = -196, //!< Invalid displays passed in the NV_GSYNC_DISPLAY pointer.
NVAPI_ECID_SIGN_ALGO_UNSUPPORTED = -197, //!< The specified signing algorithm is not supported. Either an incorrect value was entered or the current installed driver/hardware does not support the input value.
NVAPI_ECID_KEY_VERIFICATION_FAILED = -198, //!< The encrypted public key verification has failed.
NVAPI_FIRMWARE_OUT_OF_DATE = -199, //!< The device's firmware is out of date.
NVAPI_FIRMWARE_REVISION_NOT_SUPPORTED = -200, //!< The device's firmware is not supported.
NVAPI_LICENSE_CALLER_AUTHENTICATION_FAILED = -201, //!< The caller is not authorized to modify the License.
} NvAPI_Status;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_SYS_GetDriverAndBranchVersion
//
//! DESCRIPTION: This API returns display driver version and driver-branch string.
//!
//! SUPPORTED OS: Windows XP and higher
//!
//!
//! \param [out] pDriverVersion Contains the driver version after successful return.
//! \param [out] szBuildBranchString Contains the driver-branch string after successful return.
//!
//! \retval ::NVAPI_INVALID_ARGUMENT: either pDriverVersion is NULL or enum index too big
//! \retval ::NVAPI_OK - completed request
//! \retval ::NVAPI_API_NOT_INTIALIZED - NVAPI not initialized
//! \retval ::NVAPI_ERROR - miscellaneous error occurred
//!
//! \ingroup driverapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_SYS_GetDriverAndBranchVersion(NvU32* pDriverVersion, NvAPI_ShortString szBuildBranchString);
//! \ingroup driverapi
//! Used in NvAPI_GPU_GetMemoryInfo().
typedef struct
{
NvU32 version; //!< Version info
NvU32 dedicatedVideoMemory; //!< Size(in kb) of the physical framebuffer.
NvU32 availableDedicatedVideoMemory; //!< Size(in kb) of the available physical framebuffer for allocating video memory surfaces.
NvU32 systemVideoMemory; //!< Size(in kb) of system memory the driver allocates at load time.
NvU32 sharedSystemMemory; //!< Size(in kb) of shared system memory that driver is allowed to commit for surfaces across all allocations.
} NV_DISPLAY_DRIVER_MEMORY_INFO_V1;
//! \ingroup driverapi
//! Used in NvAPI_GPU_GetMemoryInfo().
typedef struct
{
NvU32 version; //!< Version info
NvU32 dedicatedVideoMemory; //!< Size(in kb) of the physical framebuffer.
NvU32 availableDedicatedVideoMemory; //!< Size(in kb) of the available physical framebuffer for allocating video memory surfaces.
NvU32 systemVideoMemory; //!< Size(in kb) of system memory the driver allocates at load time.
NvU32 sharedSystemMemory; //!< Size(in kb) of shared system memory that driver is allowed to commit for surfaces across all allocations.
NvU32 curAvailableDedicatedVideoMemory; //!< Size(in kb) of the current available physical framebuffer for allocating video memory surfaces.
} NV_DISPLAY_DRIVER_MEMORY_INFO_V2;
//! \ingroup driverapi
typedef NV_DISPLAY_DRIVER_MEMORY_INFO_V2 NV_DISPLAY_DRIVER_MEMORY_INFO;
//! \ingroup driverapi
//! Macro for constructing the version field of NV_DISPLAY_DRIVER_MEMORY_INFO_V1
#define NV_DISPLAY_DRIVER_MEMORY_INFO_VER_1 MAKE_NVAPI_VERSION(NV_DISPLAY_DRIVER_MEMORY_INFO_V1,1)
//! \ingroup driverapi
//! Macro for constructing the version field of NV_DISPLAY_DRIVER_MEMORY_INFO_V2
#define NV_DISPLAY_DRIVER_MEMORY_INFO_VER_2 MAKE_NVAPI_VERSION(NV_DISPLAY_DRIVER_MEMORY_INFO_V2,2)
//! \ingroup driverapi
#define NV_DISPLAY_DRIVER_MEMORY_INFO_VER NV_DISPLAY_DRIVER_MEMORY_INFO_VER_2
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_GPU_GetMemoryInfo
//
//! DESCRIPTION: This function retrieves the available driver memory footprint for the specified GPU.
//!
//! SUPPORTED OS: Windows XP and higher
//!
//!
//! TCC_SUPPORTED
//!
//! \since Release: 177
//!
//! \param [in] hPhysicalGpu Handle of the physical GPU for which the memory information is to be extracted.
//! \param [out] pMemoryInfo The memory footprint available in the driver. See NV_DISPLAY_DRIVER_MEMORY_INFO.
//!
//! \retval NVAPI_INVALID_ARGUMENT pMemoryInfo is NULL.
//! \retval NVAPI_OK Call successful.
//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found.
//! \retval NVAPI_INCOMPATIBLE_STRUCT_VERSION NV_DISPLAY_DRIVER_MEMORY_INFO structure version mismatch.
//!
//! \ingroup driverapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_GPU_GetMemoryInfo(NvPhysicalGpuHandle hPhysicalGpu, NV_DISPLAY_DRIVER_MEMORY_INFO *pMemoryInfo);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_EnumPhysicalGPUs
//
//! This function returns an array of physical GPU handles.
//! Each handle represents a physical GPU present in the system.
//! That GPU may be part of an SLI configuration, or may not be visible to the OS directly.
//!
//! At least one GPU must be present in the system and running an NVIDIA display driver.
//!
//! The array nvGPUHandle will be filled with physical GPU handle values. The returned
//! gpuCount determines how many entries in the array are valid.
//!
//! \note In drivers older than 105.00, all physical GPU handles get invalidated on a
//! modeset. So the calling applications need to renum the handles after every modeset.\n
//! With drivers 105.00 and up, all physical GPU handles are constant.
//! Physical GPU handles are constant as long as the GPUs are not physically moved and
//! the SBIOS VGA order is unchanged.
//!
//! For GPU handles in TCC MODE please use NvAPI_EnumTCCPhysicalGPUs()
//!
//! SUPPORTED OS: Windows XP and higher, Mac OS X
//!
//!
//! \par Introduced in
//! \since Release: 80
//!
//! \retval NVAPI_INVALID_ARGUMENT nvGPUHandle or pGpuCount is NULL
//! \retval NVAPI_OK One or more handles were returned
//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found
//! \ingroup gpu
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_EnumPhysicalGPUs(NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
NV_DECLARE_HANDLE(NVDX_ObjectHandle); // DX Objects
static const NVDX_ObjectHandle NVDX_OBJECT_NONE = 0;
#endif //if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_D3D_GetObjectHandleForResource
//
//! DESCRIPTION: This API gets a handle to a resource.
//!
//! \param [in] pDev The ID3D11Device, ID3D10Device or IDirect3DDevice9 to use
//! \param [in] pResource The ID3D10Resource, ID3D10Resource or IDirect3DResource9 from which
//! we want the NvAPI handle
//! \param [out] pHandle A handle to the resource
//!
//! SUPPORTED OS: Windows XP and higher
//!
//!
//! \since Release: 185
//!
//! \return ::NVAPI_OK if the handle was populated.
//!
//! \ingroup dx
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_D3D_GetObjectHandleForResource(
IUnknown *pDevice,
IUnknown *pResource,
NVDX_ObjectHandle *pHandle);
#endif //if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
#include"nvapi_lite_salend.h"
#ifdef __cplusplus
}
#endif
#pragma pack(pop)

View file

@ -1,188 +0,0 @@
/************************************************************************************************************************************\
|* *|
|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *|
|* *|
|* NOTICE TO USER: *|
|* *|
|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *|
|* *|
|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *|
|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *|
|* Otherwise, you have no rights to use or access this software in any manner. *|
|* *|
|* If not covered by the applicable NVIDIA software license agreement: *|
|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *|
|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *|
|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *|
|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *|
|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *|
|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *|
|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *|
|* *|
|* U.S. Government End Users. *|
|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *|
|* consisting of "commercial computer software" and "commercial computer software documentation" *|
|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *|
|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *|
|* all U.S. Government End Users acquire the software with only those rights set forth herein. *|
|* *|
|* Any use of this software in individual and commercial software must include, *|
|* in the user documentation and internal comments to the code, *|
|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *|
|* *|
\************************************************************************************************************************************/
#pragma once
#include"nvapi_lite_salstart.h"
#include"nvapi_lite_common.h"
#pragma pack(push,8)
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__cplusplus) && (defined(__d3d10_h__) || defined(__d3d10_1_h__) || defined(__d3d11_h__))
//! \ingroup dx
//! D3D_FEATURE_LEVEL supported - used in NvAPI_D3D11_CreateDevice() and NvAPI_D3D11_CreateDeviceAndSwapChain()
typedef enum
{
NVAPI_DEVICE_FEATURE_LEVEL_NULL = -1,
NVAPI_DEVICE_FEATURE_LEVEL_10_0 = 0,
NVAPI_DEVICE_FEATURE_LEVEL_10_0_PLUS = 1,
NVAPI_DEVICE_FEATURE_LEVEL_10_1 = 2,
NVAPI_DEVICE_FEATURE_LEVEL_11_0 = 3,
} NVAPI_DEVICE_FEATURE_LEVEL;
#endif //defined(__cplusplus) && (defined(__d3d10_h__) || defined(__d3d10_1_h__) || defined(__d3d11_h__))
#if defined(__cplusplus) && defined(__d3d11_h__)
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_D3D11_CreateDevice
//
//! DESCRIPTION: This function tries to create a DirectX 11 device. If the call fails (if we are running
//! on pre-DirectX 11 hardware), depending on the type of hardware it will try to create a DirectX 10.1 OR DirectX 10.0+
//! OR DirectX 10.0 device. The function call is the same as D3D11CreateDevice(), but with an extra
//! argument (D3D_FEATURE_LEVEL supported by the device) that the function fills in. This argument
//! can contain -1 (NVAPI_DEVICE_FEATURE_LEVEL_NULL), if the requested featureLevel is less than DirecX 10.0.
//!
//! NOTE: When NvAPI_D3D11_CreateDevice is called with 10+ feature level we have an issue on few set of
//! tesla hardware (G80/G84/G86/G92/G94/G96) which does not support all feature level 10+ functionality
//! e.g. calling driver with mismatch between RenderTarget and Depth Buffer. App developers should
//! take into consideration such limitation when using NVAPI on such tesla hardwares.
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 185
//!
//! \param [in] pAdapter
//! \param [in] DriverType
//! \param [in] Software
//! \param [in] Flags
//! \param [in] *pFeatureLevels
//! \param [in] FeatureLevels
//! \param [in] SDKVersion
//! \param [in] **ppDevice
//! \param [in] *pFeatureLevel
//! \param [in] **ppImmediateContext
//! \param [in] *pSupportedLevel D3D_FEATURE_LEVEL supported
//!
//! \return NVAPI_OK if the createDevice call succeeded.
//!
//! \ingroup dx
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_D3D11_CreateDevice(IDXGIAdapter* pAdapter,
D3D_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
CONST D3D_FEATURE_LEVEL *pFeatureLevels,
UINT FeatureLevels,
UINT SDKVersion,
ID3D11Device **ppDevice,
D3D_FEATURE_LEVEL *pFeatureLevel,
ID3D11DeviceContext **ppImmediateContext,
NVAPI_DEVICE_FEATURE_LEVEL *pSupportedLevel);
#endif //defined(__cplusplus) && defined(__d3d11_h__)
#if defined(__cplusplus) && defined(__d3d11_h__)
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_D3D11_CreateDeviceAndSwapChain
//
//! DESCRIPTION: This function tries to create a DirectX 11 device and swap chain. If the call fails (if we are
//! running on pre=DirectX 11 hardware), depending on the type of hardware it will try to create a DirectX 10.1 OR
//! DirectX 10.0+ OR DirectX 10.0 device. The function call is the same as D3D11CreateDeviceAndSwapChain,
//! but with an extra argument (D3D_FEATURE_LEVEL supported by the device) that the function fills
//! in. This argument can contain -1 (NVAPI_DEVICE_FEATURE_LEVEL_NULL), if the requested featureLevel
//! is less than DirectX 10.0.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 185
//!
//! \param [in] pAdapter
//! \param [in] DriverType
//! \param [in] Software
//! \param [in] Flags
//! \param [in] *pFeatureLevels
//! \param [in] FeatureLevels
//! \param [in] SDKVersion
//! \param [in] *pSwapChainDesc
//! \param [in] **ppSwapChain
//! \param [in] **ppDevice
//! \param [in] *pFeatureLevel
//! \param [in] **ppImmediateContext
//! \param [in] *pSupportedLevel D3D_FEATURE_LEVEL supported
//!
//!return NVAPI_OK if the createDevice with swap chain call succeeded.
//!
//! \ingroup dx
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_D3D11_CreateDeviceAndSwapChain(IDXGIAdapter* pAdapter,
D3D_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
CONST D3D_FEATURE_LEVEL *pFeatureLevels,
UINT FeatureLevels,
UINT SDKVersion,
CONST DXGI_SWAP_CHAIN_DESC *pSwapChainDesc,
IDXGISwapChain **ppSwapChain,
ID3D11Device **ppDevice,
D3D_FEATURE_LEVEL *pFeatureLevel,
ID3D11DeviceContext **ppImmediateContext,
NVAPI_DEVICE_FEATURE_LEVEL *pSupportedLevel);
#endif //defined(__cplusplus) && defined(__d3d11_h__)
#if defined(__cplusplus) && defined(__d3d11_h__)
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_D3D11_SetDepthBoundsTest
//
//! DESCRIPTION: This function enables/disables the depth bounds test
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \param [in] pDeviceOrContext The device or device context to set depth bounds test
//! \param [in] bEnable Enable(non-zero)/disable(zero) the depth bounds test
//! \param [in] fMinDepth The minimum depth for depth bounds test
//! \param [in] fMaxDepth The maximum depth for depth bounds test
//! The valid values for fMinDepth and fMaxDepth
//! are such that 0 <= fMinDepth <= fMaxDepth <= 1
//!
//! \return ::NVAPI_OK if the depth bounds test was correcly enabled or disabled
//!
//! \ingroup dx
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_D3D11_SetDepthBoundsTest(IUnknown* pDeviceOrContext,
NvU32 bEnable,
float fMinDepth,
float fMaxDepth);
#endif //defined(__cplusplus) && defined(__d3d11_h__)
#include"nvapi_lite_salend.h"
#ifdef __cplusplus
}
#endif
#pragma pack(pop)

View file

@ -1,816 +0,0 @@
/************************************************************************************************************************************\
|* *|
|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *|
|* *|
|* NOTICE TO USER: *|
|* *|
|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *|
|* *|
|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *|
|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *|
|* Otherwise, you have no rights to use or access this software in any manner. *|
|* *|
|* If not covered by the applicable NVIDIA software license agreement: *|
|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *|
|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *|
|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *|
|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *|
|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *|
|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *|
|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *|
|* *|
|* U.S. Government End Users. *|
|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *|
|* consisting of "commercial computer software" and "commercial computer software documentation" *|
|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *|
|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *|
|* all U.S. Government End Users acquire the software with only those rights set forth herein. *|
|* *|
|* Any use of this software in individual and commercial software must include, *|
|* in the user documentation and internal comments to the code, *|
|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *|
|* *|
\************************************************************************************************************************************/
#ifndef __NVAPI_EMPTY_SAL
#ifdef __nvapi_undef__ecount
#undef __ecount
#undef __nvapi_undef__ecount
#endif
#ifdef __nvapi_undef__bcount
#undef __bcount
#undef __nvapi_undef__bcount
#endif
#ifdef __nvapi_undef__in
#undef __in
#undef __nvapi_undef__in
#endif
#ifdef __nvapi_undef__in_ecount
#undef __in_ecount
#undef __nvapi_undef__in_ecount
#endif
#ifdef __nvapi_undef__in_bcount
#undef __in_bcount
#undef __nvapi_undef__in_bcount
#endif
#ifdef __nvapi_undef__in_z
#undef __in_z
#undef __nvapi_undef__in_z
#endif
#ifdef __nvapi_undef__in_ecount_z
#undef __in_ecount_z
#undef __nvapi_undef__in_ecount_z
#endif
#ifdef __nvapi_undef__in_bcount_z
#undef __in_bcount_z
#undef __nvapi_undef__in_bcount_z
#endif
#ifdef __nvapi_undef__in_nz
#undef __in_nz
#undef __nvapi_undef__in_nz
#endif
#ifdef __nvapi_undef__in_ecount_nz
#undef __in_ecount_nz
#undef __nvapi_undef__in_ecount_nz
#endif
#ifdef __nvapi_undef__in_bcount_nz
#undef __in_bcount_nz
#undef __nvapi_undef__in_bcount_nz
#endif
#ifdef __nvapi_undef__out
#undef __out
#undef __nvapi_undef__out
#endif
#ifdef __nvapi_undef__out_ecount
#undef __out_ecount
#undef __nvapi_undef__out_ecount
#endif
#ifdef __nvapi_undef__out_bcount
#undef __out_bcount
#undef __nvapi_undef__out_bcount
#endif
#ifdef __nvapi_undef__out_ecount_part
#undef __out_ecount_part
#undef __nvapi_undef__out_ecount_part
#endif
#ifdef __nvapi_undef__out_bcount_part
#undef __out_bcount_part
#undef __nvapi_undef__out_bcount_part
#endif
#ifdef __nvapi_undef__out_ecount_full
#undef __out_ecount_full
#undef __nvapi_undef__out_ecount_full
#endif
#ifdef __nvapi_undef__out_bcount_full
#undef __out_bcount_full
#undef __nvapi_undef__out_bcount_full
#endif
#ifdef __nvapi_undef__out_z
#undef __out_z
#undef __nvapi_undef__out_z
#endif
#ifdef __nvapi_undef__out_z_opt
#undef __out_z_opt
#undef __nvapi_undef__out_z_opt
#endif
#ifdef __nvapi_undef__out_ecount_z
#undef __out_ecount_z
#undef __nvapi_undef__out_ecount_z
#endif
#ifdef __nvapi_undef__out_bcount_z
#undef __out_bcount_z
#undef __nvapi_undef__out_bcount_z
#endif
#ifdef __nvapi_undef__out_ecount_part_z
#undef __out_ecount_part_z
#undef __nvapi_undef__out_ecount_part_z
#endif
#ifdef __nvapi_undef__out_bcount_part_z
#undef __out_bcount_part_z
#undef __nvapi_undef__out_bcount_part_z
#endif
#ifdef __nvapi_undef__out_ecount_full_z
#undef __out_ecount_full_z
#undef __nvapi_undef__out_ecount_full_z
#endif
#ifdef __nvapi_undef__out_bcount_full_z
#undef __out_bcount_full_z
#undef __nvapi_undef__out_bcount_full_z
#endif
#ifdef __nvapi_undef__out_nz
#undef __out_nz
#undef __nvapi_undef__out_nz
#endif
#ifdef __nvapi_undef__out_nz_opt
#undef __out_nz_opt
#undef __nvapi_undef__out_nz_opt
#endif
#ifdef __nvapi_undef__out_ecount_nz
#undef __out_ecount_nz
#undef __nvapi_undef__out_ecount_nz
#endif
#ifdef __nvapi_undef__out_bcount_nz
#undef __out_bcount_nz
#undef __nvapi_undef__out_bcount_nz
#endif
#ifdef __nvapi_undef__inout
#undef __inout
#undef __nvapi_undef__inout
#endif
#ifdef __nvapi_undef__inout_ecount
#undef __inout_ecount
#undef __nvapi_undef__inout_ecount
#endif
#ifdef __nvapi_undef__inout_bcount
#undef __inout_bcount
#undef __nvapi_undef__inout_bcount
#endif
#ifdef __nvapi_undef__inout_ecount_part
#undef __inout_ecount_part
#undef __nvapi_undef__inout_ecount_part
#endif
#ifdef __nvapi_undef__inout_bcount_part
#undef __inout_bcount_part
#undef __nvapi_undef__inout_bcount_part
#endif
#ifdef __nvapi_undef__inout_ecount_full
#undef __inout_ecount_full
#undef __nvapi_undef__inout_ecount_full
#endif
#ifdef __nvapi_undef__inout_bcount_full
#undef __inout_bcount_full
#undef __nvapi_undef__inout_bcount_full
#endif
#ifdef __nvapi_undef__inout_z
#undef __inout_z
#undef __nvapi_undef__inout_z
#endif
#ifdef __nvapi_undef__inout_ecount_z
#undef __inout_ecount_z
#undef __nvapi_undef__inout_ecount_z
#endif
#ifdef __nvapi_undef__inout_bcount_z
#undef __inout_bcount_z
#undef __nvapi_undef__inout_bcount_z
#endif
#ifdef __nvapi_undef__inout_nz
#undef __inout_nz
#undef __nvapi_undef__inout_nz
#endif
#ifdef __nvapi_undef__inout_ecount_nz
#undef __inout_ecount_nz
#undef __nvapi_undef__inout_ecount_nz
#endif
#ifdef __nvapi_undef__inout_bcount_nz
#undef __inout_bcount_nz
#undef __nvapi_undef__inout_bcount_nz
#endif
#ifdef __nvapi_undef__ecount_opt
#undef __ecount_opt
#undef __nvapi_undef__ecount_opt
#endif
#ifdef __nvapi_undef__bcount_opt
#undef __bcount_opt
#undef __nvapi_undef__bcount_opt
#endif
#ifdef __nvapi_undef__in_opt
#undef __in_opt
#undef __nvapi_undef__in_opt
#endif
#ifdef __nvapi_undef__in_ecount_opt
#undef __in_ecount_opt
#undef __nvapi_undef__in_ecount_opt
#endif
#ifdef __nvapi_undef__in_bcount_opt
#undef __in_bcount_opt
#undef __nvapi_undef__in_bcount_opt
#endif
#ifdef __nvapi_undef__in_z_opt
#undef __in_z_opt
#undef __nvapi_undef__in_z_opt
#endif
#ifdef __nvapi_undef__in_ecount_z_opt
#undef __in_ecount_z_opt
#undef __nvapi_undef__in_ecount_z_opt
#endif
#ifdef __nvapi_undef__in_bcount_z_opt
#undef __in_bcount_z_opt
#undef __nvapi_undef__in_bcount_z_opt
#endif
#ifdef __nvapi_undef__in_nz_opt
#undef __in_nz_opt
#undef __nvapi_undef__in_nz_opt
#endif
#ifdef __nvapi_undef__in_ecount_nz_opt
#undef __in_ecount_nz_opt
#undef __nvapi_undef__in_ecount_nz_opt
#endif
#ifdef __nvapi_undef__in_bcount_nz_opt
#undef __in_bcount_nz_opt
#undef __nvapi_undef__in_bcount_nz_opt
#endif
#ifdef __nvapi_undef__out_opt
#undef __out_opt
#undef __nvapi_undef__out_opt
#endif
#ifdef __nvapi_undef__out_ecount_opt
#undef __out_ecount_opt
#undef __nvapi_undef__out_ecount_opt
#endif
#ifdef __nvapi_undef__out_bcount_opt
#undef __out_bcount_opt
#undef __nvapi_undef__out_bcount_opt
#endif
#ifdef __nvapi_undef__out_ecount_part_opt
#undef __out_ecount_part_opt
#undef __nvapi_undef__out_ecount_part_opt
#endif
#ifdef __nvapi_undef__out_bcount_part_opt
#undef __out_bcount_part_opt
#undef __nvapi_undef__out_bcount_part_opt
#endif
#ifdef __nvapi_undef__out_ecount_full_opt
#undef __out_ecount_full_opt
#undef __nvapi_undef__out_ecount_full_opt
#endif
#ifdef __nvapi_undef__out_bcount_full_opt
#undef __out_bcount_full_opt
#undef __nvapi_undef__out_bcount_full_opt
#endif
#ifdef __nvapi_undef__out_ecount_z_opt
#undef __out_ecount_z_opt
#undef __nvapi_undef__out_ecount_z_opt
#endif
#ifdef __nvapi_undef__out_bcount_z_opt
#undef __out_bcount_z_opt
#undef __nvapi_undef__out_bcount_z_opt
#endif
#ifdef __nvapi_undef__out_ecount_part_z_opt
#undef __out_ecount_part_z_opt
#undef __nvapi_undef__out_ecount_part_z_opt
#endif
#ifdef __nvapi_undef__out_bcount_part_z_opt
#undef __out_bcount_part_z_opt
#undef __nvapi_undef__out_bcount_part_z_opt
#endif
#ifdef __nvapi_undef__out_ecount_full_z_opt
#undef __out_ecount_full_z_opt
#undef __nvapi_undef__out_ecount_full_z_opt
#endif
#ifdef __nvapi_undef__out_bcount_full_z_opt
#undef __out_bcount_full_z_opt
#undef __nvapi_undef__out_bcount_full_z_opt
#endif
#ifdef __nvapi_undef__out_ecount_nz_opt
#undef __out_ecount_nz_opt
#undef __nvapi_undef__out_ecount_nz_opt
#endif
#ifdef __nvapi_undef__out_bcount_nz_opt
#undef __out_bcount_nz_opt
#undef __nvapi_undef__out_bcount_nz_opt
#endif
#ifdef __nvapi_undef__inout_opt
#undef __inout_opt
#undef __nvapi_undef__inout_opt
#endif
#ifdef __nvapi_undef__inout_ecount_opt
#undef __inout_ecount_opt
#undef __nvapi_undef__inout_ecount_opt
#endif
#ifdef __nvapi_undef__inout_bcount_opt
#undef __inout_bcount_opt
#undef __nvapi_undef__inout_bcount_opt
#endif
#ifdef __nvapi_undef__inout_ecount_part_opt
#undef __inout_ecount_part_opt
#undef __nvapi_undef__inout_ecount_part_opt
#endif
#ifdef __nvapi_undef__inout_bcount_part_opt
#undef __inout_bcount_part_opt
#undef __nvapi_undef__inout_bcount_part_opt
#endif
#ifdef __nvapi_undef__inout_ecount_full_opt
#undef __inout_ecount_full_opt
#undef __nvapi_undef__inout_ecount_full_opt
#endif
#ifdef __nvapi_undef__inout_bcount_full_opt
#undef __inout_bcount_full_opt
#undef __nvapi_undef__inout_bcount_full_opt
#endif
#ifdef __nvapi_undef__inout_z_opt
#undef __inout_z_opt
#undef __nvapi_undef__inout_z_opt
#endif
#ifdef __nvapi_undef__inout_ecount_z_opt
#undef __inout_ecount_z_opt
#undef __nvapi_undef__inout_ecount_z_opt
#endif
#ifdef __nvapi_undef__inout_ecount_z_opt
#undef __inout_ecount_z_opt
#undef __nvapi_undef__inout_ecount_z_opt
#endif
#ifdef __nvapi_undef__inout_bcount_z_opt
#undef __inout_bcount_z_opt
#undef __nvapi_undef__inout_bcount_z_opt
#endif
#ifdef __nvapi_undef__inout_nz_opt
#undef __inout_nz_opt
#undef __nvapi_undef__inout_nz_opt
#endif
#ifdef __nvapi_undef__inout_ecount_nz_opt
#undef __inout_ecount_nz_opt
#undef __nvapi_undef__inout_ecount_nz_opt
#endif
#ifdef __nvapi_undef__inout_bcount_nz_opt
#undef __inout_bcount_nz_opt
#undef __nvapi_undef__inout_bcount_nz_opt
#endif
#ifdef __nvapi_undef__deref_ecount
#undef __deref_ecount
#undef __nvapi_undef__deref_ecount
#endif
#ifdef __nvapi_undef__deref_bcount
#undef __deref_bcount
#undef __nvapi_undef__deref_bcount
#endif
#ifdef __nvapi_undef__deref_out
#undef __deref_out
#undef __nvapi_undef__deref_out
#endif
#ifdef __nvapi_undef__deref_out_ecount
#undef __deref_out_ecount
#undef __nvapi_undef__deref_out_ecount
#endif
#ifdef __nvapi_undef__deref_out_bcount
#undef __deref_out_bcount
#undef __nvapi_undef__deref_out_bcount
#endif
#ifdef __nvapi_undef__deref_out_ecount_part
#undef __deref_out_ecount_part
#undef __nvapi_undef__deref_out_ecount_part
#endif
#ifdef __nvapi_undef__deref_out_bcount_part
#undef __deref_out_bcount_part
#undef __nvapi_undef__deref_out_bcount_part
#endif
#ifdef __nvapi_undef__deref_out_ecount_full
#undef __deref_out_ecount_full
#undef __nvapi_undef__deref_out_ecount_full
#endif
#ifdef __nvapi_undef__deref_out_bcount_full
#undef __deref_out_bcount_full
#undef __nvapi_undef__deref_out_bcount_full
#endif
#ifdef __nvapi_undef__deref_out_z
#undef __deref_out_z
#undef __nvapi_undef__deref_out_z
#endif
#ifdef __nvapi_undef__deref_out_ecount_z
#undef __deref_out_ecount_z
#undef __nvapi_undef__deref_out_ecount_z
#endif
#ifdef __nvapi_undef__deref_out_bcount_z
#undef __deref_out_bcount_z
#undef __nvapi_undef__deref_out_bcount_z
#endif
#ifdef __nvapi_undef__deref_out_nz
#undef __deref_out_nz
#undef __nvapi_undef__deref_out_nz
#endif
#ifdef __nvapi_undef__deref_out_ecount_nz
#undef __deref_out_ecount_nz
#undef __nvapi_undef__deref_out_ecount_nz
#endif
#ifdef __nvapi_undef__deref_out_bcount_nz
#undef __deref_out_bcount_nz
#undef __nvapi_undef__deref_out_bcount_nz
#endif
#ifdef __nvapi_undef__deref_inout
#undef __deref_inout
#undef __nvapi_undef__deref_inout
#endif
#ifdef __nvapi_undef__deref_inout_z
#undef __deref_inout_z
#undef __nvapi_undef__deref_inout_z
#endif
#ifdef __nvapi_undef__deref_inout_ecount
#undef __deref_inout_ecount
#undef __nvapi_undef__deref_inout_ecount
#endif
#ifdef __nvapi_undef__deref_inout_bcount
#undef __deref_inout_bcount
#undef __nvapi_undef__deref_inout_bcount
#endif
#ifdef __nvapi_undef__deref_inout_ecount_part
#undef __deref_inout_ecount_part
#undef __nvapi_undef__deref_inout_ecount_part
#endif
#ifdef __nvapi_undef__deref_inout_bcount_part
#undef __deref_inout_bcount_part
#undef __nvapi_undef__deref_inout_bcount_part
#endif
#ifdef __nvapi_undef__deref_inout_ecount_full
#undef __deref_inout_ecount_full
#undef __nvapi_undef__deref_inout_ecount_full
#endif
#ifdef __nvapi_undef__deref_inout_bcount_full
#undef __deref_inout_bcount_full
#undef __nvapi_undef__deref_inout_bcount_full
#endif
#ifdef __nvapi_undef__deref_inout_z
#undef __deref_inout_z
#undef __nvapi_undef__deref_inout_z
#endif
#ifdef __nvapi_undef__deref_inout_ecount_z
#undef __deref_inout_ecount_z
#undef __nvapi_undef__deref_inout_ecount_z
#endif
#ifdef __nvapi_undef__deref_inout_bcount_z
#undef __deref_inout_bcount_z
#undef __nvapi_undef__deref_inout_bcount_z
#endif
#ifdef __nvapi_undef__deref_inout_nz
#undef __deref_inout_nz
#undef __nvapi_undef__deref_inout_nz
#endif
#ifdef __nvapi_undef__deref_inout_ecount_nz
#undef __deref_inout_ecount_nz
#undef __nvapi_undef__deref_inout_ecount_nz
#endif
#ifdef __nvapi_undef__deref_inout_bcount_nz
#undef __deref_inout_bcount_nz
#undef __nvapi_undef__deref_inout_bcount_nz
#endif
#ifdef __nvapi_undef__deref_ecount_opt
#undef __deref_ecount_opt
#undef __nvapi_undef__deref_ecount_opt
#endif
#ifdef __nvapi_undef__deref_bcount_opt
#undef __deref_bcount_opt
#undef __nvapi_undef__deref_bcount_opt
#endif
#ifdef __nvapi_undef__deref_out_opt
#undef __deref_out_opt
#undef __nvapi_undef__deref_out_opt
#endif
#ifdef __nvapi_undef__deref_out_ecount_opt
#undef __deref_out_ecount_opt
#undef __nvapi_undef__deref_out_ecount_opt
#endif
#ifdef __nvapi_undef__deref_out_bcount_opt
#undef __deref_out_bcount_opt
#undef __nvapi_undef__deref_out_bcount_opt
#endif
#ifdef __nvapi_undef__deref_out_ecount_part_opt
#undef __deref_out_ecount_part_opt
#undef __nvapi_undef__deref_out_ecount_part_opt
#endif
#ifdef __nvapi_undef__deref_out_bcount_part_opt
#undef __deref_out_bcount_part_opt
#undef __nvapi_undef__deref_out_bcount_part_opt
#endif
#ifdef __nvapi_undef__deref_out_ecount_full_opt
#undef __deref_out_ecount_full_opt
#undef __nvapi_undef__deref_out_ecount_full_opt
#endif
#ifdef __nvapi_undef__deref_out_bcount_full_opt
#undef __deref_out_bcount_full_opt
#undef __nvapi_undef__deref_out_bcount_full_opt
#endif
#ifdef __nvapi_undef__deref_out_z_opt
#undef __deref_out_z_opt
#undef __nvapi_undef__deref_out_z_opt
#endif
#ifdef __nvapi_undef__deref_out_ecount_z_opt
#undef __deref_out_ecount_z_opt
#undef __nvapi_undef__deref_out_ecount_z_opt
#endif
#ifdef __nvapi_undef__deref_out_bcount_z_opt
#undef __deref_out_bcount_z_opt
#undef __nvapi_undef__deref_out_bcount_z_opt
#endif
#ifdef __nvapi_undef__deref_out_nz_opt
#undef __deref_out_nz_opt
#undef __nvapi_undef__deref_out_nz_opt
#endif
#ifdef __nvapi_undef__deref_out_ecount_nz_opt
#undef __deref_out_ecount_nz_opt
#undef __nvapi_undef__deref_out_ecount_nz_opt
#endif
#ifdef __nvapi_undef__deref_out_bcount_nz_opt
#undef __deref_out_bcount_nz_opt
#undef __nvapi_undef__deref_out_bcount_nz_opt
#endif
#ifdef __nvapi_undef__deref_inout_opt
#undef __deref_inout_opt
#undef __nvapi_undef__deref_inout_opt
#endif
#ifdef __nvapi_undef__deref_inout_ecount_opt
#undef __deref_inout_ecount_opt
#undef __nvapi_undef__deref_inout_ecount_opt
#endif
#ifdef __nvapi_undef__deref_inout_bcount_opt
#undef __deref_inout_bcount_opt
#undef __nvapi_undef__deref_inout_bcount_opt
#endif
#ifdef __nvapi_undef__deref_inout_ecount_part_opt
#undef __deref_inout_ecount_part_opt
#undef __nvapi_undef__deref_inout_ecount_part_opt
#endif
#ifdef __nvapi_undef__deref_inout_bcount_part_opt
#undef __deref_inout_bcount_part_opt
#undef __nvapi_undef__deref_inout_bcount_part_opt
#endif
#ifdef __nvapi_undef__deref_inout_ecount_full_opt
#undef __deref_inout_ecount_full_opt
#undef __nvapi_undef__deref_inout_ecount_full_opt
#endif
#ifdef __nvapi_undef__deref_inout_bcount_full_opt
#undef __deref_inout_bcount_full_opt
#undef __nvapi_undef__deref_inout_bcount_full_opt
#endif
#ifdef __nvapi_undef__deref_inout_z_opt
#undef __deref_inout_z_opt
#undef __nvapi_undef__deref_inout_z_opt
#endif
#ifdef __nvapi_undef__deref_inout_ecount_z_opt
#undef __deref_inout_ecount_z_opt
#undef __nvapi_undef__deref_inout_ecount_z_opt
#endif
#ifdef __nvapi_undef__deref_inout_bcount_z_opt
#undef __deref_inout_bcount_z_opt
#undef __nvapi_undef__deref_inout_bcount_z_opt
#endif
#ifdef __nvapi_undef__deref_inout_nz_opt
#undef __deref_inout_nz_opt
#undef __nvapi_undef__deref_inout_nz_opt
#endif
#ifdef __nvapi_undef__deref_inout_ecount_nz_opt
#undef __deref_inout_ecount_nz_opt
#undef __nvapi_undef__deref_inout_ecount_nz_opt
#endif
#ifdef __nvapi_undef__deref_inout_bcount_nz_opt
#undef __deref_inout_bcount_nz_opt
#undef __nvapi_undef__deref_inout_bcount_nz_opt
#endif
#ifdef __nvapi_undef__deref_opt_ecount
#undef __deref_opt_ecount
#undef __nvapi_undef__deref_opt_ecount
#endif
#ifdef __nvapi_undef__deref_opt_bcount
#undef __deref_opt_bcount
#undef __nvapi_undef__deref_opt_bcount
#endif
#ifdef __nvapi_undef__deref_opt_out
#undef __deref_opt_out
#undef __nvapi_undef__deref_opt_out
#endif
#ifdef __nvapi_undef__deref_opt_out_z
#undef __deref_opt_out_z
#undef __nvapi_undef__deref_opt_out_z
#endif
#ifdef __nvapi_undef__deref_opt_out_ecount
#undef __deref_opt_out_ecount
#undef __nvapi_undef__deref_opt_out_ecount
#endif
#ifdef __nvapi_undef__deref_opt_out_bcount
#undef __deref_opt_out_bcount
#undef __nvapi_undef__deref_opt_out_bcount
#endif
#ifdef __nvapi_undef__deref_opt_out_ecount_part
#undef __deref_opt_out_ecount_part
#undef __nvapi_undef__deref_opt_out_ecount_part
#endif
#ifdef __nvapi_undef__deref_opt_out_bcount_part
#undef __deref_opt_out_bcount_part
#undef __nvapi_undef__deref_opt_out_bcount_part
#endif
#ifdef __nvapi_undef__deref_opt_out_ecount_full
#undef __deref_opt_out_ecount_full
#undef __nvapi_undef__deref_opt_out_ecount_full
#endif
#ifdef __nvapi_undef__deref_opt_out_bcount_full
#undef __deref_opt_out_bcount_full
#undef __nvapi_undef__deref_opt_out_bcount_full
#endif
#ifdef __nvapi_undef__deref_opt_inout
#undef __deref_opt_inout
#undef __nvapi_undef__deref_opt_inout
#endif
#ifdef __nvapi_undef__deref_opt_inout_ecount
#undef __deref_opt_inout_ecount
#undef __nvapi_undef__deref_opt_inout_ecount
#endif
#ifdef __nvapi_undef__deref_opt_inout_bcount
#undef __deref_opt_inout_bcount
#undef __nvapi_undef__deref_opt_inout_bcount
#endif
#ifdef __nvapi_undef__deref_opt_inout_ecount_part
#undef __deref_opt_inout_ecount_part
#undef __nvapi_undef__deref_opt_inout_ecount_part
#endif
#ifdef __nvapi_undef__deref_opt_inout_bcount_part
#undef __deref_opt_inout_bcount_part
#undef __nvapi_undef__deref_opt_inout_bcount_part
#endif
#ifdef __nvapi_undef__deref_opt_inout_ecount_full
#undef __deref_opt_inout_ecount_full
#undef __nvapi_undef__deref_opt_inout_ecount_full
#endif
#ifdef __nvapi_undef__deref_opt_inout_bcount_full
#undef __deref_opt_inout_bcount_full
#undef __nvapi_undef__deref_opt_inout_bcount_full
#endif
#ifdef __nvapi_undef__deref_opt_inout_z
#undef __deref_opt_inout_z
#undef __nvapi_undef__deref_opt_inout_z
#endif
#ifdef __nvapi_undef__deref_opt_inout_ecount_z
#undef __deref_opt_inout_ecount_z
#undef __nvapi_undef__deref_opt_inout_ecount_z
#endif
#ifdef __nvapi_undef__deref_opt_inout_bcount_z
#undef __deref_opt_inout_bcount_z
#undef __nvapi_undef__deref_opt_inout_bcount_z
#endif
#ifdef __nvapi_undef__deref_opt_inout_nz
#undef __deref_opt_inout_nz
#undef __nvapi_undef__deref_opt_inout_nz
#endif
#ifdef __nvapi_undef__deref_opt_inout_ecount_nz
#undef __deref_opt_inout_ecount_nz
#undef __nvapi_undef__deref_opt_inout_ecount_nz
#endif
#ifdef __nvapi_undef__deref_opt_inout_bcount_nz
#undef __deref_opt_inout_bcount_nz
#undef __nvapi_undef__deref_opt_inout_bcount_nz
#endif
#ifdef __nvapi_undef__deref_opt_ecount_opt
#undef __deref_opt_ecount_opt
#undef __nvapi_undef__deref_opt_ecount_opt
#endif
#ifdef __nvapi_undef__deref_opt_bcount_opt
#undef __deref_opt_bcount_opt
#undef __nvapi_undef__deref_opt_bcount_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_opt
#undef __deref_opt_out_opt
#undef __nvapi_undef__deref_opt_out_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_ecount_opt
#undef __deref_opt_out_ecount_opt
#undef __nvapi_undef__deref_opt_out_ecount_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_bcount_opt
#undef __deref_opt_out_bcount_opt
#undef __nvapi_undef__deref_opt_out_bcount_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_ecount_part_opt
#undef __deref_opt_out_ecount_part_opt
#undef __nvapi_undef__deref_opt_out_ecount_part_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_bcount_part_opt
#undef __deref_opt_out_bcount_part_opt
#undef __nvapi_undef__deref_opt_out_bcount_part_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_ecount_full_opt
#undef __deref_opt_out_ecount_full_opt
#undef __nvapi_undef__deref_opt_out_ecount_full_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_bcount_full_opt
#undef __deref_opt_out_bcount_full_opt
#undef __nvapi_undef__deref_opt_out_bcount_full_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_z_opt
#undef __deref_opt_out_z_opt
#undef __nvapi_undef__deref_opt_out_z_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_ecount_z_opt
#undef __deref_opt_out_ecount_z_opt
#undef __nvapi_undef__deref_opt_out_ecount_z_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_bcount_z_opt
#undef __deref_opt_out_bcount_z_opt
#undef __nvapi_undef__deref_opt_out_bcount_z_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_nz_opt
#undef __deref_opt_out_nz_opt
#undef __nvapi_undef__deref_opt_out_nz_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_ecount_nz_opt
#undef __deref_opt_out_ecount_nz_opt
#undef __nvapi_undef__deref_opt_out_ecount_nz_opt
#endif
#ifdef __nvapi_undef__deref_opt_out_bcount_nz_opt
#undef __deref_opt_out_bcount_nz_opt
#undef __nvapi_undef__deref_opt_out_bcount_nz_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_opt
#undef __deref_opt_inout_opt
#undef __nvapi_undef__deref_opt_inout_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_ecount_opt
#undef __deref_opt_inout_ecount_opt
#undef __nvapi_undef__deref_opt_inout_ecount_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_bcount_opt
#undef __deref_opt_inout_bcount_opt
#undef __nvapi_undef__deref_opt_inout_bcount_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_ecount_part_opt
#undef __deref_opt_inout_ecount_part_opt
#undef __nvapi_undef__deref_opt_inout_ecount_part_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_bcount_part_opt
#undef __deref_opt_inout_bcount_part_opt
#undef __nvapi_undef__deref_opt_inout_bcount_part_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_ecount_full_opt
#undef __deref_opt_inout_ecount_full_opt
#undef __nvapi_undef__deref_opt_inout_ecount_full_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_bcount_full_opt
#undef __deref_opt_inout_bcount_full_opt
#undef __nvapi_undef__deref_opt_inout_bcount_full_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_z_opt
#undef __deref_opt_inout_z_opt
#undef __nvapi_undef__deref_opt_inout_z_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_ecount_z_opt
#undef __deref_opt_inout_ecount_z_opt
#undef __nvapi_undef__deref_opt_inout_ecount_z_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_bcount_z_opt
#undef __deref_opt_inout_bcount_z_opt
#undef __nvapi_undef__deref_opt_inout_bcount_z_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_nz_opt
#undef __deref_opt_inout_nz_opt
#undef __nvapi_undef__deref_opt_inout_nz_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_ecount_nz_opt
#undef __deref_opt_inout_ecount_nz_opt
#undef __nvapi_undef__deref_opt_inout_ecount_nz_opt
#endif
#ifdef __nvapi_undef__deref_opt_inout_bcount_nz_opt
#undef __deref_opt_inout_bcount_nz_opt
#undef __nvapi_undef__deref_opt_inout_bcount_nz_opt
#endif
#ifdef __nvapi_success
#undef __success
#undef __nvapi_success
#endif
#ifdef __nvapi__Ret_notnull_
#undef __nvapi__Ret_notnull_
#undef _Ret_notnull_
#endif
#ifdef __nvapi__Post_writable_byte_size_
#undef __nvapi__Post_writable_byte_size_
#undef _Post_writable_byte_size_
#endif
#ifdef __nvapi_Outptr_
#undef __nvapi_Outptr_
#undef _Outptr_
#endif
#endif // __NVAPI_EMPTY_SAL

View file

@ -1,821 +0,0 @@
/************************************************************************************************************************************\
|* *|
|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *|
|* *|
|* NOTICE TO USER: *|
|* *|
|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *|
|* *|
|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *|
|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *|
|* Otherwise, you have no rights to use or access this software in any manner. *|
|* *|
|* If not covered by the applicable NVIDIA software license agreement: *|
|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *|
|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *|
|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *|
|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *|
|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *|
|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *|
|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *|
|* *|
|* U.S. Government End Users. *|
|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *|
|* consisting of "commercial computer software" and "commercial computer software documentation" *|
|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *|
|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *|
|* all U.S. Government End Users acquire the software with only those rights set forth herein. *|
|* *|
|* Any use of this software in individual and commercial software must include, *|
|* in the user documentation and internal comments to the code, *|
|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *|
|* *|
\************************************************************************************************************************************/
// ====================================================
// SAL related support
// ====================================================
#ifndef __ecount
#define __nvapi_undef__ecount
#define __ecount(size)
#endif
#ifndef __bcount
#define __nvapi_undef__bcount
#define __bcount(size)
#endif
#ifndef __in
#define __nvapi_undef__in
#define __in
#endif
#ifndef __in_ecount
#define __nvapi_undef__in_ecount
#define __in_ecount(size)
#endif
#ifndef __in_bcount
#define __nvapi_undef__in_bcount
#define __in_bcount(size)
#endif
#ifndef __in_z
#define __nvapi_undef__in_z
#define __in_z
#endif
#ifndef __in_ecount_z
#define __nvapi_undef__in_ecount_z
#define __in_ecount_z(size)
#endif
#ifndef __in_bcount_z
#define __nvapi_undef__in_bcount_z
#define __in_bcount_z(size)
#endif
#ifndef __in_nz
#define __nvapi_undef__in_nz
#define __in_nz
#endif
#ifndef __in_ecount_nz
#define __nvapi_undef__in_ecount_nz
#define __in_ecount_nz(size)
#endif
#ifndef __in_bcount_nz
#define __nvapi_undef__in_bcount_nz
#define __in_bcount_nz(size)
#endif
#ifndef __out
#define __nvapi_undef__out
#define __out
#endif
#ifndef __out_ecount
#define __nvapi_undef__out_ecount
#define __out_ecount(size)
#endif
#ifndef __out_bcount
#define __nvapi_undef__out_bcount
#define __out_bcount(size)
#endif
#ifndef __out_ecount_part
#define __nvapi_undef__out_ecount_part
#define __out_ecount_part(size,length)
#endif
#ifndef __out_bcount_part
#define __nvapi_undef__out_bcount_part
#define __out_bcount_part(size,length)
#endif
#ifndef __out_ecount_full
#define __nvapi_undef__out_ecount_full
#define __out_ecount_full(size)
#endif
#ifndef __out_bcount_full
#define __nvapi_undef__out_bcount_full
#define __out_bcount_full(size)
#endif
#ifndef __out_z
#define __nvapi_undef__out_z
#define __out_z
#endif
#ifndef __out_z_opt
#define __nvapi_undef__out_z_opt
#define __out_z_opt
#endif
#ifndef __out_ecount_z
#define __nvapi_undef__out_ecount_z
#define __out_ecount_z(size)
#endif
#ifndef __out_bcount_z
#define __nvapi_undef__out_bcount_z
#define __out_bcount_z(size)
#endif
#ifndef __out_ecount_part_z
#define __nvapi_undef__out_ecount_part_z
#define __out_ecount_part_z(size,length)
#endif
#ifndef __out_bcount_part_z
#define __nvapi_undef__out_bcount_part_z
#define __out_bcount_part_z(size,length)
#endif
#ifndef __out_ecount_full_z
#define __nvapi_undef__out_ecount_full_z
#define __out_ecount_full_z(size)
#endif
#ifndef __out_bcount_full_z
#define __nvapi_undef__out_bcount_full_z
#define __out_bcount_full_z(size)
#endif
#ifndef __out_nz
#define __nvapi_undef__out_nz
#define __out_nz
#endif
#ifndef __out_nz_opt
#define __nvapi_undef__out_nz_opt
#define __out_nz_opt
#endif
#ifndef __out_ecount_nz
#define __nvapi_undef__out_ecount_nz
#define __out_ecount_nz(size)
#endif
#ifndef __out_bcount_nz
#define __nvapi_undef__out_bcount_nz
#define __out_bcount_nz(size)
#endif
#ifndef __inout
#define __nvapi_undef__inout
#define __inout
#endif
#ifndef __inout_ecount
#define __nvapi_undef__inout_ecount
#define __inout_ecount(size)
#endif
#ifndef __inout_bcount
#define __nvapi_undef__inout_bcount
#define __inout_bcount(size)
#endif
#ifndef __inout_ecount_part
#define __nvapi_undef__inout_ecount_part
#define __inout_ecount_part(size,length)
#endif
#ifndef __inout_bcount_part
#define __nvapi_undef__inout_bcount_part
#define __inout_bcount_part(size,length)
#endif
#ifndef __inout_ecount_full
#define __nvapi_undef__inout_ecount_full
#define __inout_ecount_full(size)
#endif
#ifndef __inout_bcount_full
#define __nvapi_undef__inout_bcount_full
#define __inout_bcount_full(size)
#endif
#ifndef __inout_z
#define __nvapi_undef__inout_z
#define __inout_z
#endif
#ifndef __inout_ecount_z
#define __nvapi_undef__inout_ecount_z
#define __inout_ecount_z(size)
#endif
#ifndef __inout_bcount_z
#define __nvapi_undef__inout_bcount_z
#define __inout_bcount_z(size)
#endif
#ifndef __inout_nz
#define __nvapi_undef__inout_nz
#define __inout_nz
#endif
#ifndef __inout_ecount_nz
#define __nvapi_undef__inout_ecount_nz
#define __inout_ecount_nz(size)
#endif
#ifndef __inout_bcount_nz
#define __nvapi_undef__inout_bcount_nz
#define __inout_bcount_nz(size)
#endif
#ifndef __ecount_opt
#define __nvapi_undef__ecount_opt
#define __ecount_opt(size)
#endif
#ifndef __bcount_opt
#define __nvapi_undef__bcount_opt
#define __bcount_opt(size)
#endif
#ifndef __in_opt
#define __nvapi_undef__in_opt
#define __in_opt
#endif
#ifndef __in_ecount_opt
#define __nvapi_undef__in_ecount_opt
#define __in_ecount_opt(size)
#endif
#ifndef __in_bcount_opt
#define __nvapi_undef__in_bcount_opt
#define __in_bcount_opt(size)
#endif
#ifndef __in_z_opt
#define __nvapi_undef__in_z_opt
#define __in_z_opt
#endif
#ifndef __in_ecount_z_opt
#define __nvapi_undef__in_ecount_z_opt
#define __in_ecount_z_opt(size)
#endif
#ifndef __in_bcount_z_opt
#define __nvapi_undef__in_bcount_z_opt
#define __in_bcount_z_opt(size)
#endif
#ifndef __in_nz_opt
#define __nvapi_undef__in_nz_opt
#define __in_nz_opt
#endif
#ifndef __in_ecount_nz_opt
#define __nvapi_undef__in_ecount_nz_opt
#define __in_ecount_nz_opt(size)
#endif
#ifndef __in_bcount_nz_opt
#define __nvapi_undef__in_bcount_nz_opt
#define __in_bcount_nz_opt(size)
#endif
#ifndef __out_opt
#define __nvapi_undef__out_opt
#define __out_opt
#endif
#ifndef __out_ecount_opt
#define __nvapi_undef__out_ecount_opt
#define __out_ecount_opt(size)
#endif
#ifndef __out_bcount_opt
#define __nvapi_undef__out_bcount_opt
#define __out_bcount_opt(size)
#endif
#ifndef __out_ecount_part_opt
#define __nvapi_undef__out_ecount_part_opt
#define __out_ecount_part_opt(size,length)
#endif
#ifndef __out_bcount_part_opt
#define __nvapi_undef__out_bcount_part_opt
#define __out_bcount_part_opt(size,length)
#endif
#ifndef __out_ecount_full_opt
#define __nvapi_undef__out_ecount_full_opt
#define __out_ecount_full_opt(size)
#endif
#ifndef __out_bcount_full_opt
#define __nvapi_undef__out_bcount_full_opt
#define __out_bcount_full_opt(size)
#endif
#ifndef __out_ecount_z_opt
#define __nvapi_undef__out_ecount_z_opt
#define __out_ecount_z_opt(size)
#endif
#ifndef __out_bcount_z_opt
#define __nvapi_undef__out_bcount_z_opt
#define __out_bcount_z_opt(size)
#endif
#ifndef __out_ecount_part_z_opt
#define __nvapi_undef__out_ecount_part_z_opt
#define __out_ecount_part_z_opt(size,length)
#endif
#ifndef __out_bcount_part_z_opt
#define __nvapi_undef__out_bcount_part_z_opt
#define __out_bcount_part_z_opt(size,length)
#endif
#ifndef __out_ecount_full_z_opt
#define __nvapi_undef__out_ecount_full_z_opt
#define __out_ecount_full_z_opt(size)
#endif
#ifndef __out_bcount_full_z_opt
#define __nvapi_undef__out_bcount_full_z_opt
#define __out_bcount_full_z_opt(size)
#endif
#ifndef __out_ecount_nz_opt
#define __nvapi_undef__out_ecount_nz_opt
#define __out_ecount_nz_opt(size)
#endif
#ifndef __out_bcount_nz_opt
#define __nvapi_undef__out_bcount_nz_opt
#define __out_bcount_nz_opt(size)
#endif
#ifndef __inout_opt
#define __nvapi_undef__inout_opt
#define __inout_opt
#endif
#ifndef __inout_ecount_opt
#define __nvapi_undef__inout_ecount_opt
#define __inout_ecount_opt(size)
#endif
#ifndef __inout_bcount_opt
#define __nvapi_undef__inout_bcount_opt
#define __inout_bcount_opt(size)
#endif
#ifndef __inout_ecount_part_opt
#define __nvapi_undef__inout_ecount_part_opt
#define __inout_ecount_part_opt(size,length)
#endif
#ifndef __inout_bcount_part_opt
#define __nvapi_undef__inout_bcount_part_opt
#define __inout_bcount_part_opt(size,length)
#endif
#ifndef __inout_ecount_full_opt
#define __nvapi_undef__inout_ecount_full_opt
#define __inout_ecount_full_opt(size)
#endif
#ifndef __inout_bcount_full_opt
#define __nvapi_undef__inout_bcount_full_opt
#define __inout_bcount_full_opt(size)
#endif
#ifndef __inout_z_opt
#define __nvapi_undef__inout_z_opt
#define __inout_z_opt
#endif
#ifndef __inout_ecount_z_opt
#define __nvapi_undef__inout_ecount_z_opt
#define __inout_ecount_z_opt(size)
#endif
#ifndef __inout_ecount_z_opt
#define __nvapi_undef__inout_ecount_z_opt
#define __inout_ecount_z_opt(size)
#endif
#ifndef __inout_bcount_z_opt
#define __nvapi_undef__inout_bcount_z_opt
#define __inout_bcount_z_opt(size)
#endif
#ifndef __inout_nz_opt
#define __nvapi_undef__inout_nz_opt
#define __inout_nz_opt
#endif
#ifndef __inout_ecount_nz_opt
#define __nvapi_undef__inout_ecount_nz_opt
#define __inout_ecount_nz_opt(size)
#endif
#ifndef __inout_bcount_nz_opt
#define __nvapi_undef__inout_bcount_nz_opt
#define __inout_bcount_nz_opt(size)
#endif
#ifndef __deref_ecount
#define __nvapi_undef__deref_ecount
#define __deref_ecount(size)
#endif
#ifndef __deref_bcount
#define __nvapi_undef__deref_bcount
#define __deref_bcount(size)
#endif
#ifndef __deref_out
#define __nvapi_undef__deref_out
#define __deref_out
#endif
#ifndef __deref_out_ecount
#define __nvapi_undef__deref_out_ecount
#define __deref_out_ecount(size)
#endif
#ifndef __deref_out_bcount
#define __nvapi_undef__deref_out_bcount
#define __deref_out_bcount(size)
#endif
#ifndef __deref_out_ecount_part
#define __nvapi_undef__deref_out_ecount_part
#define __deref_out_ecount_part(size,length)
#endif
#ifndef __deref_out_bcount_part
#define __nvapi_undef__deref_out_bcount_part
#define __deref_out_bcount_part(size,length)
#endif
#ifndef __deref_out_ecount_full
#define __nvapi_undef__deref_out_ecount_full
#define __deref_out_ecount_full(size)
#endif
#ifndef __deref_out_bcount_full
#define __nvapi_undef__deref_out_bcount_full
#define __deref_out_bcount_full(size)
#endif
#ifndef __deref_out_z
#define __nvapi_undef__deref_out_z
#define __deref_out_z
#endif
#ifndef __deref_out_ecount_z
#define __nvapi_undef__deref_out_ecount_z
#define __deref_out_ecount_z(size)
#endif
#ifndef __deref_out_bcount_z
#define __nvapi_undef__deref_out_bcount_z
#define __deref_out_bcount_z(size)
#endif
#ifndef __deref_out_nz
#define __nvapi_undef__deref_out_nz
#define __deref_out_nz
#endif
#ifndef __deref_out_ecount_nz
#define __nvapi_undef__deref_out_ecount_nz
#define __deref_out_ecount_nz(size)
#endif
#ifndef __deref_out_bcount_nz
#define __nvapi_undef__deref_out_bcount_nz
#define __deref_out_bcount_nz(size)
#endif
#ifndef __deref_inout
#define __nvapi_undef__deref_inout
#define __deref_inout
#endif
#ifndef __deref_inout_z
#define __nvapi_undef__deref_inout_z
#define __deref_inout_z
#endif
#ifndef __deref_inout_ecount
#define __nvapi_undef__deref_inout_ecount
#define __deref_inout_ecount(size)
#endif
#ifndef __deref_inout_bcount
#define __nvapi_undef__deref_inout_bcount
#define __deref_inout_bcount(size)
#endif
#ifndef __deref_inout_ecount_part
#define __nvapi_undef__deref_inout_ecount_part
#define __deref_inout_ecount_part(size,length)
#endif
#ifndef __deref_inout_bcount_part
#define __nvapi_undef__deref_inout_bcount_part
#define __deref_inout_bcount_part(size,length)
#endif
#ifndef __deref_inout_ecount_full
#define __nvapi_undef__deref_inout_ecount_full
#define __deref_inout_ecount_full(size)
#endif
#ifndef __deref_inout_bcount_full
#define __nvapi_undef__deref_inout_bcount_full
#define __deref_inout_bcount_full(size)
#endif
#ifndef __deref_inout_z
#define __nvapi_undef__deref_inout_z
#define __deref_inout_z
#endif
#ifndef __deref_inout_ecount_z
#define __nvapi_undef__deref_inout_ecount_z
#define __deref_inout_ecount_z(size)
#endif
#ifndef __deref_inout_bcount_z
#define __nvapi_undef__deref_inout_bcount_z
#define __deref_inout_bcount_z(size)
#endif
#ifndef __deref_inout_nz
#define __nvapi_undef__deref_inout_nz
#define __deref_inout_nz
#endif
#ifndef __deref_inout_ecount_nz
#define __nvapi_undef__deref_inout_ecount_nz
#define __deref_inout_ecount_nz(size)
#endif
#ifndef __deref_inout_bcount_nz
#define __nvapi_undef__deref_inout_bcount_nz
#define __deref_inout_bcount_nz(size)
#endif
#ifndef __deref_ecount_opt
#define __nvapi_undef__deref_ecount_opt
#define __deref_ecount_opt(size)
#endif
#ifndef __deref_bcount_opt
#define __nvapi_undef__deref_bcount_opt
#define __deref_bcount_opt(size)
#endif
#ifndef __deref_out_opt
#define __nvapi_undef__deref_out_opt
#define __deref_out_opt
#endif
#ifndef __deref_out_ecount_opt
#define __nvapi_undef__deref_out_ecount_opt
#define __deref_out_ecount_opt(size)
#endif
#ifndef __deref_out_bcount_opt
#define __nvapi_undef__deref_out_bcount_opt
#define __deref_out_bcount_opt(size)
#endif
#ifndef __deref_out_ecount_part_opt
#define __nvapi_undef__deref_out_ecount_part_opt
#define __deref_out_ecount_part_opt(size,length)
#endif
#ifndef __deref_out_bcount_part_opt
#define __nvapi_undef__deref_out_bcount_part_opt
#define __deref_out_bcount_part_opt(size,length)
#endif
#ifndef __deref_out_ecount_full_opt
#define __nvapi_undef__deref_out_ecount_full_opt
#define __deref_out_ecount_full_opt(size)
#endif
#ifndef __deref_out_bcount_full_opt
#define __nvapi_undef__deref_out_bcount_full_opt
#define __deref_out_bcount_full_opt(size)
#endif
#ifndef __deref_out_z_opt
#define __nvapi_undef__deref_out_z_opt
#define __deref_out_z_opt
#endif
#ifndef __deref_out_ecount_z_opt
#define __nvapi_undef__deref_out_ecount_z_opt
#define __deref_out_ecount_z_opt(size)
#endif
#ifndef __deref_out_bcount_z_opt
#define __nvapi_undef__deref_out_bcount_z_opt
#define __deref_out_bcount_z_opt(size)
#endif
#ifndef __deref_out_nz_opt
#define __nvapi_undef__deref_out_nz_opt
#define __deref_out_nz_opt
#endif
#ifndef __deref_out_ecount_nz_opt
#define __nvapi_undef__deref_out_ecount_nz_opt
#define __deref_out_ecount_nz_opt(size)
#endif
#ifndef __deref_out_bcount_nz_opt
#define __nvapi_undef__deref_out_bcount_nz_opt
#define __deref_out_bcount_nz_opt(size)
#endif
#ifndef __deref_inout_opt
#define __nvapi_undef__deref_inout_opt
#define __deref_inout_opt
#endif
#ifndef __deref_inout_ecount_opt
#define __nvapi_undef__deref_inout_ecount_opt
#define __deref_inout_ecount_opt(size)
#endif
#ifndef __deref_inout_bcount_opt
#define __nvapi_undef__deref_inout_bcount_opt
#define __deref_inout_bcount_opt(size)
#endif
#ifndef __deref_inout_ecount_part_opt
#define __nvapi_undef__deref_inout_ecount_part_opt
#define __deref_inout_ecount_part_opt(size,length)
#endif
#ifndef __deref_inout_bcount_part_opt
#define __nvapi_undef__deref_inout_bcount_part_opt
#define __deref_inout_bcount_part_opt(size,length)
#endif
#ifndef __deref_inout_ecount_full_opt
#define __nvapi_undef__deref_inout_ecount_full_opt
#define __deref_inout_ecount_full_opt(size)
#endif
#ifndef __deref_inout_bcount_full_opt
#define __nvapi_undef__deref_inout_bcount_full_opt
#define __deref_inout_bcount_full_opt(size)
#endif
#ifndef __deref_inout_z_opt
#define __nvapi_undef__deref_inout_z_opt
#define __deref_inout_z_opt
#endif
#ifndef __deref_inout_ecount_z_opt
#define __nvapi_undef__deref_inout_ecount_z_opt
#define __deref_inout_ecount_z_opt(size)
#endif
#ifndef __deref_inout_bcount_z_opt
#define __nvapi_undef__deref_inout_bcount_z_opt
#define __deref_inout_bcount_z_opt(size)
#endif
#ifndef __deref_inout_nz_opt
#define __nvapi_undef__deref_inout_nz_opt
#define __deref_inout_nz_opt
#endif
#ifndef __deref_inout_ecount_nz_opt
#define __nvapi_undef__deref_inout_ecount_nz_opt
#define __deref_inout_ecount_nz_opt(size)
#endif
#ifndef __deref_inout_bcount_nz_opt
#define __nvapi_undef__deref_inout_bcount_nz_opt
#define __deref_inout_bcount_nz_opt(size)
#endif
#ifndef __deref_opt_ecount
#define __nvapi_undef__deref_opt_ecount
#define __deref_opt_ecount(size)
#endif
#ifndef __deref_opt_bcount
#define __nvapi_undef__deref_opt_bcount
#define __deref_opt_bcount(size)
#endif
#ifndef __deref_opt_out
#define __nvapi_undef__deref_opt_out
#define __deref_opt_out
#endif
#ifndef __deref_opt_out_z
#define __nvapi_undef__deref_opt_out_z
#define __deref_opt_out_z
#endif
#ifndef __deref_opt_out_ecount
#define __nvapi_undef__deref_opt_out_ecount
#define __deref_opt_out_ecount(size)
#endif
#ifndef __deref_opt_out_bcount
#define __nvapi_undef__deref_opt_out_bcount
#define __deref_opt_out_bcount(size)
#endif
#ifndef __deref_opt_out_ecount_part
#define __nvapi_undef__deref_opt_out_ecount_part
#define __deref_opt_out_ecount_part(size,length)
#endif
#ifndef __deref_opt_out_bcount_part
#define __nvapi_undef__deref_opt_out_bcount_part
#define __deref_opt_out_bcount_part(size,length)
#endif
#ifndef __deref_opt_out_ecount_full
#define __nvapi_undef__deref_opt_out_ecount_full
#define __deref_opt_out_ecount_full(size)
#endif
#ifndef __deref_opt_out_bcount_full
#define __nvapi_undef__deref_opt_out_bcount_full
#define __deref_opt_out_bcount_full(size)
#endif
#ifndef __deref_opt_inout
#define __nvapi_undef__deref_opt_inout
#define __deref_opt_inout
#endif
#ifndef __deref_opt_inout_ecount
#define __nvapi_undef__deref_opt_inout_ecount
#define __deref_opt_inout_ecount(size)
#endif
#ifndef __deref_opt_inout_bcount
#define __nvapi_undef__deref_opt_inout_bcount
#define __deref_opt_inout_bcount(size)
#endif
#ifndef __deref_opt_inout_ecount_part
#define __nvapi_undef__deref_opt_inout_ecount_part
#define __deref_opt_inout_ecount_part(size,length)
#endif
#ifndef __deref_opt_inout_bcount_part
#define __nvapi_undef__deref_opt_inout_bcount_part
#define __deref_opt_inout_bcount_part(size,length)
#endif
#ifndef __deref_opt_inout_ecount_full
#define __nvapi_undef__deref_opt_inout_ecount_full
#define __deref_opt_inout_ecount_full(size)
#endif
#ifndef __deref_opt_inout_bcount_full
#define __nvapi_undef__deref_opt_inout_bcount_full
#define __deref_opt_inout_bcount_full(size)
#endif
#ifndef __deref_opt_inout_z
#define __nvapi_undef__deref_opt_inout_z
#define __deref_opt_inout_z
#endif
#ifndef __deref_opt_inout_ecount_z
#define __nvapi_undef__deref_opt_inout_ecount_z
#define __deref_opt_inout_ecount_z(size)
#endif
#ifndef __deref_opt_inout_bcount_z
#define __nvapi_undef__deref_opt_inout_bcount_z
#define __deref_opt_inout_bcount_z(size)
#endif
#ifndef __deref_opt_inout_nz
#define __nvapi_undef__deref_opt_inout_nz
#define __deref_opt_inout_nz
#endif
#ifndef __deref_opt_inout_ecount_nz
#define __nvapi_undef__deref_opt_inout_ecount_nz
#define __deref_opt_inout_ecount_nz(size)
#endif
#ifndef __deref_opt_inout_bcount_nz
#define __nvapi_undef__deref_opt_inout_bcount_nz
#define __deref_opt_inout_bcount_nz(size)
#endif
#ifndef __deref_opt_ecount_opt
#define __nvapi_undef__deref_opt_ecount_opt
#define __deref_opt_ecount_opt(size)
#endif
#ifndef __deref_opt_bcount_opt
#define __nvapi_undef__deref_opt_bcount_opt
#define __deref_opt_bcount_opt(size)
#endif
#ifndef __deref_opt_out_opt
#define __nvapi_undef__deref_opt_out_opt
#define __deref_opt_out_opt
#endif
#ifndef __deref_opt_out_ecount_opt
#define __nvapi_undef__deref_opt_out_ecount_opt
#define __deref_opt_out_ecount_opt(size)
#endif
#ifndef __deref_opt_out_bcount_opt
#define __nvapi_undef__deref_opt_out_bcount_opt
#define __deref_opt_out_bcount_opt(size)
#endif
#ifndef __deref_opt_out_ecount_part_opt
#define __nvapi_undef__deref_opt_out_ecount_part_opt
#define __deref_opt_out_ecount_part_opt(size,length)
#endif
#ifndef __deref_opt_out_bcount_part_opt
#define __nvapi_undef__deref_opt_out_bcount_part_opt
#define __deref_opt_out_bcount_part_opt(size,length)
#endif
#ifndef __deref_opt_out_ecount_full_opt
#define __nvapi_undef__deref_opt_out_ecount_full_opt
#define __deref_opt_out_ecount_full_opt(size)
#endif
#ifndef __deref_opt_out_bcount_full_opt
#define __nvapi_undef__deref_opt_out_bcount_full_opt
#define __deref_opt_out_bcount_full_opt(size)
#endif
#ifndef __deref_opt_out_z_opt
#define __nvapi_undef__deref_opt_out_z_opt
#define __deref_opt_out_z_opt
#endif
#ifndef __deref_opt_out_ecount_z_opt
#define __nvapi_undef__deref_opt_out_ecount_z_opt
#define __deref_opt_out_ecount_z_opt(size)
#endif
#ifndef __deref_opt_out_bcount_z_opt
#define __nvapi_undef__deref_opt_out_bcount_z_opt
#define __deref_opt_out_bcount_z_opt(size)
#endif
#ifndef __deref_opt_out_nz_opt
#define __nvapi_undef__deref_opt_out_nz_opt
#define __deref_opt_out_nz_opt
#endif
#ifndef __deref_opt_out_ecount_nz_opt
#define __nvapi_undef__deref_opt_out_ecount_nz_opt
#define __deref_opt_out_ecount_nz_opt(size)
#endif
#ifndef __deref_opt_out_bcount_nz_opt
#define __nvapi_undef__deref_opt_out_bcount_nz_opt
#define __deref_opt_out_bcount_nz_opt(size)
#endif
#ifndef __deref_opt_inout_opt
#define __nvapi_undef__deref_opt_inout_opt
#define __deref_opt_inout_opt
#endif
#ifndef __deref_opt_inout_ecount_opt
#define __nvapi_undef__deref_opt_inout_ecount_opt
#define __deref_opt_inout_ecount_opt(size)
#endif
#ifndef __deref_opt_inout_bcount_opt
#define __nvapi_undef__deref_opt_inout_bcount_opt
#define __deref_opt_inout_bcount_opt(size)
#endif
#ifndef __deref_opt_inout_ecount_part_opt
#define __nvapi_undef__deref_opt_inout_ecount_part_opt
#define __deref_opt_inout_ecount_part_opt(size,length)
#endif
#ifndef __deref_opt_inout_bcount_part_opt
#define __nvapi_undef__deref_opt_inout_bcount_part_opt
#define __deref_opt_inout_bcount_part_opt(size,length)
#endif
#ifndef __deref_opt_inout_ecount_full_opt
#define __nvapi_undef__deref_opt_inout_ecount_full_opt
#define __deref_opt_inout_ecount_full_opt(size)
#endif
#ifndef __deref_opt_inout_bcount_full_opt
#define __nvapi_undef__deref_opt_inout_bcount_full_opt
#define __deref_opt_inout_bcount_full_opt(size)
#endif
#ifndef __deref_opt_inout_z_opt
#define __nvapi_undef__deref_opt_inout_z_opt
#define __deref_opt_inout_z_opt
#endif
#ifndef __deref_opt_inout_ecount_z_opt
#define __nvapi_undef__deref_opt_inout_ecount_z_opt
#define __deref_opt_inout_ecount_z_opt(size)
#endif
#ifndef __deref_opt_inout_bcount_z_opt
#define __nvapi_undef__deref_opt_inout_bcount_z_opt
#define __deref_opt_inout_bcount_z_opt(size)
#endif
#ifndef __deref_opt_inout_nz_opt
#define __nvapi_undef__deref_opt_inout_nz_opt
#define __deref_opt_inout_nz_opt
#endif
#ifndef __deref_opt_inout_ecount_nz_opt
#define __nvapi_undef__deref_opt_inout_ecount_nz_opt
#define __deref_opt_inout_ecount_nz_opt(size)
#endif
#ifndef __deref_opt_inout_bcount_nz_opt
#define __nvapi_undef__deref_opt_inout_bcount_nz_opt
#define __deref_opt_inout_bcount_nz_opt(size)
#endif
#ifndef __success
#define __nvapi_success
#define __success(epxr)
#endif
#ifndef _Ret_notnull_
#define __nvapi__Ret_notnull_
#define _Ret_notnull_
#endif
#ifndef _Post_writable_byte_size_
#define __nvapi__Post_writable_byte_size_
#define _Post_writable_byte_size_(n)
#endif
#ifndef _Outptr_
#define __nvapi_Outptr_
#define _Outptr_
#endif
#define NVAPI_INTERFACE extern __success(return == NVAPI_OK) NvAPI_Status __cdecl

View file

@ -1,225 +0,0 @@
/************************************************************************************************************************************\
|* *|
|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *|
|* *|
|* NOTICE TO USER: *|
|* *|
|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *|
|* *|
|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *|
|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *|
|* Otherwise, you have no rights to use or access this software in any manner. *|
|* *|
|* If not covered by the applicable NVIDIA software license agreement: *|
|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *|
|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *|
|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *|
|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *|
|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *|
|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *|
|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *|
|* *|
|* U.S. Government End Users. *|
|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *|
|* consisting of "commercial computer software" and "commercial computer software documentation" *|
|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *|
|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *|
|* all U.S. Government End Users acquire the software with only those rights set forth herein. *|
|* *|
|* Any use of this software in individual and commercial software must include, *|
|* in the user documentation and internal comments to the code, *|
|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *|
|* *|
\************************************************************************************************************************************/
#pragma once
#include"nvapi_lite_salstart.h"
#include"nvapi_lite_common.h"
#pragma pack(push,8)
#ifdef __cplusplus
extern "C" {
#endif
//-----------------------------------------------------------------------------
// DirectX APIs
//-----------------------------------------------------------------------------
//! \ingroup dx
//! Used in NvAPI_D3D10_GetCurrentSLIState(), and NvAPI_D3D_GetCurrentSLIState().
typedef struct
{
NvU32 version; //!< Structure version
NvU32 maxNumAFRGroups; //!< [OUT] The maximum possible value of numAFRGroups
NvU32 numAFRGroups; //!< [OUT] The number of AFR groups enabled in the system
NvU32 currentAFRIndex; //!< [OUT] The AFR group index for the frame currently being rendered
NvU32 nextFrameAFRIndex; //!< [OUT] What the AFR group index will be for the next frame (i.e. after calling Present)
NvU32 previousFrameAFRIndex; //!< [OUT] The AFR group index that was used for the previous frame (~0 if more than one frame has not been rendered yet)
NvU32 bIsCurAFRGroupNew; //!< [OUT] Boolean: Is this frame the first time running on the current AFR group
} NV_GET_CURRENT_SLI_STATE;
//! \ingroup dx
#define NV_GET_CURRENT_SLI_STATE_VER MAKE_NVAPI_VERSION(NV_GET_CURRENT_SLI_STATE,1)
#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_D3D_GetCurrentSLIState
//
//! DESCRIPTION: This function returns the current SLI state for the specified device. The structure
//! contains the number of AFR groups, the current AFR group index,
//! and what the AFR group index will be for the next frame. \p
//! pDevice can be either a IDirect3DDevice9 or ID3D10Device pointer.
//!
//! SUPPORTED OS: Windows XP and higher
//!
//!
//! \since Release: 173
//!
//! \retval NVAPI_OK Completed request
//! \retval NVAPI_ERROR Error occurred
//!
//! \ingroup dx
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_D3D_GetCurrentSLIState(IUnknown *pDevice, NV_GET_CURRENT_SLI_STATE *pSliState);
#endif //if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_D3D_SetResourceHint
//
//! \fn NvAPI_D3D_SetResourceHint(IUnknown *pDev, NVDX_ObjectHandle obj,
//! NVAPI_D3D_SETRESOURCEHINT_CATEGORY dwHintCategory,
//! NvU32 dwHintName,
//! NvU32 *pdwHintValue)
//!
//! DESCRIPTION: This is a general purpose function for passing down various resource
//! related hints to the driver. Hints are divided into categories
//! and types within each category.
//!
//! SUPPORTED OS: Windows XP and higher
//!
//!
//! \since Release: 185
//!
//! \param [in] pDev The ID3D10Device or IDirect3DDevice9 that is a using the resource
//! \param [in] obj Previously obtained HV resource handle
//! \param [in] dwHintCategory Category of the hints
//! \param [in] dwHintName A hint within this category
//! \param [in] *pdwHintValue Pointer to location containing hint value
//!
//! \return an int which could be an NvAPI status or DX HRESULT code
//!
//! \retval ::NVAPI_OK
//! \retval ::NVAPI_INVALID_ARGUMENT
//! \retval ::NVAPI_INVALID_CALL It is illegal to change a hint dynamically when the resource is already bound.
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//! \ingroup dx
//! Valid categories for NvAPI_D3D_SetResourceHint()
typedef enum _NVAPI_D3D_SETRESOURCEHINT_CATEGORY
{
NVAPI_D3D_SRH_CATEGORY_SLI = 1
} NVAPI_D3D_SETRESOURCEHINT_CATEGORY;
//
// NVAPI_D3D_SRH_SLI_APP_CONTROLLED_INTERFRAME_CONTENT_SYNC:
// NVAPI_D3D_SRH_SLI_ASK_FOR_BROADCAST_USING:
//! \ingroup dx
//! Types of SLI hints; \n
//! NVAPI_D3D_SRH_SLI_APP_CONTROLLED_INTERFRAME_CONTENT_SYNC: Valid values : 0 or 1 \n
//! Default value: 0 \n
//! Explanation: If the value is 1, the driver will not track any rendering operations that would mark this resource as dirty,
//! avoiding any form of synchronization across frames rendered in parallel in multiple GPUs in AFR mode.
//!
//! NVAPI_D3D_SRH_SLI_ASK_FOR_BROADCAST_USAGE: Valid values : 0 or 1 \n
//! Default value: 0 \n
//! Explanation: If the value is 1, the driver will try to perform operations which involved target resource in broadcast,
//! where its possible. Hint is static and must be set before resource starts using.
typedef enum _NVAPI_D3D_SETRESOURCEHINT_SLI
{
NVAPI_D3D_SRH_SLI_APP_CONTROLLED_INTERFRAME_CONTENT_SYNC = 1,
NVAPI_D3D_SRH_SLI_ASK_FOR_BROADCAST_USAGE = 2
} NVAPI_D3D_SETRESOURCEHINT_SLI;
//! \ingroup dx
NVAPI_INTERFACE NvAPI_D3D_SetResourceHint(IUnknown *pDev, NVDX_ObjectHandle obj,
NVAPI_D3D_SETRESOURCEHINT_CATEGORY dwHintCategory,
NvU32 dwHintName,
NvU32 *pdwHintValue);
#endif //defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_D3D_BeginResourceRendering
//
//! \fn NvAPI_D3D_BeginResourceRendering(IUnknown *pDev, NVDX_ObjectHandle obj, NvU32 Flags)
//! DESCRIPTION: This function tells the driver that the resource will begin to receive updates. It must be used in combination with NvAPI_D3D_EndResourceRendering().
//! The primary use of this function is allow the driver to initiate early inter-frame synchronization of resources while running in AFR SLI mode.
//!
//! SUPPORTED OS: Windows XP and higher
//!
//!
//! \since Release: 185
//!
//! \param [in] pDev The ID3D10Device or IDirect3DDevice9 that is a using the resource
//! \param [in] obj Previously obtained HV resource handle
//! \param [in] Flags The flags for functionality applied to resource while being used.
//!
//! \retval ::NVAPI_OK Function succeeded, if used properly and driver can initiate proper sync'ing of the resources.
//! \retval ::NVAPI_INVALID_ARGUMENT Bad argument(s) or invalid flag values
//! \retval ::NVAPI_INVALID_CALL Mismatched begin/end calls
//
///////////////////////////////////////////////////////////////////////////////
//! \ingroup dx
//! Used in NvAPI_D3D_BeginResourceRendering().
typedef enum _NVAPI_D3D_RESOURCERENDERING_FLAG
{
NVAPI_D3D_RR_FLAG_DEFAULTS = 0x00000000, //!< All bits set to 0 are defaults.
NVAPI_D3D_RR_FLAG_FORCE_DISCARD_CONTENT = 0x00000001, //!< (bit 0) The flag forces to discard previous content of the resource regardless of the NvApiHints_Sli_Disable_InterframeSync hint
NVAPI_D3D_RR_FLAG_FORCE_KEEP_CONTENT = 0x00000002, //!< (bit 1) The flag forces to respect previous content of the resource regardless of the NvApiHints_Sli_Disable_InterframeSync hint
NVAPI_D3D_RR_FLAG_MULTI_FRAME = 0x00000004 //!< (bit 2) The flag hints the driver that content will be used for many frames. If not specified then the driver assumes that content is used only on the next frame
} NVAPI_D3D_RESOURCERENDERING_FLAG;
//! \ingroup dx
NVAPI_INTERFACE NvAPI_D3D_BeginResourceRendering(IUnknown *pDev, NVDX_ObjectHandle obj, NvU32 Flags);
#endif //defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_D3D_EndResourceRendering
//
//! DESCRIPTION: This function tells the driver that the resource is done receiving updates. It must be used in combination with
//! NvAPI_D3D_BeginResourceRendering().
//! The primary use of this function is allow the driver to initiate early inter-frame syncs of resources while running in AFR SLI mode.
//!
//! SUPPORTED OS: Windows XP and higher
//!
//!
//! \since Release: 185
//!
//! \param [in] pDev The ID3D10Device or IDirect3DDevice9 thatis a using the resource
//! \param [in] obj Previously obtained HV resource handle
//! \param [in] Flags Reserved, must be zero
//
//! \retval ::NVAPI_OK Function succeeded, if used properly and driver can initiate proper sync'ing of the resources.
//! \retval ::NVAPI_INVALID_ARGUMENT Bad argument(s) or invalid flag values
//! \retval ::NVAPI_INVALID_CALL Mismatched begin/end calls
//!
//! \ingroup dx
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_D3D_EndResourceRendering(IUnknown *pDev, NVDX_ObjectHandle obj, NvU32 Flags);
#endif //if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
#include"nvapi_lite_salend.h"
#ifdef __cplusplus
}
#endif
#pragma pack(pop)

View file

@ -1,600 +0,0 @@
/************************************************************************************************************************************\
|* *|
|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *|
|* *|
|* NOTICE TO USER: *|
|* *|
|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *|
|* *|
|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *|
|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *|
|* Otherwise, you have no rights to use or access this software in any manner. *|
|* *|
|* If not covered by the applicable NVIDIA software license agreement: *|
|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *|
|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *|
|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *|
|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *|
|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *|
|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *|
|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *|
|* *|
|* U.S. Government End Users. *|
|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *|
|* consisting of "commercial computer software" and "commercial computer software documentation" *|
|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *|
|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *|
|* all U.S. Government End Users acquire the software with only those rights set forth herein. *|
|* *|
|* Any use of this software in individual and commercial software must include, *|
|* in the user documentation and internal comments to the code, *|
|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *|
|* *|
\************************************************************************************************************************************/
#pragma once
#include"nvapi_lite_salstart.h"
#include"nvapi_lite_common.h"
#pragma pack(push,8)
#ifdef __cplusplus
extern "C" {
#endif
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_Enable
//
//! DESCRIPTION: This APU enables stereo mode in the registry.
//! Calls to this function affect the entire system.
//! If stereo is not enabled, then calls to functions that require that stereo is enabled have no effect,
//! and will return the appropriate error code.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 180
//!
//! \retval ::NVAPI_OK Stereo is now enabled.
//! \retval ::NVAPI_API_NOT_INTIALIZED
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_Enable(void);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_Disable
//
//! DESCRIPTION: This API disables stereo mode in the registry.
//! Calls to this function affect the entire system.
//! If stereo is not enabled, then calls to functions that require that stereo is enabled have no effect,
//! and will return the appropriate error code.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 180
//!
//! \retval ::NVAPI_OK Stereo is now disabled.
//! \retval ::NVAPI_API_NOT_INTIALIZED
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_Disable(void);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_IsEnabled
//
//! DESCRIPTION: This API checks if stereo mode is enabled in the registry.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 180
//!
//! \param [out] pIsStereoEnabled Address where the result of the inquiry will be placed.
//!
//! \retval ::NVAPI_OK Check was sucessfully completed and result reflects current state of stereo availability.
//! \retval ::NVAPI_API_NOT_INTIALIZED
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_IsEnabled(NvU8 *pIsStereoEnabled);
#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_CreateHandleFromIUnknown
//
//! DESCRIPTION: This API creates a stereo handle that is used in subsequent calls related to a given device interface.
//! This must be called before any other NvAPI_Stereo_ function for that handle.
//! Multiple devices can be used at one time using multiple calls to this function (one per each device).
//!
//! HOW TO USE: After the Direct3D device is created, create the stereo handle.
//! On call success:
//! -# Use all other NvAPI_Stereo_ functions that have stereo handle as first parameter.
//! -# After the device interface that corresponds to the the stereo handle is destroyed,
//! the application should call NvAPI_DestroyStereoHandle() for that stereo handle.
//!
//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 180
//!
//! \param [in] pDevice Pointer to IUnknown interface that is IDirect3DDevice9* in DX9, ID3D10Device*.
//! \param [out] pStereoHandle Pointer to the newly created stereo handle.
//!
//! \retval ::NVAPI_OK Stereo handle is created for given device interface.
//! \retval ::NVAPI_INVALID_ARGUMENT Provided device interface is invalid.
//! \retval ::NVAPI_API_NOT_INTIALIZED
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_CreateHandleFromIUnknown(IUnknown *pDevice, StereoHandle *pStereoHandle);
#endif // defined(_D3D9_H_) || defined(__d3d10_h__)
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_DestroyHandle
//
//! DESCRIPTION: This API destroys the stereo handle created with one of the NvAPI_Stereo_CreateHandleFrom() functions.
//! This should be called after the device corresponding to the handle has been destroyed.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 180
//!
//! \param [in] stereoHandle Stereo handle that is to be destroyed.
//!
//! \retval ::NVAPI_OK Stereo handle is destroyed.
//! \retval ::NVAPI_API_NOT_INTIALIZED
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_DestroyHandle(StereoHandle stereoHandle);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_Activate
//
//! DESCRIPTION: This API activates stereo for the device interface corresponding to the given stereo handle.
//! Activating stereo is possible only if stereo was enabled previously in the registry.
//! If stereo is not activated, then calls to functions that require that stereo is activated have no effect,
//! and will return the appropriate error code.
//!
//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 180
//!
//! \param [in] stereoHandle Stereo handle corresponding to the device interface.
//!
//! \retval ::NVAPI_OK Stereo is turned on.
//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again.
//! \retval ::NVAPI_API_NOT_INTIALIZED
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_Activate(StereoHandle stereoHandle);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_Deactivate
//
//! DESCRIPTION: This API deactivates stereo for the given device interface.
//! If stereo is not activated, then calls to functions that require that stereo is activated have no effect,
//! and will return the appropriate error code.
//!
//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 180
//!
//! \param [in] stereoHandle Stereo handle that corresponds to the device interface.
//!
//! \retval ::NVAPI_OK Stereo is turned off.
//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again.
//! \retval ::NVAPI_API_NOT_INTIALIZED
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_Deactivate(StereoHandle stereoHandle);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_IsActivated
//
//! DESCRIPTION: This API checks if stereo is activated for the given device interface.
//!
//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 180
//!
//! \param [in] stereoHandle Stereo handle that corresponds to the device interface.
//! \param [in] pIsStereoOn Address where result of the inquiry will be placed.
//!
//! \retval ::NVAPI_OK - Check was sucessfully completed and result reflects current state of stereo (on/off).
//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE - Device interface is not valid. Create again, then attach again.
//! \retval ::NVAPI_API_NOT_INTIALIZED - NVAPI not initialized.
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED - Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR - Something is wrong (generic error).
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_IsActivated(StereoHandle stereoHandle, NvU8 *pIsStereoOn);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_GetSeparation
//
//! DESCRIPTION: This API gets current separation value (in percents).
//!
//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 180
//!
//! \param [in] stereoHandle Stereo handle that corresponds to the device interface.
//! \param [out] pSeparationPercentage Address of @c float type variable to store current separation percentage in.
//!
//! \retval ::NVAPI_OK Retrieval of separation percentage was successfull.
//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again.
//! \retval ::NVAPI_API_NOT_INTIALIZED
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_GetSeparation(StereoHandle stereoHandle, float *pSeparationPercentage);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_SetSeparation
//
//! DESCRIPTION: This API sets separation to given percentage.
//!
//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to appropriate NvAPI_Stereo_CreateHandleFrom() function.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 180
//!
//! \param [in] stereoHandle Stereo handle that corresponds to the device interface.
//! \param [in] newSeparationPercentage New value for separation percentage.
//!
//! \retval ::NVAPI_OK Setting of separation percentage was successfull.
//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again.
//! \retval ::NVAPI_API_NOT_INTIALIZED NVAPI not initialized.
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_STEREO_PARAMETER_OUT_OF_RANGE Given separation percentage is out of [0..100] range.
//! \retval ::NVAPI_ERROR
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_SetSeparation(StereoHandle stereoHandle, float newSeparationPercentage);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_GetConvergence
//
//! DESCRIPTION: This API gets the current convergence value.
//!
//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 180
//!
//! \param [in] stereoHandle Stereo handle that corresponds to the device interface.
//! \param [out] pConvergence Address of @c float type variable to store current convergence value in.
//!
//! \retval ::NVAPI_OK Retrieval of convergence value was successfull.
//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again.
//! \retval ::NVAPI_API_NOT_INTIALIZED
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_GetConvergence(StereoHandle stereoHandle, float *pConvergence);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_SetConvergence
//
//! DESCRIPTION: This API sets convergence to the given value.
//!
//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \since Release: 180
//!
//! \param [in] stereoHandle Stereo handle that corresponds to the device interface.
//! \param [in] newConvergence New value for convergence.
//!
//! \retval ::NVAPI_OK Setting of convergence value was successfull.
//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again.
//! \retval ::NVAPI_API_NOT_INTIALIZED
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_SetConvergence(StereoHandle stereoHandle, float newConvergence);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_SetActiveEye
//
//! \fn NvAPI_Stereo_SetActiveEye(StereoHandle hStereoHandle, NV_STEREO_ACTIVE_EYE StereoEye);
//! DESCRIPTION: This API sets the back buffer to left or right in Direct stereo mode.
//!
//! HOW TO USE: After the stereo handle for device interface is created via successfull call to appropriate
//! NvAPI_Stereo_CreateHandleFrom function.
//!
//! \since Release: 285
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \param [in] stereoHandle Stereo handle that corresponds to the device interface.
//! \param [in] StereoEye Defines active eye in Direct stereo mode
//!
//! \retval ::NVAPI_OK - Active eye is set.
//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE - Device interface is not valid. Create again, then attach again.
//! \retval ::NVAPI_API_NOT_INTIALIZED - NVAPI not initialized.
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED - Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_INVALID_ARGUMENT - StereoEye parameter has not allowed value.
//! \retval ::NVAPI_SET_NOT_ALLOWED - Current stereo mode is not Direct
//! \retval ::NVAPI_ERROR - Something is wrong (generic error).
//
///////////////////////////////////////////////////////////////////////////////
//! \ingroup stereoapi
typedef enum _NV_StereoActiveEye
{
NVAPI_STEREO_EYE_RIGHT = 1,
NVAPI_STEREO_EYE_LEFT = 2,
NVAPI_STEREO_EYE_MONO = 3,
} NV_STEREO_ACTIVE_EYE;
//! \ingroup stereoapi
NVAPI_INTERFACE NvAPI_Stereo_SetActiveEye(StereoHandle hStereoHandle, NV_STEREO_ACTIVE_EYE StereoEye);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_SetDriverMode
//
//! \fn NvAPI_Stereo_SetDriverMode( NV_STEREO_DRIVER_MODE mode );
//! DESCRIPTION: This API sets the 3D stereo driver mode: Direct or Automatic
//!
//! HOW TO USE: This API must be called before the device is created.
//! Applies to DirectX 9 and higher.
//!
//! \since Release: 285
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \param [in] mode Defines the 3D stereo driver mode: Direct or Automatic
//!
//! \retval ::NVAPI_OK Active eye is set.
//! \retval ::NVAPI_API_NOT_INTIALIZED NVAPI not initialized.
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_INVALID_ARGUMENT mode parameter has not allowed value.
//! \retval ::NVAPI_ERROR Something is wrong (generic error).
//
///////////////////////////////////////////////////////////////////////////////
//! \ingroup stereoapi
typedef enum _NV_StereoDriverMode
{
NVAPI_STEREO_DRIVER_MODE_AUTOMATIC = 0,
NVAPI_STEREO_DRIVER_MODE_DIRECT = 2,
} NV_STEREO_DRIVER_MODE;
//! \ingroup stereoapi
NVAPI_INTERFACE NvAPI_Stereo_SetDriverMode( NV_STEREO_DRIVER_MODE mode );
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_GetEyeSeparation
//
//! DESCRIPTION: This API returns eye separation as a ratio of <between eye distance>/<physical screen width>.
//!
//! HOW TO USE: After the stereo handle for device interface is created via successfull call to appropriate API. Applies only to DirectX 9 and up.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \param [in] stereoHandle Stereo handle that corresponds to the device interface.
//! \param [out] pSeparation Eye separation.
//!
//! \retval ::NVAPI_OK Active eye is set.
//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again.
//! \retval ::NVAPI_API_NOT_INTIALIZED NVAPI not initialized.
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR (generic error).
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_GetEyeSeparation(StereoHandle hStereoHandle, float *pSeparation );
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_IsWindowedModeSupported
//
//! DESCRIPTION: This API returns availability of windowed mode stereo
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! \param [out] bSupported(OUT) != 0 - supported, \n
//! == 0 - is not supported
//!
//!
//! \retval ::NVAPI_OK Retrieval of frustum adjust mode was successfull.
//! \retval ::NVAPI_API_NOT_INTIALIZED NVAPI not initialized.
//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized.
//! \retval ::NVAPI_ERROR Something is wrong (generic error).
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_IsWindowedModeSupported(NvU8* bSupported);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_SetSurfaceCreationMode
//
//! \function NvAPI_Stereo_SetSurfaceCreationMode(StereoHandle hStereoHandle, NVAPI_STEREO_SURFACECREATEMODE creationMode)
//! \param [in] hStereoHandle Stereo handle that corresponds to the device interface.
//! \param [in] creationMode New surface creation mode for this device interface.
//!
//! \since Release: 285
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! DESCRIPTION: This API sets surface creation mode for this device interface.
//!
//! WHEN TO USE: After the stereo handle for device interface is created via successful call to appropriate NvAPI_Stereo_CreateHandleFrom function.
//!
//! \return This API can return any of the error codes enumerated in #NvAPI_Status.
//! There are no return error codes with specific meaning for this API.
//!
///////////////////////////////////////////////////////////////////////////////
//! \ingroup stereoapi
typedef enum _NVAPI_STEREO_SURFACECREATEMODE
{
NVAPI_STEREO_SURFACECREATEMODE_AUTO, //!< Use driver registry profile settings for surface creation mode.
NVAPI_STEREO_SURFACECREATEMODE_FORCESTEREO, //!< Always create stereo surfaces.
NVAPI_STEREO_SURFACECREATEMODE_FORCEMONO //!< Always create mono surfaces.
} NVAPI_STEREO_SURFACECREATEMODE;
//! \ingroup stereoapi
NVAPI_INTERFACE NvAPI_Stereo_SetSurfaceCreationMode(__in StereoHandle hStereoHandle, __in NVAPI_STEREO_SURFACECREATEMODE creationMode);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_GetSurfaceCreationMode
//
//! \function NvAPI_Stereo_GetSurfaceCreationMode(StereoHandle hStereoHandle, NVAPI_STEREO_SURFACECREATEMODE* pCreationMode)
//! \param [in] hStereoHandle Stereo handle that corresponds to the device interface.
//! \param [out] pCreationMode The current creation mode for this device interface.
//!
//! \since Release: 295
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! DESCRIPTION: This API gets surface creation mode for this device interface.
//!
//! WHEN TO USE: After the stereo handle for device interface is created via successful call to appropriate NvAPI_Stereo_CreateHandleFrom function.
//!
//! \return This API can return any of the error codes enumerated in #NvAPI_Status.
//! There are no return error codes with specific meaning for this API.
//!
///////////////////////////////////////////////////////////////////////////////
//! \ingroup stereoapi
NVAPI_INTERFACE NvAPI_Stereo_GetSurfaceCreationMode(__in StereoHandle hStereoHandle, __in NVAPI_STEREO_SURFACECREATEMODE* pCreationMode);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_Debug_WasLastDrawStereoized
//
//! \param [in] hStereoHandle Stereo handle that corresponds to the device interface.
//! \param [out] pWasStereoized Address where result of the inquiry will be placed.
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! DESCRIPTION: This API checks if the last draw call was stereoized. It is a very expensive to call and should be used for debugging purpose *only*.
//!
//! WHEN TO USE: After the stereo handle for device interface is created via successful call to appropriate NvAPI_Stereo_CreateHandleFrom function.
//!
//! \return This API can return any of the error codes enumerated in #NvAPI_Status.
//! There are no return error codes with specific meaning for this API.
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_Debug_WasLastDrawStereoized(__in StereoHandle hStereoHandle, __out NvU8 *pWasStereoized);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_SetDefaultProfile
//
//!
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! DESCRIPTION: This API defines the stereo profile used by the driver in case the application has no associated profile.
//!
//! WHEN TO USE: To take effect, this API must be called before D3D device is created. Calling once a device has been created will not affect the current device.
//!
//! \param [in] szProfileName Default profile name.
//!
//! \return This API can return any of the error codes enumerated in #NvAPI_Status.
//! Error codes specific to this API are described below.
//!
//! \retval NVAPI_SUCCESS - Default stereo profile name has been copied into szProfileName.
//! \retval NVAPI_INVALID_ARGUMENT - szProfileName == NULL.
//! \retval NVAPI_DEFAULT_STEREO_PROFILE_DOES_NOT_EXIST - Default stereo profile does not exist
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_SetDefaultProfile(__in const char* szProfileName);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Stereo_GetDefaultProfile
//
//! SUPPORTED OS: Windows Vista and higher
//!
//!
//! DESCRIPTION: This API retrieves the current default stereo profile.
//!
//! After call cbSizeOut contain 0 if default profile is not set required buffer size cbSizeOut.
//! To get needed buffer size this function can be called with szProfileName==0 and cbSizeIn == 0.
//!
//! WHEN TO USE: This API can be called at any time.
//!
//!
//! \param [in] cbSizeIn Size of buffer allocated for default stereo profile name.
//! \param [out] szProfileName Default stereo profile name.
//! \param [out] pcbSizeOut Required buffer size.
//! # ==0 - there is no default stereo profile name currently set
//! # !=0 - size of buffer required for currently set default stereo profile name including trailing '0'.
//!
//!
//! \return This API can return any of the error codes enumerated in #NvAPI_Status.
//! Error codes specific to this API are described below.
//!
//! \retval NVAPI_SUCCESS - Default stereo profile name has been copied into szProfileName.
//! \retval NVAPI_DEFAULT_STEREO_PROFILE_IS_NOT_DEFINED - There is no default stereo profile set at this time.
//! \retval NVAPI_INVALID_ARGUMENT - pcbSizeOut == 0 or cbSizeIn >= *pcbSizeOut && szProfileName == 0
//! \retval NVAPI_INSUFFICIENT_BUFFER - cbSizeIn < *pcbSizeOut
//!
//! \ingroup stereoapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Stereo_GetDefaultProfile( __in NvU32 cbSizeIn, __out_bcount_part_opt(cbSizeIn, *pcbSizeOut) char* szProfileName, __out NvU32 *pcbSizeOut);
#include"nvapi_lite_salend.h"
#ifdef __cplusplus
}
#endif
#pragma pack(pop)

View file

@ -1,105 +0,0 @@
/************************************************************************************************************************************\
|* *|
|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *|
|* *|
|* NOTICE TO USER: *|
|* *|
|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *|
|* *|
|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *|
|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *|
|* Otherwise, you have no rights to use or access this software in any manner. *|
|* *|
|* If not covered by the applicable NVIDIA software license agreement: *|
|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *|
|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *|
|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *|
|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *|
|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *|
|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *|
|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *|
|* *|
|* U.S. Government End Users. *|
|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *|
|* consisting of "commercial computer software" and "commercial computer software documentation" *|
|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *|
|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *|
|* all U.S. Government End Users acquire the software with only those rights set forth herein. *|
|* *|
|* Any use of this software in individual and commercial software must include, *|
|* in the user documentation and internal comments to the code, *|
|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *|
|* *|
\************************************************************************************************************************************/
#pragma once
#include"nvapi_lite_salstart.h"
#include"nvapi_lite_common.h"
#pragma pack(push,8)
#ifdef __cplusplus
extern "C" {
#endif
//! SUPPORTED OS: Windows XP and higher
//!
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_DISP_GetGDIPrimaryDisplayId
//
//! DESCRIPTION: This API returns the Display ID of the GDI Primary.
//!
//! \param [out] displayId Display ID of the GDI Primary display.
//!
//! \retval ::NVAPI_OK: Capabilties have been returned.
//! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND: GDI Primary not on an NVIDIA GPU.
//! \retval ::NVAPI_INVALID_ARGUMENT: One or more args passed in are invalid.
//! \retval ::NVAPI_API_NOT_INTIALIZED: The NvAPI API needs to be initialized first
//! \retval ::NVAPI_NO_IMPLEMENTATION: This entrypoint not available
//! \retval ::NVAPI_ERROR: Miscellaneous error occurred
//!
//! \ingroup dispcontrol
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_DISP_GetGDIPrimaryDisplayId(NvU32* displayId);
#define NV_MOSAIC_MAX_DISPLAYS (64)
//! SUPPORTED OS: Windows Vista and higher
//!
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_Mosaic_GetDisplayViewportsByResolution
//
//! DESCRIPTION: This API returns the viewports that would be applied on
//! the requested display.
//!
//! \param [in] displayId Display ID of a single display in the active
//! mosaic topology to query.
//! \param [in] srcWidth Width of full display topology. If both
//! width and height are 0, the current
//! resolution is used.
//! \param [in] srcHeight Height of full display topology. If both
//! width and height are 0, the current
//! resolution is used.
//! \param [out] viewports Array of NV_RECT viewports which represent
//! the displays as identified in
//! NvAPI_Mosaic_EnumGridTopologies. If the
//! requested resolution is a single-wide
//! resolution, only viewports[0] will
//! contain the viewport details, regardless
//! of which display is driving the display.
//! \param [out] bezelCorrected Returns 1 if the requested resolution is
//! bezel corrected. May be NULL.
//!
//! \retval ::NVAPI_OK Capabilties have been returned.
//! \retval ::NVAPI_INVALID_ARGUMENT One or more args passed in are invalid.
//! \retval ::NVAPI_API_NOT_INTIALIZED The NvAPI API needs to be initialized first
//! \retval ::NVAPI_MOSAIC_NOT_ACTIVE The display does not belong to an active Mosaic Topology
//! \retval ::NVAPI_NO_IMPLEMENTATION This entrypoint not available
//! \retval ::NVAPI_ERROR Miscellaneous error occurred
//!
//! \ingroup mosaicapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_Mosaic_GetDisplayViewportsByResolution(NvU32 displayId, NvU32 srcWidth, NvU32 srcHeight, NV_RECT viewports[NV_MOSAIC_MAX_DISPLAYS], NvU8* bezelCorrected);
#include"nvapi_lite_salend.h"
#ifdef __cplusplus
}
#endif
#pragma pack(pop)

View file

@ -1,916 +0,0 @@
/***************************************************************************\
|* *|
|* Copyright NVIDIA Corporation. All rights reserved. *|
|* *|
|* NOTICE TO USER: *|
|* *|
|* This source code is subject to NVIDIA ownership rights under U.S. *|
|* and international Copyright laws. Users and possessors of this *|
|* source code are hereby granted a nonexclusive, royalty-free *|
|* license to use this code in individual and commercial software. *|
|* *|
|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE *|
|* CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR *|
|* IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH *|
|* REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF *|
|* MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR *|
|* PURPOSE. IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, *|
|* INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES *|
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN *|
|* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *|
|* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE *|
|* CODE. *|
|* *|
|* U.S. Government End Users. This source code is a "commercial item" *|
|* as that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting *|
|* of "commercial computer software" and "commercial computer software *|
|* documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) *|
|* and is provided to the U.S. Government only as a commercial end item. *|
|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through *|
|* 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the *|
|* source code with only those rights set forth herein. *|
|* *|
|* Any use of this source code in individual and commercial software must *|
|* include, in the user documentation and internal comments to the code, *|
|* the above Disclaimer and U.S. Government End Users Notice. *|
|* *|
|* *|
\***************************************************************************/
#include "NvApiDriverSettings.h"
EValues_OGL_AA_LINE_GAMMA g_valuesOGL_AA_LINE_GAMMA[OGL_AA_LINE_GAMMA_NUM_VALUES] =
{
OGL_AA_LINE_GAMMA_DISABLED,
OGL_AA_LINE_GAMMA_ENABLED,
OGL_AA_LINE_GAMMA_MIN,
OGL_AA_LINE_GAMMA_MAX,
};
EValues_OGL_DEEP_COLOR_SCANOUT g_valuesOGL_DEEP_COLOR_SCANOUT[OGL_DEEP_COLOR_SCANOUT_NUM_VALUES] =
{
OGL_DEEP_COLOR_SCANOUT_DISABLE,
OGL_DEEP_COLOR_SCANOUT_ENABLE,
};
EValues_OGL_DEFAULT_SWAP_INTERVAL g_valuesOGL_DEFAULT_SWAP_INTERVAL[OGL_DEFAULT_SWAP_INTERVAL_NUM_VALUES] =
{
OGL_DEFAULT_SWAP_INTERVAL_TEAR,
OGL_DEFAULT_SWAP_INTERVAL_VSYNC_ONE,
OGL_DEFAULT_SWAP_INTERVAL_VSYNC,
OGL_DEFAULT_SWAP_INTERVAL_VALUE_MASK,
OGL_DEFAULT_SWAP_INTERVAL_FORCE_MASK,
OGL_DEFAULT_SWAP_INTERVAL_FORCE_OFF,
OGL_DEFAULT_SWAP_INTERVAL_FORCE_ON,
OGL_DEFAULT_SWAP_INTERVAL_APP_CONTROLLED,
OGL_DEFAULT_SWAP_INTERVAL_DISABLE,
};
EValues_OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL g_valuesOGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL[OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_NUM_VALUES] =
{
OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_ZERO_SCANLINES,
OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_ONE_FULL_FRAME_OF_SCANLINES,
};
EValues_OGL_DEFAULT_SWAP_INTERVAL_SIGN g_valuesOGL_DEFAULT_SWAP_INTERVAL_SIGN[OGL_DEFAULT_SWAP_INTERVAL_SIGN_NUM_VALUES] =
{
OGL_DEFAULT_SWAP_INTERVAL_SIGN_POSITIVE,
OGL_DEFAULT_SWAP_INTERVAL_SIGN_NEGATIVE,
};
EValues_OGL_EVENT_LOG_SEVERITY_THRESHOLD g_valuesOGL_EVENT_LOG_SEVERITY_THRESHOLD[OGL_EVENT_LOG_SEVERITY_THRESHOLD_NUM_VALUES] =
{
OGL_EVENT_LOG_SEVERITY_THRESHOLD_DISABLE,
OGL_EVENT_LOG_SEVERITY_THRESHOLD_CRITICAL,
OGL_EVENT_LOG_SEVERITY_THRESHOLD_WARNING,
OGL_EVENT_LOG_SEVERITY_THRESHOLD_INFORMATION,
OGL_EVENT_LOG_SEVERITY_THRESHOLD_ALL,
};
EValues_OGL_FORCE_BLIT g_valuesOGL_FORCE_BLIT[OGL_FORCE_BLIT_NUM_VALUES] =
{
OGL_FORCE_BLIT_ON,
OGL_FORCE_BLIT_OFF,
};
EValues_OGL_FORCE_STEREO g_valuesOGL_FORCE_STEREO[OGL_FORCE_STEREO_NUM_VALUES] =
{
OGL_FORCE_STEREO_OFF,
OGL_FORCE_STEREO_ON,
};
const wchar_t * g_valuesOGL_IMPLICIT_GPU_AFFINITY[OGL_IMPLICIT_GPU_AFFINITY_NUM_VALUES] =
{
OGL_IMPLICIT_GPU_AFFINITY_AUTOSELECT
};
EValues_OGL_MULTIMON g_valuesOGL_MULTIMON[OGL_MULTIMON_NUM_VALUES] =
{
OGL_MULTIMON_SINGLE_MONITOR,
OGL_MULTIMON_COMPATIBILITY_LCD,
OGL_MULTIMON_COMPATIBILITY_GCD,
OGL_MULTIMON_PERFORMANCE_LCD,
OGL_MULTIMON_PERFORMANCE_GCD,
OGL_MULTIMON_EXTENDED_SINGLE_MONITOR,
OGL_MULTIMON_PERFORMANCE_QUADRO,
OGL_MULTIMON_MULTIMON_BUFFER,
};
EValues_OGL_OVERLAY_PIXEL_TYPE g_valuesOGL_OVERLAY_PIXEL_TYPE[OGL_OVERLAY_PIXEL_TYPE_NUM_VALUES] =
{
OGL_OVERLAY_PIXEL_TYPE_NONE,
OGL_OVERLAY_PIXEL_TYPE_CI,
OGL_OVERLAY_PIXEL_TYPE_RGBA,
OGL_OVERLAY_PIXEL_TYPE_CI_AND_RGBA,
};
EValues_OGL_OVERLAY_SUPPORT g_valuesOGL_OVERLAY_SUPPORT[OGL_OVERLAY_SUPPORT_NUM_VALUES] =
{
OGL_OVERLAY_SUPPORT_OFF,
OGL_OVERLAY_SUPPORT_ON,
OGL_OVERLAY_SUPPORT_FORCE_SW,
};
EValues_OGL_QUALITY_ENHANCEMENTS g_valuesOGL_QUALITY_ENHANCEMENTS[OGL_QUALITY_ENHANCEMENTS_NUM_VALUES] =
{
OGL_QUALITY_ENHANCEMENTS_HQUAL,
OGL_QUALITY_ENHANCEMENTS_QUAL,
OGL_QUALITY_ENHANCEMENTS_PERF,
OGL_QUALITY_ENHANCEMENTS_HPERF,
};
EValues_OGL_SINGLE_BACKDEPTH_BUFFER g_valuesOGL_SINGLE_BACKDEPTH_BUFFER[OGL_SINGLE_BACKDEPTH_BUFFER_NUM_VALUES] =
{
OGL_SINGLE_BACKDEPTH_BUFFER_DISABLE,
OGL_SINGLE_BACKDEPTH_BUFFER_ENABLE,
OGL_SINGLE_BACKDEPTH_BUFFER_USE_HW_DEFAULT,
};
EValues_OGL_THREAD_CONTROL g_valuesOGL_THREAD_CONTROL[OGL_THREAD_CONTROL_NUM_VALUES] =
{
OGL_THREAD_CONTROL_ENABLE,
OGL_THREAD_CONTROL_DISABLE,
};
EValues_OGL_TRIPLE_BUFFER g_valuesOGL_TRIPLE_BUFFER[OGL_TRIPLE_BUFFER_NUM_VALUES] =
{
OGL_TRIPLE_BUFFER_DISABLED,
OGL_TRIPLE_BUFFER_ENABLED,
};
EValues_OGL_VIDEO_EDITING_MODE g_valuesOGL_VIDEO_EDITING_MODE[OGL_VIDEO_EDITING_MODE_NUM_VALUES] =
{
OGL_VIDEO_EDITING_MODE_DISABLE,
OGL_VIDEO_EDITING_MODE_ENABLE,
};
EValues_AA_BEHAVIOR_FLAGS g_valuesAA_BEHAVIOR_FLAGS[AA_BEHAVIOR_FLAGS_NUM_VALUES] =
{
AA_BEHAVIOR_FLAGS_NONE,
AA_BEHAVIOR_FLAGS_TREAT_OVERRIDE_AS_APP_CONTROLLED,
AA_BEHAVIOR_FLAGS_TREAT_OVERRIDE_AS_ENHANCE,
AA_BEHAVIOR_FLAGS_DISABLE_OVERRIDE,
AA_BEHAVIOR_FLAGS_TREAT_ENHANCE_AS_APP_CONTROLLED,
AA_BEHAVIOR_FLAGS_TREAT_ENHANCE_AS_OVERRIDE,
AA_BEHAVIOR_FLAGS_DISABLE_ENHANCE,
AA_BEHAVIOR_FLAGS_MAP_VCAA_TO_MULTISAMPLING,
AA_BEHAVIOR_FLAGS_SLI_DISABLE_TRANSPARENCY_SUPERSAMPLING,
AA_BEHAVIOR_FLAGS_DISABLE_CPLAA,
AA_BEHAVIOR_FLAGS_SKIP_RT_DIM_CHECK_FOR_ENHANCE,
AA_BEHAVIOR_FLAGS_DISABLE_SLIAA,
AA_BEHAVIOR_FLAGS_DEFAULT,
AA_BEHAVIOR_FLAGS_AA_RT_BPP_DIV_4,
AA_BEHAVIOR_FLAGS_AA_RT_BPP_DIV_4_SHIFT,
AA_BEHAVIOR_FLAGS_NON_AA_RT_BPP_DIV_4,
AA_BEHAVIOR_FLAGS_NON_AA_RT_BPP_DIV_4_SHIFT,
AA_BEHAVIOR_FLAGS_MASK,
};
EValues_AA_MODE_ALPHATOCOVERAGE g_valuesAA_MODE_ALPHATOCOVERAGE[AA_MODE_ALPHATOCOVERAGE_NUM_VALUES] =
{
AA_MODE_ALPHATOCOVERAGE_MODE_MASK,
AA_MODE_ALPHATOCOVERAGE_MODE_OFF,
AA_MODE_ALPHATOCOVERAGE_MODE_ON,
AA_MODE_ALPHATOCOVERAGE_MODE_MAX,
};
EValues_AA_MODE_GAMMACORRECTION g_valuesAA_MODE_GAMMACORRECTION[AA_MODE_GAMMACORRECTION_NUM_VALUES] =
{
AA_MODE_GAMMACORRECTION_MASK,
AA_MODE_GAMMACORRECTION_OFF,
AA_MODE_GAMMACORRECTION_ON_IF_FOS,
AA_MODE_GAMMACORRECTION_ON_ALWAYS,
AA_MODE_GAMMACORRECTION_MAX,
AA_MODE_GAMMACORRECTION_DEFAULT,
AA_MODE_GAMMACORRECTION_DEFAULT_TESLA,
AA_MODE_GAMMACORRECTION_DEFAULT_FERMI,
};
EValues_AA_MODE_METHOD g_valuesAA_MODE_METHOD[AA_MODE_METHOD_NUM_VALUES] =
{
AA_MODE_METHOD_NONE,
AA_MODE_METHOD_SUPERSAMPLE_2X_H,
AA_MODE_METHOD_SUPERSAMPLE_2X_V,
AA_MODE_METHOD_SUPERSAMPLE_1_5X1_5,
AA_MODE_METHOD_FREE_0x03,
AA_MODE_METHOD_FREE_0x04,
AA_MODE_METHOD_SUPERSAMPLE_4X,
AA_MODE_METHOD_SUPERSAMPLE_4X_BIAS,
AA_MODE_METHOD_SUPERSAMPLE_4X_GAUSSIAN,
AA_MODE_METHOD_FREE_0x08,
AA_MODE_METHOD_FREE_0x09,
AA_MODE_METHOD_SUPERSAMPLE_9X,
AA_MODE_METHOD_SUPERSAMPLE_9X_BIAS,
AA_MODE_METHOD_SUPERSAMPLE_16X,
AA_MODE_METHOD_SUPERSAMPLE_16X_BIAS,
AA_MODE_METHOD_MULTISAMPLE_2X_DIAGONAL,
AA_MODE_METHOD_MULTISAMPLE_2X_QUINCUNX,
AA_MODE_METHOD_MULTISAMPLE_4X,
AA_MODE_METHOD_FREE_0x11,
AA_MODE_METHOD_MULTISAMPLE_4X_GAUSSIAN,
AA_MODE_METHOD_MIXEDSAMPLE_4X_SKEWED_4TAP,
AA_MODE_METHOD_FREE_0x14,
AA_MODE_METHOD_FREE_0x15,
AA_MODE_METHOD_MIXEDSAMPLE_6X,
AA_MODE_METHOD_MIXEDSAMPLE_6X_SKEWED_6TAP,
AA_MODE_METHOD_MIXEDSAMPLE_8X,
AA_MODE_METHOD_MIXEDSAMPLE_8X_SKEWED_8TAP,
AA_MODE_METHOD_MIXEDSAMPLE_16X,
AA_MODE_METHOD_MULTISAMPLE_4X_GAMMA,
AA_MODE_METHOD_MULTISAMPLE_16X,
AA_MODE_METHOD_VCAA_32X_8v24,
AA_MODE_METHOD_CORRUPTION_CHECK,
AA_MODE_METHOD_6X_CT,
AA_MODE_METHOD_MULTISAMPLE_2X_DIAGONAL_GAMMA,
AA_MODE_METHOD_SUPERSAMPLE_4X_GAMMA,
AA_MODE_METHOD_MULTISAMPLE_4X_FOSGAMMA,
AA_MODE_METHOD_MULTISAMPLE_2X_DIAGONAL_FOSGAMMA,
AA_MODE_METHOD_SUPERSAMPLE_4X_FOSGAMMA,
AA_MODE_METHOD_MULTISAMPLE_8X,
AA_MODE_METHOD_VCAA_8X_4v4,
AA_MODE_METHOD_VCAA_16X_4v12,
AA_MODE_METHOD_VCAA_16X_8v8,
AA_MODE_METHOD_MIXEDSAMPLE_32X,
AA_MODE_METHOD_SUPERVCAA_64X_4v12,
AA_MODE_METHOD_SUPERVCAA_64X_8v8,
AA_MODE_METHOD_MIXEDSAMPLE_64X,
AA_MODE_METHOD_MIXEDSAMPLE_128X,
AA_MODE_METHOD_COUNT,
AA_MODE_METHOD_METHOD_MASK,
AA_MODE_METHOD_METHOD_MAX,
};
EValues_AA_MODE_REPLAY g_valuesAA_MODE_REPLAY[AA_MODE_REPLAY_NUM_VALUES] =
{
AA_MODE_REPLAY_SAMPLES_MASK,
AA_MODE_REPLAY_SAMPLES_ONE,
AA_MODE_REPLAY_SAMPLES_TWO,
AA_MODE_REPLAY_SAMPLES_FOUR,
AA_MODE_REPLAY_SAMPLES_EIGHT,
AA_MODE_REPLAY_SAMPLES_MAX,
AA_MODE_REPLAY_MODE_MASK,
AA_MODE_REPLAY_MODE_OFF,
AA_MODE_REPLAY_MODE_ALPHA_TEST,
AA_MODE_REPLAY_MODE_PIXEL_KILL,
AA_MODE_REPLAY_MODE_DYN_BRANCH,
AA_MODE_REPLAY_MODE_OPTIMAL,
AA_MODE_REPLAY_MODE_ALL,
AA_MODE_REPLAY_MODE_MAX,
AA_MODE_REPLAY_TRANSPARENCY,
AA_MODE_REPLAY_DISALLOW_TRAA,
AA_MODE_REPLAY_TRANSPARENCY_DEFAULT,
AA_MODE_REPLAY_TRANSPARENCY_DEFAULT_TESLA,
AA_MODE_REPLAY_TRANSPARENCY_DEFAULT_FERMI,
AA_MODE_REPLAY_MASK,
};
EValues_AA_MODE_SELECTOR g_valuesAA_MODE_SELECTOR[AA_MODE_SELECTOR_NUM_VALUES] =
{
AA_MODE_SELECTOR_MASK,
AA_MODE_SELECTOR_APP_CONTROL,
AA_MODE_SELECTOR_OVERRIDE,
AA_MODE_SELECTOR_ENHANCE,
AA_MODE_SELECTOR_MAX,
};
EValues_AA_MODE_SELECTOR_SLIAA g_valuesAA_MODE_SELECTOR_SLIAA[AA_MODE_SELECTOR_SLIAA_NUM_VALUES] =
{
AA_MODE_SELECTOR_SLIAA_DISABLED,
AA_MODE_SELECTOR_SLIAA_ENABLED,
};
EValues_ANISO_MODE_LEVEL g_valuesANISO_MODE_LEVEL[ANISO_MODE_LEVEL_NUM_VALUES] =
{
ANISO_MODE_LEVEL_MASK,
ANISO_MODE_LEVEL_NONE_POINT,
ANISO_MODE_LEVEL_NONE_LINEAR,
ANISO_MODE_LEVEL_MAX,
ANISO_MODE_LEVEL_DEFAULT,
};
EValues_ANISO_MODE_SELECTOR g_valuesANISO_MODE_SELECTOR[ANISO_MODE_SELECTOR_NUM_VALUES] =
{
ANISO_MODE_SELECTOR_MASK,
ANISO_MODE_SELECTOR_APP,
ANISO_MODE_SELECTOR_USER,
ANISO_MODE_SELECTOR_COND,
ANISO_MODE_SELECTOR_MAX,
ANISO_MODE_SELECTOR_DEFAULT,
};
EValues_APPLICATION_PROFILE_NOTIFICATION_TIMEOUT g_valuesAPPLICATION_PROFILE_NOTIFICATION_TIMEOUT[APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_NUM_VALUES] =
{
APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DISABLED,
APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_NINE_SECONDS,
APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_FIFTEEN_SECONDS,
APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_THIRTY_SECONDS,
APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ONE_MINUTE,
APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_TWO_MINUTES,
};
EValues_CPL_HIDDEN_PROFILE g_valuesCPL_HIDDEN_PROFILE[CPL_HIDDEN_PROFILE_NUM_VALUES] =
{
CPL_HIDDEN_PROFILE_DISABLED,
CPL_HIDDEN_PROFILE_ENABLED,
};
const wchar_t * g_valuesCUDA_EXCLUDED_GPUS[CUDA_EXCLUDED_GPUS_NUM_VALUES] =
{
CUDA_EXCLUDED_GPUS_NONE
};
const wchar_t * g_valuesD3DOGL_GPU_MAX_POWER[D3DOGL_GPU_MAX_POWER_NUM_VALUES] =
{
D3DOGL_GPU_MAX_POWER_DEFAULTPOWER
};
EValues_EXPORT_PERF_COUNTERS g_valuesEXPORT_PERF_COUNTERS[EXPORT_PERF_COUNTERS_NUM_VALUES] =
{
EXPORT_PERF_COUNTERS_OFF,
EXPORT_PERF_COUNTERS_ON,
};
EValues_FXAA_ALLOW g_valuesFXAA_ALLOW[FXAA_ALLOW_NUM_VALUES] =
{
FXAA_ALLOW_DISALLOWED,
FXAA_ALLOW_ALLOWED,
};
EValues_FXAA_ENABLE g_valuesFXAA_ENABLE[FXAA_ENABLE_NUM_VALUES] =
{
FXAA_ENABLE_OFF,
FXAA_ENABLE_ON,
};
EValues_FXAA_INDICATOR_ENABLE g_valuesFXAA_INDICATOR_ENABLE[FXAA_INDICATOR_ENABLE_NUM_VALUES] =
{
FXAA_INDICATOR_ENABLE_OFF,
FXAA_INDICATOR_ENABLE_ON,
};
EValues_MCSFRSHOWSPLIT g_valuesMCSFRSHOWSPLIT[MCSFRSHOWSPLIT_NUM_VALUES] =
{
MCSFRSHOWSPLIT_DISABLED,
MCSFRSHOWSPLIT_ENABLED,
};
EValues_NV_QUALITY_UPSCALING g_valuesNV_QUALITY_UPSCALING[NV_QUALITY_UPSCALING_NUM_VALUES] =
{
NV_QUALITY_UPSCALING_OFF,
NV_QUALITY_UPSCALING_ON,
};
EValues_OPTIMUS_MAXAA g_valuesOPTIMUS_MAXAA[OPTIMUS_MAXAA_NUM_VALUES] =
{
OPTIMUS_MAXAA_MIN,
OPTIMUS_MAXAA_MAX,
};
EValues_PHYSXINDICATOR g_valuesPHYSXINDICATOR[PHYSXINDICATOR_NUM_VALUES] =
{
PHYSXINDICATOR_DISABLED,
PHYSXINDICATOR_ENABLED,
};
EValues_PREFERRED_PSTATE g_valuesPREFERRED_PSTATE[PREFERRED_PSTATE_NUM_VALUES] =
{
PREFERRED_PSTATE_ADAPTIVE,
PREFERRED_PSTATE_PREFER_MAX,
PREFERRED_PSTATE_DRIVER_CONTROLLED,
PREFERRED_PSTATE_PREFER_CONSISTENT_PERFORMANCE,
PREFERRED_PSTATE_PREFER_MIN,
PREFERRED_PSTATE_MIN,
PREFERRED_PSTATE_MAX,
};
EValues_PREVENT_UI_AF_OVERRIDE g_valuesPREVENT_UI_AF_OVERRIDE[PREVENT_UI_AF_OVERRIDE_NUM_VALUES] =
{
PREVENT_UI_AF_OVERRIDE_OFF,
PREVENT_UI_AF_OVERRIDE_ON,
};
EValues_PS_FRAMERATE_LIMITER g_valuesPS_FRAMERATE_LIMITER[PS_FRAMERATE_LIMITER_NUM_VALUES] =
{
PS_FRAMERATE_LIMITER_DISABLED,
PS_FRAMERATE_LIMITER_FPS_20,
PS_FRAMERATE_LIMITER_FPS_30,
PS_FRAMERATE_LIMITER_FPS_40,
PS_FRAMERATE_LIMITER_FPSMASK,
PS_FRAMERATE_LIMITER_FORCE_VSYNC_OFF,
PS_FRAMERATE_LIMITER_GPS_WEB,
PS_FRAMERATE_LIMITER_FORCE_OPTIMUS_POLICY,
PS_FRAMERATE_LIMITER_DISALLOWED,
PS_FRAMERATE_LIMITER_USE_CPU_WAIT,
PS_FRAMERATE_LIMITER_THRESHOLD,
PS_FRAMERATE_LIMITER_TEMPERATURE,
PS_FRAMERATE_LIMITER_POWER,
PS_FRAMERATE_LIMITER_MODEMASK,
PS_FRAMERATE_LIMITER_ACCURATE,
PS_FRAMERATE_LIMITER_ALLOW_WINDOWED,
PS_FRAMERATE_LIMITER_FORCEON,
PS_FRAMERATE_LIMITER_ENABLED,
PS_FRAMERATE_LIMITER_OPENGL_REMOTE_DESKTOP,
PS_FRAMERATE_LIMITER_MASK,
};
EValues_PS_FRAMERATE_LIMITER_GPS_CTRL g_valuesPS_FRAMERATE_LIMITER_GPS_CTRL[PS_FRAMERATE_LIMITER_GPS_CTRL_NUM_VALUES] =
{
PS_FRAMERATE_LIMITER_GPS_CTRL_DISABLED,
PS_FRAMERATE_LIMITER_GPS_CTRL_DECREASE_FILTER_MASK,
PS_FRAMERATE_LIMITER_GPS_CTRL_PAUSE_TIME_MASK,
PS_FRAMERATE_LIMITER_GPS_CTRL_PAUSE_TIME_SHIFT,
PS_FRAMERATE_LIMITER_GPS_CTRL_TARGET_RENDER_TIME_MASK,
PS_FRAMERATE_LIMITER_GPS_CTRL_TARGET_RENDER_TIME_SHIFT,
PS_FRAMERATE_LIMITER_GPS_CTRL_PERF_STEP_SIZE_MASK,
PS_FRAMERATE_LIMITER_GPS_CTRL_PERF_STEP_SIZE_SHIFT,
PS_FRAMERATE_LIMITER_GPS_CTRL_INCREASE_FILTER_MASK,
PS_FRAMERATE_LIMITER_GPS_CTRL_INCREASE_FILTER_SHIFT,
PS_FRAMERATE_LIMITER_GPS_CTRL_OPTIMAL_SETTING,
};
EValues_PS_FRAMERATE_MONITOR_CTRL g_valuesPS_FRAMERATE_MONITOR_CTRL[PS_FRAMERATE_MONITOR_CTRL_NUM_VALUES] =
{
PS_FRAMERATE_MONITOR_CTRL_DISABLED,
PS_FRAMERATE_MONITOR_CTRL_THRESHOLD_PCT_MASK,
PS_FRAMERATE_MONITOR_CTRL_MOVING_AVG_X_MASK,
PS_FRAMERATE_MONITOR_CTRL_MOVING_AVG_X_SHIFT,
PS_FRAMERATE_MONITOR_CTRL_OPTIMAL_SETTING,
};
EValues_SHIM_MCCOMPAT g_valuesSHIM_MCCOMPAT[SHIM_MCCOMPAT_NUM_VALUES] =
{
SHIM_MCCOMPAT_INTEGRATED,
SHIM_MCCOMPAT_ENABLE,
SHIM_MCCOMPAT_USER_EDITABLE,
SHIM_MCCOMPAT_MASK,
SHIM_MCCOMPAT_VIDEO_MASK,
SHIM_MCCOMPAT_VARYING_BIT,
SHIM_MCCOMPAT_AUTO_SELECT,
SHIM_MCCOMPAT_OVERRIDE_BIT,
};
EValues_SHIM_RENDERING_MODE g_valuesSHIM_RENDERING_MODE[SHIM_RENDERING_MODE_NUM_VALUES] =
{
SHIM_RENDERING_MODE_INTEGRATED,
SHIM_RENDERING_MODE_ENABLE,
SHIM_RENDERING_MODE_USER_EDITABLE,
SHIM_RENDERING_MODE_MASK,
SHIM_RENDERING_MODE_VIDEO_MASK,
SHIM_RENDERING_MODE_VARYING_BIT,
SHIM_RENDERING_MODE_AUTO_SELECT,
SHIM_RENDERING_MODE_OVERRIDE_BIT,
};
EValues_SHIM_RENDERING_OPTIONS g_valuesSHIM_RENDERING_OPTIONS[SHIM_RENDERING_OPTIONS_NUM_VALUES] =
{
SHIM_RENDERING_OPTIONS_DEFAULT_RENDERING_MODE,
SHIM_RENDERING_OPTIONS_DISABLE_ASYNC_PRESENT,
SHIM_RENDERING_OPTIONS_EHSHELL_DETECT,
SHIM_RENDERING_OPTIONS_FLASHPLAYER_HOST_DETECT,
SHIM_RENDERING_OPTIONS_VIDEO_DRM_APP_DETECT,
SHIM_RENDERING_OPTIONS_IGNORE_OVERRIDES,
SHIM_RENDERING_OPTIONS_CHILDPROCESS_DETECT,
SHIM_RENDERING_OPTIONS_ENABLE_DWM_ASYNC_PRESENT,
SHIM_RENDERING_OPTIONS_PARENTPROCESS_DETECT,
SHIM_RENDERING_OPTIONS_ALLOW_INHERITANCE,
SHIM_RENDERING_OPTIONS_DISABLE_WRAPPERS,
SHIM_RENDERING_OPTIONS_DISABLE_DXGI_WRAPPERS,
SHIM_RENDERING_OPTIONS_PRUNE_UNSUPPORTED_FORMATS,
SHIM_RENDERING_OPTIONS_ENABLE_ALPHA_FORMAT,
SHIM_RENDERING_OPTIONS_IGPU_TRANSCODING,
SHIM_RENDERING_OPTIONS_DISABLE_CUDA,
SHIM_RENDERING_OPTIONS_ALLOW_CP_CAPS_FOR_VIDEO,
SHIM_RENDERING_OPTIONS_IGPU_TRANSCODING_FWD_OPTIMUS,
SHIM_RENDERING_OPTIONS_DISABLE_DURING_SECURE_BOOT,
SHIM_RENDERING_OPTIONS_INVERT_FOR_QUADRO,
SHIM_RENDERING_OPTIONS_INVERT_FOR_MSHYBRID,
SHIM_RENDERING_OPTIONS_REGISTER_PROCESS_ENABLE_GOLD,
SHIM_RENDERING_OPTIONS_HANDLE_WINDOWED_MODE_PERF_OPT,
SHIM_RENDERING_OPTIONS_HANDLE_WIN7_ASYNC_RUNTIME_BUG,
};
EValues_SLI_GPU_COUNT g_valuesSLI_GPU_COUNT[SLI_GPU_COUNT_NUM_VALUES] =
{
SLI_GPU_COUNT_AUTOSELECT,
SLI_GPU_COUNT_ONE,
SLI_GPU_COUNT_TWO,
SLI_GPU_COUNT_THREE,
SLI_GPU_COUNT_FOUR,
};
EValues_SLI_PREDEFINED_GPU_COUNT g_valuesSLI_PREDEFINED_GPU_COUNT[SLI_PREDEFINED_GPU_COUNT_NUM_VALUES] =
{
SLI_PREDEFINED_GPU_COUNT_AUTOSELECT,
SLI_PREDEFINED_GPU_COUNT_ONE,
SLI_PREDEFINED_GPU_COUNT_TWO,
SLI_PREDEFINED_GPU_COUNT_THREE,
SLI_PREDEFINED_GPU_COUNT_FOUR,
};
EValues_SLI_PREDEFINED_GPU_COUNT_DX10 g_valuesSLI_PREDEFINED_GPU_COUNT_DX10[SLI_PREDEFINED_GPU_COUNT_DX10_NUM_VALUES] =
{
SLI_PREDEFINED_GPU_COUNT_DX10_AUTOSELECT,
SLI_PREDEFINED_GPU_COUNT_DX10_ONE,
SLI_PREDEFINED_GPU_COUNT_DX10_TWO,
SLI_PREDEFINED_GPU_COUNT_DX10_THREE,
SLI_PREDEFINED_GPU_COUNT_DX10_FOUR,
};
EValues_SLI_PREDEFINED_MODE g_valuesSLI_PREDEFINED_MODE[SLI_PREDEFINED_MODE_NUM_VALUES] =
{
SLI_PREDEFINED_MODE_AUTOSELECT,
SLI_PREDEFINED_MODE_FORCE_SINGLE,
SLI_PREDEFINED_MODE_FORCE_AFR,
SLI_PREDEFINED_MODE_FORCE_AFR2,
SLI_PREDEFINED_MODE_FORCE_SFR,
SLI_PREDEFINED_MODE_FORCE_AFR_OF_SFR__FALLBACK_3AFR,
};
EValues_SLI_PREDEFINED_MODE_DX10 g_valuesSLI_PREDEFINED_MODE_DX10[SLI_PREDEFINED_MODE_DX10_NUM_VALUES] =
{
SLI_PREDEFINED_MODE_DX10_AUTOSELECT,
SLI_PREDEFINED_MODE_DX10_FORCE_SINGLE,
SLI_PREDEFINED_MODE_DX10_FORCE_AFR,
SLI_PREDEFINED_MODE_DX10_FORCE_AFR2,
SLI_PREDEFINED_MODE_DX10_FORCE_SFR,
SLI_PREDEFINED_MODE_DX10_FORCE_AFR_OF_SFR__FALLBACK_3AFR,
};
EValues_SLI_RENDERING_MODE g_valuesSLI_RENDERING_MODE[SLI_RENDERING_MODE_NUM_VALUES] =
{
SLI_RENDERING_MODE_AUTOSELECT,
SLI_RENDERING_MODE_FORCE_SINGLE,
SLI_RENDERING_MODE_FORCE_AFR,
SLI_RENDERING_MODE_FORCE_AFR2,
SLI_RENDERING_MODE_FORCE_SFR,
SLI_RENDERING_MODE_FORCE_AFR_OF_SFR__FALLBACK_3AFR,
};
EValues_VRPRERENDERLIMIT g_valuesVRPRERENDERLIMIT[VRPRERENDERLIMIT_NUM_VALUES] =
{
VRPRERENDERLIMIT_MIN,
VRPRERENDERLIMIT_MAX,
VRPRERENDERLIMIT_APP_CONTROLLED,
VRPRERENDERLIMIT_DEFAULT,
};
EValues_VRRFEATUREINDICATOR g_valuesVRRFEATUREINDICATOR[VRRFEATUREINDICATOR_NUM_VALUES] =
{
VRRFEATUREINDICATOR_DISABLED,
VRRFEATUREINDICATOR_ENABLED,
};
EValues_VRROVERLAYINDICATOR g_valuesVRROVERLAYINDICATOR[VRROVERLAYINDICATOR_NUM_VALUES] =
{
VRROVERLAYINDICATOR_DISABLED,
VRROVERLAYINDICATOR_ENABLED,
};
EValues_VRRREQUESTSTATE g_valuesVRRREQUESTSTATE[VRRREQUESTSTATE_NUM_VALUES] =
{
VRRREQUESTSTATE_DISABLED,
VRRREQUESTSTATE_FULLSCREEN_ONLY,
VRRREQUESTSTATE_FULLSCREEN_AND_WINDOWED,
};
EValues_VRR_APP_OVERRIDE g_valuesVRR_APP_OVERRIDE[VRR_APP_OVERRIDE_NUM_VALUES] =
{
VRR_APP_OVERRIDE_ALLOW,
VRR_APP_OVERRIDE_FORCE_OFF,
VRR_APP_OVERRIDE_DISALLOW,
VRR_APP_OVERRIDE_ULMB,
VRR_APP_OVERRIDE_FIXED_REFRESH,
};
EValues_VRR_APP_OVERRIDE_REQUEST_STATE g_valuesVRR_APP_OVERRIDE_REQUEST_STATE[VRR_APP_OVERRIDE_REQUEST_STATE_NUM_VALUES] =
{
VRR_APP_OVERRIDE_REQUEST_STATE_ALLOW,
VRR_APP_OVERRIDE_REQUEST_STATE_FORCE_OFF,
VRR_APP_OVERRIDE_REQUEST_STATE_DISALLOW,
VRR_APP_OVERRIDE_REQUEST_STATE_ULMB,
VRR_APP_OVERRIDE_REQUEST_STATE_FIXED_REFRESH,
};
EValues_VRR_MODE g_valuesVRR_MODE[VRR_MODE_NUM_VALUES] =
{
VRR_MODE_DISABLED,
VRR_MODE_FULLSCREEN_ONLY,
VRR_MODE_FULLSCREEN_AND_WINDOWED,
};
EValues_VSYNCSMOOTHAFR g_valuesVSYNCSMOOTHAFR[VSYNCSMOOTHAFR_NUM_VALUES] =
{
VSYNCSMOOTHAFR_OFF,
VSYNCSMOOTHAFR_ON,
};
EValues_VSYNCVRRCONTROL g_valuesVSYNCVRRCONTROL[VSYNCVRRCONTROL_NUM_VALUES] =
{
VSYNCVRRCONTROL_DISABLE,
VSYNCVRRCONTROL_ENABLE,
VSYNCVRRCONTROL_NOTSUPPORTED,
};
EValues_VSYNC_BEHAVIOR_FLAGS g_valuesVSYNC_BEHAVIOR_FLAGS[VSYNC_BEHAVIOR_FLAGS_NUM_VALUES] =
{
VSYNC_BEHAVIOR_FLAGS_NONE,
VSYNC_BEHAVIOR_FLAGS_DEFAULT,
VSYNC_BEHAVIOR_FLAGS_IGNORE_FLIPINTERVAL_MULTIPLE,
};
EValues_WKS_API_STEREO_EYES_EXCHANGE g_valuesWKS_API_STEREO_EYES_EXCHANGE[WKS_API_STEREO_EYES_EXCHANGE_NUM_VALUES] =
{
WKS_API_STEREO_EYES_EXCHANGE_OFF,
WKS_API_STEREO_EYES_EXCHANGE_ON,
};
EValues_WKS_API_STEREO_MODE g_valuesWKS_API_STEREO_MODE[WKS_API_STEREO_MODE_NUM_VALUES] =
{
WKS_API_STEREO_MODE_SHUTTER_GLASSES,
WKS_API_STEREO_MODE_VERTICAL_INTERLACED,
WKS_API_STEREO_MODE_TWINVIEW,
WKS_API_STEREO_MODE_NV17_SHUTTER_GLASSES_AUTO,
WKS_API_STEREO_MODE_NV17_SHUTTER_GLASSES_DAC0,
WKS_API_STEREO_MODE_NV17_SHUTTER_GLASSES_DAC1,
WKS_API_STEREO_MODE_COLOR_LINE,
WKS_API_STEREO_MODE_COLOR_INTERLEAVED,
WKS_API_STEREO_MODE_ANAGLYPH,
WKS_API_STEREO_MODE_HORIZONTAL_INTERLACED,
WKS_API_STEREO_MODE_SIDE_FIELD,
WKS_API_STEREO_MODE_SUB_FIELD,
WKS_API_STEREO_MODE_CHECKERBOARD,
WKS_API_STEREO_MODE_INVERSE_CHECKERBOARD,
WKS_API_STEREO_MODE_TRIDELITY_SL,
WKS_API_STEREO_MODE_TRIDELITY_MV,
WKS_API_STEREO_MODE_SEEFRONT,
WKS_API_STEREO_MODE_STEREO_MIRROR,
WKS_API_STEREO_MODE_FRAME_SEQUENTIAL,
WKS_API_STEREO_MODE_AUTODETECT_PASSIVE_MODE,
WKS_API_STEREO_MODE_AEGIS_DT_FRAME_SEQUENTIAL,
WKS_API_STEREO_MODE_OEM_EMITTER_FRAME_SEQUENTIAL,
WKS_API_STEREO_MODE_USE_HW_DEFAULT,
WKS_API_STEREO_MODE_DEFAULT_GL,
};
EValues_WKS_MEMORY_ALLOCATION_POLICY g_valuesWKS_MEMORY_ALLOCATION_POLICY[WKS_MEMORY_ALLOCATION_POLICY_NUM_VALUES] =
{
WKS_MEMORY_ALLOCATION_POLICY_AS_NEEDED,
WKS_MEMORY_ALLOCATION_POLICY_MODERATE_PRE_ALLOCATION,
WKS_MEMORY_ALLOCATION_POLICY_AGGRESSIVE_PRE_ALLOCATION,
};
EValues_WKS_STEREO_DONGLE_SUPPORT g_valuesWKS_STEREO_DONGLE_SUPPORT[WKS_STEREO_DONGLE_SUPPORT_NUM_VALUES] =
{
WKS_STEREO_DONGLE_SUPPORT_OFF,
WKS_STEREO_DONGLE_SUPPORT_DAC,
WKS_STEREO_DONGLE_SUPPORT_DLP,
};
EValues_WKS_STEREO_SUPPORT g_valuesWKS_STEREO_SUPPORT[WKS_STEREO_SUPPORT_NUM_VALUES] =
{
WKS_STEREO_SUPPORT_OFF,
WKS_STEREO_SUPPORT_ON,
};
EValues_WKS_STEREO_SWAP_MODE g_valuesWKS_STEREO_SWAP_MODE[WKS_STEREO_SWAP_MODE_NUM_VALUES] =
{
WKS_STEREO_SWAP_MODE_APPLICATION_CONTROL,
WKS_STEREO_SWAP_MODE_PER_EYE,
WKS_STEREO_SWAP_MODE_PER_EYE_PAIR,
WKS_STEREO_SWAP_MODE_LEGACY_BEHAVIOR,
};
EValues_AO_MODE g_valuesAO_MODE[AO_MODE_NUM_VALUES] =
{
AO_MODE_OFF,
AO_MODE_LOW,
AO_MODE_MEDIUM,
AO_MODE_HIGH,
};
EValues_AO_MODE_ACTIVE g_valuesAO_MODE_ACTIVE[AO_MODE_ACTIVE_NUM_VALUES] =
{
AO_MODE_ACTIVE_DISABLED,
AO_MODE_ACTIVE_ENABLED,
};
EValues_AUTO_LODBIASADJUST g_valuesAUTO_LODBIASADJUST[AUTO_LODBIASADJUST_NUM_VALUES] =
{
AUTO_LODBIASADJUST_OFF,
AUTO_LODBIASADJUST_ON,
};
EValues_LODBIASADJUST g_valuesLODBIASADJUST[LODBIASADJUST_NUM_VALUES] =
{
LODBIASADJUST_MIN,
LODBIASADJUST_MAX,
};
EValues_MAXWELL_B_SAMPLE_INTERLEAVE g_valuesMAXWELL_B_SAMPLE_INTERLEAVE[MAXWELL_B_SAMPLE_INTERLEAVE_NUM_VALUES] =
{
MAXWELL_B_SAMPLE_INTERLEAVE_OFF,
MAXWELL_B_SAMPLE_INTERLEAVE_ON,
};
EValues_PRERENDERLIMIT g_valuesPRERENDERLIMIT[PRERENDERLIMIT_NUM_VALUES] =
{
PRERENDERLIMIT_MIN,
PRERENDERLIMIT_MAX,
PRERENDERLIMIT_APP_CONTROLLED,
};
EValues_PS_SHADERDISKCACHE g_valuesPS_SHADERDISKCACHE[PS_SHADERDISKCACHE_NUM_VALUES] =
{
PS_SHADERDISKCACHE_OFF,
PS_SHADERDISKCACHE_ON,
};
EValues_PS_TEXFILTER_ANISO_OPTS2 g_valuesPS_TEXFILTER_ANISO_OPTS2[PS_TEXFILTER_ANISO_OPTS2_NUM_VALUES] =
{
PS_TEXFILTER_ANISO_OPTS2_OFF,
PS_TEXFILTER_ANISO_OPTS2_ON,
};
EValues_PS_TEXFILTER_BILINEAR_IN_ANISO g_valuesPS_TEXFILTER_BILINEAR_IN_ANISO[PS_TEXFILTER_BILINEAR_IN_ANISO_NUM_VALUES] =
{
PS_TEXFILTER_BILINEAR_IN_ANISO_OFF,
PS_TEXFILTER_BILINEAR_IN_ANISO_ON,
};
EValues_PS_TEXFILTER_DISABLE_TRILIN_SLOPE g_valuesPS_TEXFILTER_DISABLE_TRILIN_SLOPE[PS_TEXFILTER_DISABLE_TRILIN_SLOPE_NUM_VALUES] =
{
PS_TEXFILTER_DISABLE_TRILIN_SLOPE_OFF,
PS_TEXFILTER_DISABLE_TRILIN_SLOPE_ON,
};
EValues_PS_TEXFILTER_NO_NEG_LODBIAS g_valuesPS_TEXFILTER_NO_NEG_LODBIAS[PS_TEXFILTER_NO_NEG_LODBIAS_NUM_VALUES] =
{
PS_TEXFILTER_NO_NEG_LODBIAS_OFF,
PS_TEXFILTER_NO_NEG_LODBIAS_ON,
};
EValues_QUALITY_ENHANCEMENTS g_valuesQUALITY_ENHANCEMENTS[QUALITY_ENHANCEMENTS_NUM_VALUES] =
{
QUALITY_ENHANCEMENTS_HIGHQUALITY,
QUALITY_ENHANCEMENTS_QUALITY,
QUALITY_ENHANCEMENTS_PERFORMANCE,
QUALITY_ENHANCEMENTS_HIGHPERFORMANCE,
};
EValues_REFRESH_RATE_OVERRIDE g_valuesREFRESH_RATE_OVERRIDE[REFRESH_RATE_OVERRIDE_NUM_VALUES] =
{
REFRESH_RATE_OVERRIDE_APPLICATION_CONTROLLED,
REFRESH_RATE_OVERRIDE_HIGHEST_AVAILABLE,
};
EValues_SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE g_valuesSET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE[SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_NUM_VALUES] =
{
SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_OFF,
SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_ON,
};
EValues_SET_VAB_DATA g_valuesSET_VAB_DATA[SET_VAB_DATA_NUM_VALUES] =
{
SET_VAB_DATA_ZERO,
SET_VAB_DATA_UINT_ONE,
SET_VAB_DATA_FLOAT_ONE,
SET_VAB_DATA_FLOAT_POS_INF,
SET_VAB_DATA_FLOAT_NAN,
SET_VAB_DATA_USE_API_DEFAULTS,
};
EValues_VSYNCMODE g_valuesVSYNCMODE[VSYNCMODE_NUM_VALUES] =
{
VSYNCMODE_PASSIVE,
VSYNCMODE_FORCEOFF,
VSYNCMODE_FORCEON,
VSYNCMODE_FLIPINTERVAL2,
VSYNCMODE_FLIPINTERVAL3,
VSYNCMODE_FLIPINTERVAL4,
};
EValues_VSYNCTEARCONTROL g_valuesVSYNCTEARCONTROL[VSYNCTEARCONTROL_NUM_VALUES] =
{
VSYNCTEARCONTROL_DISABLE,
VSYNCTEARCONTROL_ENABLE,
};
SettingDWORDNameString mapSettingDWORD[TOTAL_DWORD_SETTING_NUM] =
{
{OGL_AA_LINE_GAMMA_ID, OGL_AA_LINE_GAMMA_STRING, 4, (NvU32 *)g_valuesOGL_AA_LINE_GAMMA, OGL_AA_LINE_GAMMA_DISABLED},
{OGL_DEEP_COLOR_SCANOUT_ID, OGL_DEEP_COLOR_SCANOUT_STRING, 2, (NvU32 *)g_valuesOGL_DEEP_COLOR_SCANOUT, OGL_DEEP_COLOR_SCANOUT_ENABLE},
{OGL_DEFAULT_SWAP_INTERVAL_ID, OGL_DEFAULT_SWAP_INTERVAL_STRING, 9, (NvU32 *)g_valuesOGL_DEFAULT_SWAP_INTERVAL, OGL_DEFAULT_SWAP_INTERVAL_VSYNC_ONE},
{OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_ID, OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_STRING, 2, (NvU32 *)g_valuesOGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL, 0x00000000},
{OGL_DEFAULT_SWAP_INTERVAL_SIGN_ID, OGL_DEFAULT_SWAP_INTERVAL_SIGN_STRING, 2, (NvU32 *)g_valuesOGL_DEFAULT_SWAP_INTERVAL_SIGN, OGL_DEFAULT_SWAP_INTERVAL_SIGN_POSITIVE},
{OGL_EVENT_LOG_SEVERITY_THRESHOLD_ID, OGL_EVENT_LOG_SEVERITY_THRESHOLD_STRING, 5, (NvU32 *)g_valuesOGL_EVENT_LOG_SEVERITY_THRESHOLD, OGL_EVENT_LOG_SEVERITY_THRESHOLD_CRITICAL},
{OGL_EXTENSION_STRING_VERSION_ID, OGL_EXTENSION_STRING_VERSION_STRING, 0, NULL, 0x00000000},
{OGL_FORCE_BLIT_ID, OGL_FORCE_BLIT_STRING, 2, (NvU32 *)g_valuesOGL_FORCE_BLIT, OGL_FORCE_BLIT_OFF},
{OGL_FORCE_STEREO_ID, OGL_FORCE_STEREO_STRING, 2, (NvU32 *)g_valuesOGL_FORCE_STEREO, OGL_FORCE_STEREO_OFF},
{OGL_MAX_FRAMES_ALLOWED_ID, OGL_MAX_FRAMES_ALLOWED_STRING, 0, NULL, 0x00000002},
{OGL_MULTIMON_ID, OGL_MULTIMON_STRING, 8, (NvU32 *)g_valuesOGL_MULTIMON, OGL_MULTIMON_PERFORMANCE_LCD},
{OGL_OVERLAY_PIXEL_TYPE_ID, OGL_OVERLAY_PIXEL_TYPE_STRING, 4, (NvU32 *)g_valuesOGL_OVERLAY_PIXEL_TYPE, OGL_OVERLAY_PIXEL_TYPE_CI},
{OGL_OVERLAY_SUPPORT_ID, OGL_OVERLAY_SUPPORT_STRING, 3, (NvU32 *)g_valuesOGL_OVERLAY_SUPPORT, OGL_OVERLAY_SUPPORT_OFF},
{OGL_QUALITY_ENHANCEMENTS_ID, OGL_QUALITY_ENHANCEMENTS_STRING, 4, (NvU32 *)g_valuesOGL_QUALITY_ENHANCEMENTS, OGL_QUALITY_ENHANCEMENTS_QUAL},
{OGL_SINGLE_BACKDEPTH_BUFFER_ID, OGL_SINGLE_BACKDEPTH_BUFFER_STRING, 3, (NvU32 *)g_valuesOGL_SINGLE_BACKDEPTH_BUFFER, OGL_SINGLE_BACKDEPTH_BUFFER_DISABLE},
{OGL_THREAD_CONTROL_ID, OGL_THREAD_CONTROL_STRING, 2, (NvU32 *)g_valuesOGL_THREAD_CONTROL, 0x00000000},
{OGL_TRIPLE_BUFFER_ID, OGL_TRIPLE_BUFFER_STRING, 2, (NvU32 *)g_valuesOGL_TRIPLE_BUFFER, OGL_TRIPLE_BUFFER_DISABLED},
{OGL_VIDEO_EDITING_MODE_ID, OGL_VIDEO_EDITING_MODE_STRING, 2, (NvU32 *)g_valuesOGL_VIDEO_EDITING_MODE, OGL_VIDEO_EDITING_MODE_DISABLE},
{AA_BEHAVIOR_FLAGS_ID, AA_BEHAVIOR_FLAGS_STRING, 18, (NvU32 *)g_valuesAA_BEHAVIOR_FLAGS, AA_BEHAVIOR_FLAGS_DEFAULT},
{AA_MODE_ALPHATOCOVERAGE_ID, AA_MODE_ALPHATOCOVERAGE_STRING, 4, (NvU32 *)g_valuesAA_MODE_ALPHATOCOVERAGE, 0x00000000},
{AA_MODE_GAMMACORRECTION_ID, AA_MODE_GAMMACORRECTION_STRING, 8, (NvU32 *)g_valuesAA_MODE_GAMMACORRECTION, 0x00000000},
{AA_MODE_METHOD_ID, AA_MODE_METHOD_STRING, 50, (NvU32 *)g_valuesAA_MODE_METHOD, AA_MODE_METHOD_NONE},
{AA_MODE_REPLAY_ID, AA_MODE_REPLAY_STRING, 20, (NvU32 *)g_valuesAA_MODE_REPLAY, 0x00000000},
{AA_MODE_SELECTOR_ID, AA_MODE_SELECTOR_STRING, 5, (NvU32 *)g_valuesAA_MODE_SELECTOR, AA_MODE_SELECTOR_APP_CONTROL},
{AA_MODE_SELECTOR_SLIAA_ID, AA_MODE_SELECTOR_SLIAA_STRING, 2, (NvU32 *)g_valuesAA_MODE_SELECTOR_SLIAA, AA_MODE_SELECTOR_SLIAA_DISABLED},
{ANISO_MODE_LEVEL_ID, ANISO_MODE_LEVEL_STRING, 5, (NvU32 *)g_valuesANISO_MODE_LEVEL, ANISO_MODE_LEVEL_DEFAULT},
{ANISO_MODE_SELECTOR_ID, ANISO_MODE_SELECTOR_STRING, 6, (NvU32 *)g_valuesANISO_MODE_SELECTOR, ANISO_MODE_SELECTOR_DEFAULT},
{APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ID, APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_STRING, 6, (NvU32 *)g_valuesAPPLICATION_PROFILE_NOTIFICATION_TIMEOUT, APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DISABLED},
{APPLICATION_STEAM_ID_ID, APPLICATION_STEAM_ID_STRING, 0, NULL, 0x00000000},
{CPL_HIDDEN_PROFILE_ID, CPL_HIDDEN_PROFILE_STRING, 2, (NvU32 *)g_valuesCPL_HIDDEN_PROFILE, CPL_HIDDEN_PROFILE_DISABLED},
{EXPORT_PERF_COUNTERS_ID, EXPORT_PERF_COUNTERS_STRING, 2, (NvU32 *)g_valuesEXPORT_PERF_COUNTERS, EXPORT_PERF_COUNTERS_OFF},
{FXAA_ALLOW_ID, FXAA_ALLOW_STRING, 2, (NvU32 *)g_valuesFXAA_ALLOW, FXAA_ALLOW_ALLOWED},
{FXAA_ENABLE_ID, FXAA_ENABLE_STRING, 2, (NvU32 *)g_valuesFXAA_ENABLE, FXAA_ENABLE_OFF},
{FXAA_INDICATOR_ENABLE_ID, FXAA_INDICATOR_ENABLE_STRING, 2, (NvU32 *)g_valuesFXAA_INDICATOR_ENABLE, FXAA_INDICATOR_ENABLE_OFF},
{MCSFRSHOWSPLIT_ID, MCSFRSHOWSPLIT_STRING, 2, (NvU32 *)g_valuesMCSFRSHOWSPLIT, MCSFRSHOWSPLIT_DISABLED},
{NV_QUALITY_UPSCALING_ID, NV_QUALITY_UPSCALING_STRING, 2, (NvU32 *)g_valuesNV_QUALITY_UPSCALING, NV_QUALITY_UPSCALING_OFF},
{OPTIMUS_MAXAA_ID, OPTIMUS_MAXAA_STRING, 2, (NvU32 *)g_valuesOPTIMUS_MAXAA, 0x00000000},
{PHYSXINDICATOR_ID, PHYSXINDICATOR_STRING, 2, (NvU32 *)g_valuesPHYSXINDICATOR, PHYSXINDICATOR_DISABLED},
{PREFERRED_PSTATE_ID, PREFERRED_PSTATE_STRING, 7, (NvU32 *)g_valuesPREFERRED_PSTATE, PREFERRED_PSTATE_ADAPTIVE},
{PREVENT_UI_AF_OVERRIDE_ID, PREVENT_UI_AF_OVERRIDE_STRING, 2, (NvU32 *)g_valuesPREVENT_UI_AF_OVERRIDE, PREVENT_UI_AF_OVERRIDE_OFF},
{PS_FRAMERATE_LIMITER_ID, PS_FRAMERATE_LIMITER_STRING, 20, (NvU32 *)g_valuesPS_FRAMERATE_LIMITER, PS_FRAMERATE_LIMITER_DISABLED},
{PS_FRAMERATE_LIMITER_GPS_CTRL_ID, PS_FRAMERATE_LIMITER_GPS_CTRL_STRING, 11, (NvU32 *)g_valuesPS_FRAMERATE_LIMITER_GPS_CTRL, PS_FRAMERATE_LIMITER_GPS_CTRL_DISABLED},
{PS_FRAMERATE_MONITOR_CTRL_ID, PS_FRAMERATE_MONITOR_CTRL_STRING, 5, (NvU32 *)g_valuesPS_FRAMERATE_MONITOR_CTRL, PS_FRAMERATE_MONITOR_CTRL_DISABLED},
{SHIM_MAXRES_ID, SHIM_MAXRES_STRING, 0, NULL, 0x00000000},
{SHIM_MCCOMPAT_ID, SHIM_MCCOMPAT_STRING, 8, (NvU32 *)g_valuesSHIM_MCCOMPAT, SHIM_MCCOMPAT_AUTO_SELECT},
{SHIM_RENDERING_MODE_ID, SHIM_RENDERING_MODE_STRING, 8, (NvU32 *)g_valuesSHIM_RENDERING_MODE, SHIM_RENDERING_MODE_AUTO_SELECT},
{SHIM_RENDERING_OPTIONS_ID, SHIM_RENDERING_OPTIONS_STRING, 24, (NvU32 *)g_valuesSHIM_RENDERING_OPTIONS, SHIM_RENDERING_OPTIONS_DEFAULT_RENDERING_MODE},
{SLI_GPU_COUNT_ID, SLI_GPU_COUNT_STRING, 5, (NvU32 *)g_valuesSLI_GPU_COUNT, SLI_GPU_COUNT_AUTOSELECT},
{SLI_PREDEFINED_GPU_COUNT_ID, SLI_PREDEFINED_GPU_COUNT_STRING, 5, (NvU32 *)g_valuesSLI_PREDEFINED_GPU_COUNT, SLI_PREDEFINED_GPU_COUNT_AUTOSELECT},
{SLI_PREDEFINED_GPU_COUNT_DX10_ID, SLI_PREDEFINED_GPU_COUNT_DX10_STRING, 5, (NvU32 *)g_valuesSLI_PREDEFINED_GPU_COUNT_DX10, SLI_PREDEFINED_GPU_COUNT_DX10_AUTOSELECT},
{SLI_PREDEFINED_MODE_ID, SLI_PREDEFINED_MODE_STRING, 6, (NvU32 *)g_valuesSLI_PREDEFINED_MODE, SLI_PREDEFINED_MODE_AUTOSELECT},
{SLI_PREDEFINED_MODE_DX10_ID, SLI_PREDEFINED_MODE_DX10_STRING, 6, (NvU32 *)g_valuesSLI_PREDEFINED_MODE_DX10, SLI_PREDEFINED_MODE_DX10_AUTOSELECT},
{SLI_RENDERING_MODE_ID, SLI_RENDERING_MODE_STRING, 6, (NvU32 *)g_valuesSLI_RENDERING_MODE, SLI_RENDERING_MODE_AUTOSELECT},
{VRPRERENDERLIMIT_ID, VRPRERENDERLIMIT_STRING, 4, (NvU32 *)g_valuesVRPRERENDERLIMIT, VRPRERENDERLIMIT_DEFAULT},
{VRRFEATUREINDICATOR_ID, VRRFEATUREINDICATOR_STRING, 2, (NvU32 *)g_valuesVRRFEATUREINDICATOR, VRRFEATUREINDICATOR_ENABLED},
{VRROVERLAYINDICATOR_ID, VRROVERLAYINDICATOR_STRING, 2, (NvU32 *)g_valuesVRROVERLAYINDICATOR, VRROVERLAYINDICATOR_ENABLED},
{VRRREQUESTSTATE_ID, VRRREQUESTSTATE_STRING, 3, (NvU32 *)g_valuesVRRREQUESTSTATE, VRRREQUESTSTATE_FULLSCREEN_ONLY},
{VRR_APP_OVERRIDE_ID, VRR_APP_OVERRIDE_STRING, 5, (NvU32 *)g_valuesVRR_APP_OVERRIDE, VRR_APP_OVERRIDE_ALLOW},
{VRR_APP_OVERRIDE_REQUEST_STATE_ID, VRR_APP_OVERRIDE_REQUEST_STATE_STRING, 5, (NvU32 *)g_valuesVRR_APP_OVERRIDE_REQUEST_STATE, VRR_APP_OVERRIDE_REQUEST_STATE_ALLOW},
{VRR_MODE_ID, VRR_MODE_STRING, 3, (NvU32 *)g_valuesVRR_MODE, VRR_MODE_FULLSCREEN_ONLY},
{VSYNCSMOOTHAFR_ID, VSYNCSMOOTHAFR_STRING, 2, (NvU32 *)g_valuesVSYNCSMOOTHAFR, VSYNCSMOOTHAFR_OFF},
{VSYNCVRRCONTROL_ID, VSYNCVRRCONTROL_STRING, 3, (NvU32 *)g_valuesVSYNCVRRCONTROL, VSYNCVRRCONTROL_ENABLE},
{VSYNC_BEHAVIOR_FLAGS_ID, VSYNC_BEHAVIOR_FLAGS_STRING, 3, (NvU32 *)g_valuesVSYNC_BEHAVIOR_FLAGS, VSYNC_BEHAVIOR_FLAGS_DEFAULT},
{WKS_API_STEREO_EYES_EXCHANGE_ID, WKS_API_STEREO_EYES_EXCHANGE_STRING, 2, (NvU32 *)g_valuesWKS_API_STEREO_EYES_EXCHANGE, WKS_API_STEREO_EYES_EXCHANGE_OFF},
{WKS_API_STEREO_MODE_ID, WKS_API_STEREO_MODE_STRING, 24, (NvU32 *)g_valuesWKS_API_STEREO_MODE, WKS_API_STEREO_MODE_SHUTTER_GLASSES},
{WKS_MEMORY_ALLOCATION_POLICY_ID, WKS_MEMORY_ALLOCATION_POLICY_STRING, 3, (NvU32 *)g_valuesWKS_MEMORY_ALLOCATION_POLICY, WKS_MEMORY_ALLOCATION_POLICY_AS_NEEDED},
{WKS_STEREO_DONGLE_SUPPORT_ID, WKS_STEREO_DONGLE_SUPPORT_STRING, 3, (NvU32 *)g_valuesWKS_STEREO_DONGLE_SUPPORT, WKS_STEREO_DONGLE_SUPPORT_OFF},
{WKS_STEREO_SUPPORT_ID, WKS_STEREO_SUPPORT_STRING, 2, (NvU32 *)g_valuesWKS_STEREO_SUPPORT, WKS_STEREO_SUPPORT_OFF},
{WKS_STEREO_SWAP_MODE_ID, WKS_STEREO_SWAP_MODE_STRING, 4, (NvU32 *)g_valuesWKS_STEREO_SWAP_MODE, WKS_STEREO_SWAP_MODE_APPLICATION_CONTROL},
{AO_MODE_ID, AO_MODE_STRING, 4, (NvU32 *)g_valuesAO_MODE, AO_MODE_OFF},
{AO_MODE_ACTIVE_ID, AO_MODE_ACTIVE_STRING, 2, (NvU32 *)g_valuesAO_MODE_ACTIVE, AO_MODE_ACTIVE_DISABLED},
{AUTO_LODBIASADJUST_ID, AUTO_LODBIASADJUST_STRING, 2, (NvU32 *)g_valuesAUTO_LODBIASADJUST, AUTO_LODBIASADJUST_ON},
{LODBIASADJUST_ID, LODBIASADJUST_STRING, 2, (NvU32 *)g_valuesLODBIASADJUST, 0x00000000},
{MAXWELL_B_SAMPLE_INTERLEAVE_ID, MAXWELL_B_SAMPLE_INTERLEAVE_STRING, 2, (NvU32 *)g_valuesMAXWELL_B_SAMPLE_INTERLEAVE, MAXWELL_B_SAMPLE_INTERLEAVE_OFF},
{PRERENDERLIMIT_ID, PRERENDERLIMIT_STRING, 3, (NvU32 *)g_valuesPRERENDERLIMIT, PRERENDERLIMIT_APP_CONTROLLED},
{PS_SHADERDISKCACHE_ID, PS_SHADERDISKCACHE_STRING, 2, (NvU32 *)g_valuesPS_SHADERDISKCACHE, 0x00000000},
{PS_TEXFILTER_ANISO_OPTS2_ID, PS_TEXFILTER_ANISO_OPTS2_STRING, 2, (NvU32 *)g_valuesPS_TEXFILTER_ANISO_OPTS2, PS_TEXFILTER_ANISO_OPTS2_OFF},
{PS_TEXFILTER_BILINEAR_IN_ANISO_ID, PS_TEXFILTER_BILINEAR_IN_ANISO_STRING, 2, (NvU32 *)g_valuesPS_TEXFILTER_BILINEAR_IN_ANISO, PS_TEXFILTER_BILINEAR_IN_ANISO_OFF},
{PS_TEXFILTER_DISABLE_TRILIN_SLOPE_ID, PS_TEXFILTER_DISABLE_TRILIN_SLOPE_STRING, 2, (NvU32 *)g_valuesPS_TEXFILTER_DISABLE_TRILIN_SLOPE, PS_TEXFILTER_DISABLE_TRILIN_SLOPE_OFF},
{PS_TEXFILTER_NO_NEG_LODBIAS_ID, PS_TEXFILTER_NO_NEG_LODBIAS_STRING, 2, (NvU32 *)g_valuesPS_TEXFILTER_NO_NEG_LODBIAS, PS_TEXFILTER_NO_NEG_LODBIAS_OFF},
{QUALITY_ENHANCEMENTS_ID, QUALITY_ENHANCEMENTS_STRING, 4, (NvU32 *)g_valuesQUALITY_ENHANCEMENTS, QUALITY_ENHANCEMENTS_QUALITY},
{REFRESH_RATE_OVERRIDE_ID, REFRESH_RATE_OVERRIDE_STRING, 2, (NvU32 *)g_valuesREFRESH_RATE_OVERRIDE, REFRESH_RATE_OVERRIDE_APPLICATION_CONTROLLED},
{SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_ID, SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_STRING, 2, (NvU32 *)g_valuesSET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE, SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_OFF},
{SET_VAB_DATA_ID, SET_VAB_DATA_STRING, 6, (NvU32 *)g_valuesSET_VAB_DATA, SET_VAB_DATA_USE_API_DEFAULTS},
{VSYNCMODE_ID, VSYNCMODE_STRING, 6, (NvU32 *)g_valuesVSYNCMODE, VSYNCMODE_PASSIVE},
{VSYNCTEARCONTROL_ID, VSYNCTEARCONTROL_STRING, 2, (NvU32 *)g_valuesVSYNCTEARCONTROL, VSYNCTEARCONTROL_DISABLE},
};
SettingWSTRINGNameString mapSettingWSTRING[TOTAL_WSTRING_SETTING_NUM] =
{
{OGL_IMPLICIT_GPU_AFFINITY_ID, OGL_IMPLICIT_GPU_AFFINITY_STRING, 1, (const wchar_t **)g_valuesOGL_IMPLICIT_GPU_AFFINITY, L"autoselect"},
{CUDA_EXCLUDED_GPUS_ID, CUDA_EXCLUDED_GPUS_STRING, 1, (const wchar_t **)g_valuesCUDA_EXCLUDED_GPUS, L"none"},
{D3DOGL_GPU_MAX_POWER_ID, D3DOGL_GPU_MAX_POWER_STRING, 1, (const wchar_t **)g_valuesD3DOGL_GPU_MAX_POWER, L"0"},
{ICAFE_LOGO_CONFIG_ID, ICAFE_LOGO_CONFIG_STRING, 0, NULL, L""},
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -10,7 +10,7 @@
*/
#pragma once
#include <Windows.h>
#include <windows.h>
typedef unsigned char NvU8;
typedef unsigned long NvU32;

View file

@ -0,0 +1,69 @@
#include <initguid.h>
DEFINE_GUID (GUID_DEVINTERFACE_IVSHMEM,
0xdf576976,0x569d,0x4672,0x95,0xa0,0xf5,0x7e,0x4e,0xa0,0xb2,0x10);
// {df576976-569d-4672-95a0-f57e4ea0b210}
typedef UINT16 IVSHMEM_PEERID;
typedef UINT64 IVSHMEM_SIZE;
#define IVSHMEM_CACHE_NONCACHED 0
#define IVSHMEM_CACHE_CACHED 1
#define IVSHMEM_CACHE_WRITECOMBINED 2
/*
This structure is for use with the IOCTL_IVSHMEM_REQUEST_MMAP IOCTL
*/
typedef struct IVSHMEM_MMAP_CONFIG
{
UINT8 cacheMode; // the caching mode of the mapping, see IVSHMEM_CACHE_* for options
}
IVSHMEM_MMAP_CONFIG, *PIVSHMEM_MMAP_CONFIG;
/*
This structure is for use with the IOCTL_IVSHMEM_REQUEST_MMAP IOCTL
*/
typedef struct IVSHMEM_MMAP
{
IVSHMEM_PEERID peerID; // our peer id
IVSHMEM_SIZE size; // the size of the memory region
PVOID ptr; // pointer to the memory region
UINT16 vectors; // the number of vectors available
}
IVSHMEM_MMAP, *PIVSHMEM_MMAP;
/*
This structure is for use with the IOCTL_IVSHMEM_RING_DOORBELL IOCTL
*/
typedef struct IVSHMEM_RING
{
IVSHMEM_PEERID peerID; // the id of the peer to ring
UINT16 vector; // the doorbell to ring
}
IVSHMEM_RING, *PIVSHMEM_RING;
/*
This structure is for use with the IOCTL_IVSHMEM_REGISTER_EVENT IOCTL
Please Note:
- The IVSHMEM driver has a hard limit of 32 events.
- Events that are singleShot are released after they have been set.
- At this time repeating events are only released when the driver device
handle is closed, closing the event handle doesn't release it from the
drivers list. While this won't cause a problem in the driver, it will
cause you to run out of event slots.
*/
typedef struct IVSHMEM_EVENT
{
UINT16 vector; // the vector that triggers the event
HANDLE event; // the event to trigger
BOOLEAN singleShot; // set to TRUE if you want the driver to only trigger this event once
}
IVSHMEM_EVENT, *PIVSHMEM_EVENT;
#define IOCTL_IVSHMEM_REQUEST_PEERID CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_IVSHMEM_REQUEST_SIZE CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_IVSHMEM_REQUEST_MMAP CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_IVSHMEM_RELEASE_MMAP CTL_CODE(FILE_DEVICE_UNKNOWN, 0x803, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_IVSHMEM_RING_DOORBELL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x804, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_IVSHMEM_REGISTER_EVENT CTL_CODE(FILE_DEVICE_UNKNOWN, 0x805, METHOD_BUFFERED, FILE_ANY_ACCESS)

Binary file not shown.

31
agent/src/capture.cpp Normal file
View file

@ -0,0 +1,31 @@
#include "capture.hpp"
namespace hazelnut {
// capture_nvfbc.cpp
DisplayCaptureBase* CreateNVFBCDisplayCapture();
DisplayCaptureInterface GuessBestCaptureInterface() {
// The only one we support.
return DisplayCaptureInterface::NVFBC;
}
std::unique_ptr<DisplayCaptureBase> CreateDisplayCapture(DisplayCaptureInterface type) {
DisplayCaptureBase* pCapture = nullptr;
switch(type) {
case DisplayCaptureInterface::NVFBC: pCapture = CreateNVFBCDisplayCapture(); break;
default: return nullptr;
}
// Initalize capture. Upon failure to capture we destroy the capture interface
// and then return a null pointer.
if(!pCapture->Initialize()) {
delete pCapture;
return nullptr;
}
return std::unique_ptr<DisplayCaptureBase>(pCapture);
}
} // namespace hazelnut

61
agent/src/capture.hpp Normal file
View file

@ -0,0 +1,61 @@
#include <memory>
#include "Utils.hpp"
namespace hazelnut {
enum class DisplayCaptureResult {
Ok,
OkUnchanged, // OK but nothing changed
OkButResized, // OK, but grab the buffer information again. It's different due to a resize
Fail, // epic fail
};
// Framebuffer information
struct FramebufferInformation {
u32 width;
u32 height;
};
// Difference tile information
struct DiffInformation {
u8* pDiffMap;
u32 diffmapWidth;
u32 diffMapHeight;
};
/// Interface used for framebuffer capture independence.
struct DisplayCaptureBase {
virtual ~DisplayCaptureBase() = default;
virtual bool Initialize() = 0;
/// Captures frame to provided output buffer directly.
virtual DisplayCaptureResult CaptureFrame(u32* pOut) = 0;
/// Get framebuffer information.
virtual FramebufferInformation GetFramebufferInformation() = 0;
/// Gets the tile difference block information.
virtual DiffInformation GetDiffInformation() = 0;
};
enum class DisplayCaptureInterface : u32 {
Invalid,
NVFBC, // NVFBC capture
// FIXME: DXGI support
};
/// Returns a guess for the best capture interface.
/// On a NVIDIA GPU on Windows < 8.1, we prefer NVFBC.
/// Otherwise, we should prefer DXGI.
///
/// If no API is supported on the running system, Invalid is returned.
DisplayCaptureInterface GuessBestCaptureInterface();
/// Creates a instance of the display capture interface for a particular interface.
/// Returns a null pointer upon failure to create, a valid pointer otherwise.
std::unique_ptr<DisplayCaptureBase> CreateDisplayCapture(DisplayCaptureInterface type);
} // namespace hazelnut

286
agent/src/capture_nvfbc.cpp Normal file
View file

@ -0,0 +1,286 @@
#include "capture.hpp"
// clang-format off
#include "Utils.hpp"
#include "nvfbc_library.hpp"
#include <NvFBC/nvFBCToSys.h>
// clang-format on
namespace hazelnut {
void DiffMapWidthHeight(NVFBC_TOSYS_DIFFMAP_BLOCKSIZE blockSize, u32& width, u32& height) {
switch(blockSize) {
case NVFBC_TOSYS_DIFFMAP_BLOCKSIZE_16X16:
width = 16;
height = 16;
break;
case NVFBC_TOSYS_DIFFMAP_BLOCKSIZE_32X32:
width = 32;
height = 32;
break;
case NVFBC_TOSYS_DIFFMAP_BLOCKSIZE_64X64:
width = 64;
height = 64;
break;
default:
case NVFBC_TOSYS_DIFFMAP_BLOCKSIZE_128X128:
width = 128;
height = 128;
break;
}
}
// From Looking Glass, cleaned up to not be macro slop
u32 DiffMapDimension(u32 srcDim, NVFBC_TOSYS_DIFFMAP_BLOCKSIZE blockSize) {
u32 blockShift = 0;
// Calculate shift
switch(blockSize) {
case NVFBC_TOSYS_DIFFMAP_BLOCKSIZE_16X16: blockShift = 4; break;
case NVFBC_TOSYS_DIFFMAP_BLOCKSIZE_32X32: blockShift = 5; break;
case NVFBC_TOSYS_DIFFMAP_BLOCKSIZE_64X64: blockShift = 6; break;
default:
case NVFBC_TOSYS_DIFFMAP_BLOCKSIZE_128X128: blockShift = 7; break;
}
return (((srcDim) + (1 << (blockShift)) - 1) >> (blockShift));
}
struct NVFBCDisplayCapture final : public DisplayCaptureBase {
NVFBCRESULT nvfbcStatus;
NvFBCLibrary nvfbcLib;
NVFBC_TOSYS_GRAB_FRAME_PARAMS fbcSysGrabParams;
NVFBC_TOSYS_DIFFMAP_BLOCKSIZE blockSize;
NvFBCFrameGrabInfo grabInfo;
NvFBCToSys* nvfbc;
u32 width;
u32 height;
u32* pRawFramebuffer;
u8* pDiffMap;
u32 diffmapWidth;
u32 diffmapHeight;
// cached
u32 tileWidth;
u32 tileHeight;
public:
virtual ~NVFBCDisplayCapture() { Shutdown(); }
void Shutdown() {
NvfbcDestroyInstance();
nvfbcLib.Close();
}
bool Initialize() override {
if(!nvfbcLib.Load()) {
return false;
}
if(!NvfbcInitSession())
return false;
return true;
}
void NvfbcDestroyInstance() {
if(nvfbc) {
nvfbc->NvFBCToSysRelease();
nvfbc = nullptr;
// reset state while we're here I guess
pRawFramebuffer = nullptr;
pDiffMap = nullptr;
width = 0;
height = 0;
diffmapWidth = 0;
diffmapHeight = 0;
}
}
bool NvfbcCreateInstance() {
// Destroy an existing NvFBC instance to avoid resource leaks.
if(nvfbc) {
NvfbcDestroyInstance();
}
DWORD maxDisplayWidth = -1;
DWORD maxDisplayHeight = -1;
nvfbc = nvfbcLib.CreateToSys(&maxDisplayWidth, &maxDisplayHeight);
if(!nvfbc) {
return false;
}
return true;
}
bool NvfbcInitSession() {
if(!NvfbcCreateInstance())
return false;
blockSize = NVFBC_TOSYS_DIFFMAP_BLOCKSIZE_32X32;
// set up a session
NVFBC_TOSYS_SETUP_PARAMS fbcSysSetupParams {};
fbcSysSetupParams.dwVersion = NVFBC_TOSYS_SETUP_PARAMS_VER;
fbcSysSetupParams.eMode = NVFBC_TOSYS_ARGB;
fbcSysSetupParams.bWithHWCursor = true;
fbcSysSetupParams.ppBuffer = reinterpret_cast<void**>(&pRawFramebuffer);
// enable the difference map with configured blocksize
// (currently hardcoded to 32x32).
fbcSysSetupParams.bDiffMap = TRUE;
fbcSysSetupParams.ppDiffMap = reinterpret_cast<void**>(&pDiffMap);
fbcSysSetupParams.eDiffMapBlockSize = blockSize;
auto status = nvfbc->NvFBCToSysSetUp(&fbcSysSetupParams);
if(status != NVFBC_SUCCESS)
return false;
fbcSysGrabParams = {};
// set up grab params
fbcSysGrabParams.dwVersion = NVFBC_TOSYS_GRAB_FRAME_PARAMS_VER;
fbcSysGrabParams.dwFlags = NVFBC_TOSYS_WAIT_WITH_TIMEOUT;
fbcSysGrabParams.dwTargetWidth = 0;
fbcSysGrabParams.dwTargetHeight = 0;
fbcSysGrabParams.dwStartX = 0;
fbcSysGrabParams.dwStartY = 0;
fbcSysGrabParams.eGMode = NVFBC_TOSYS_SOURCEMODE_FULL;
fbcSysGrabParams.pNvFBCFrameGrabInfo = &grabInfo;
fbcSysGrabParams.dwWaitTime = 1000;
return true;
}
DisplayCaptureResult PaintWithTileOptimization(u32* pBufferData) {
bool copiedTiles = false;
for(u32 dy = 0; dy < diffmapHeight; ++dy) {
for(u32 dx = 0; dx < diffmapWidth; ++dx) {
auto& bl = pDiffMap[dy * diffmapWidth + dx];
if(bl != 0) {
copiedTiles = true;
#if 0
x * (framebuffer.width / diff.diffmapWidth), // x
y * (framebuffer.height / diff.diffMapHeight), // y
framebuffer.width / diff.diffmapWidth, // width
framebuffer.height / diff.diffMapHeight // height
#endif
u32 xOffset = dx * tileWidth;
u32 yOffset = dy * tileHeight;
for(u32 y = 0; y < tileHeight; ++y) {
memcpy(&pBufferData[((y + yOffset) * width + xOffset)],
&pRawFramebuffer[((y + yOffset) * grabInfo.dwBufferWidth + xOffset)], tileWidth * 4);
}
// printf("copied %ux%u @ %ux%u tile\n", tileWidth, tileHeight, xOffset, yOffset);
}
}
}
if(!copiedTiles)
return DisplayCaptureResult::OkUnchanged;
return DisplayCaptureResult::Ok;
}
void PaintFull(u32* pBufferData) {
for(u32 y = 0; y < height; ++y) {
// Convert to BGRA
// FIXME: Make this SIMD. I can't into this very well
#if 0
usize srcStart = (y * grabInfo.dwBufferWidth) * 4;
usize dstStart = (y * width) * 4;
for(u32 x = 0; x < grabInfo.dwWidth * 4; x += 4) {
pBufferData[(dstStart + x) + 0] = pSrcData[(srcStart + x) + 2]; // B
pBufferData[(dstStart + x) + 1] = pSrcData[(srcStart + x) + 1]; // G
pBufferData[(dstStart + x) + 2] = pSrcData[(srcStart + x) + 0]; // R
pBufferData[(dstStart + x) + 3] = 0xff; // A
}
#endif
memcpy(&pBufferData[(y * width)], &pRawFramebuffer[(y * grabInfo.dwBufferWidth)], width * 4);
}
}
DisplayCaptureResult CaptureFrame(u32* pOut) override {
auto nvStatus = nvfbc->NvFBCToSysGrabFrame(&this->fbcSysGrabParams);
switch(nvStatus) {
case NVFBC_SUCCESS: break;
// Need to recreate the session. If it fails then we fail too.
case NVFBC_ERROR_INVALIDATED_SESSION: {
if(!NvfbcInitSession())
return DisplayCaptureResult::Fail;
// Recurse. This looks naughty, but will allow us to directly retry
// the capture. (Plus if this causes issues whatever has happened is probably beyond saving)
return CaptureFrame(pOut);
} break;
default: return DisplayCaptureResult::Fail;
}
auto result = DisplayCaptureResult::Ok;
bool useTilePainting = true;
if(width != grabInfo.dwWidth || height != grabInfo.dwHeight) {
width = grabInfo.dwWidth;
height = grabInfo.dwHeight;
// update diffmap stuff
diffmapWidth = DiffMapDimension(width, blockSize);
diffmapHeight = DiffMapDimension(height, blockSize);
tileWidth = width / diffmapWidth;
tileHeight = height / diffmapHeight;
result = DisplayCaptureResult::OkButResized;
// Disable tile-painting optimization for the first frame
useTilePainting = false;
}
if(useTilePainting) [[likely]] {
result = PaintWithTileOptimization(&pOut[0]);
} else {
PaintFull(&pOut[0]);
}
return result;
}
FramebufferInformation GetFramebufferInformation() override { return FramebufferInformation { width, height }; }
DiffInformation GetDiffInformation() override {
// diffmapWidth = (u32)ceil((f32)width / 32);
// diffmapHeight = (u32)ceil((f32)height / 32);
return DiffInformation { pDiffMap, diffmapWidth, diffmapHeight };
}
};
DisplayCaptureBase* CreateNVFBCDisplayCapture() {
return new NVFBCDisplayCapture();
}
} // namespace hazelnut

77
agent/src/main.cpp Executable file
View file

@ -0,0 +1,77 @@
// clang-format off
#include "ivshmem.hpp"
#include <windows.h>
#include <stdio.h>
#include "capture.hpp"
#include "Utils.hpp"
// clang-format on
#include "ivshmem_protocol.hpp"
int main(int argc, char** argv) {
hazelnut::IvshmemDevice dev;
// Create a capture interface
auto pCaptureInterface = hazelnut::CreateDisplayCapture(hazelnut::GuessBestCaptureInterface());
if(!pCaptureInterface) {
printf("Failed to create a capture interface\n");
return 1;
}
if(!dev.Open()) {
printf("Failed to open ivshmem device\n");
return 1;
}
auto size = dev.GetSize();
auto ptr = (u8*)dev.GetPointer();
printf("opened a %zu MB large ivshmem\n", (size / (1024 * 1024)));
// wipe the first 1mb
memset(&ptr[0], 0, 1 * (1024 * 1024));
// initalize laid-out IVSHMEM structs
auto* pHeader = new(&ptr[0]) hazelnut::IvshHeader {};
auto* pFrameHeader = new(&ptr[0x1000]) hazelnut::FrameHeader {};
// Reset session ID
pHeader->serverSessionId.store(rand());
printf("Agent loop starting\n");
hazelnut::FramebufferInformation framebuffer {};
hazelnut::DiffInformation diff {};
while(true) {
{
auto guard = pHeader->lock.lock();
auto result = pCaptureInterface->CaptureFrame(pFrameHeader->bits());
switch(result) {
case hazelnut::DisplayCaptureResult::Ok:
case hazelnut::DisplayCaptureResult::OkButResized:
if(result == hazelnut::DisplayCaptureResult::OkButResized) {
framebuffer = pCaptureInterface->GetFramebufferInformation();
diff = pCaptureInterface->GetDiffInformation();
}
pFrameHeader->serial.fetch_add(1);
pFrameHeader->width.store(framebuffer.width);
pFrameHeader->height.store(framebuffer.height);
break;
case hazelnut::DisplayCaptureResult::OkUnchanged: continue; break;
default:
printf("Failed to capture");
return 1;
break;
}
}
}
return 0;
}

170
agent/src/nvfbc_library.cpp Normal file
View file

@ -0,0 +1,170 @@
#include "nvfbc_library.hpp"
#include "NvFBC/nvFBCToSys.h"
namespace {
// Get the default NvFBC library path
typedef BOOL(WINAPI* pfnIsWow64Process)(HANDLE, PBOOL);
// needs to be defines unfortunately. Otherwise I'd totally make these constexpr
#define NVFBC64_LIBRARY_NAME "NvFBC64.dll"
#define NVFBC_LIBRARY_NAME "NvFBC.dll"
bool IsWow64() {
#ifdef _WIN64
// If we're built for a x64 target, we kinda can't be WOW64.
// Statically enforce this at compile time
return false;
#else
BOOL bIsWow64 = FALSE;
static pfnIsWow64Process fnIsWow64Process = (pfnIsWow64Process)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "IsWow64Process");
if(fnIsWow64Process) {
if(!fnIsWow64Process(GetCurrentProcess(), &bIsWow64)) {
return false;
}
}
return true;
#endif
}
// pBuf must be valid from [0..MAX_PATH]
bool GetNvFBCLibraryPath(char* pBuf) {
// clang-format off
constexpr const char kPathFormatString[] =
#ifdef _WIN64
"%s\\System32\\" NVFBC64_LIBRARY_NAME;
#else
(IsWow64()
? "%s\\SysWOW64\\" NVFBC_LIBRARY_NAME
: "%s\\System32\\" NVFBC_LIBRARY_NAME);
#endif
// clang-format on
if(pBuf == nullptr) [[unlikely]]
return false;
// Get the Windows system directory (there's probably a "nicer" way using
// the SH* APIs but, this was previously nastier and using %SystemRoot%. I think this is OK)
char szWinDir[MAX_PATH] {};
if(GetWindowsDirectoryA(&szWinDir[0], MAX_PATH) == 0) {
return false;
}
sprintf(&pBuf[0], kPathFormatString, szWinDir);
return true;
}
} // namespace
NvFBCLibrary::~NvFBCLibrary() {
if(m_handle != nullptr)
Close();
}
bool NvFBCLibrary::Load() {
if(m_handle != nullptr)
return true;
char szNvfbcLibPath[MAX_PATH] {};
if(!GetNvFBCLibraryPath(&szNvfbcLibPath[0]))
return false;
m_handle = LoadLibraryA(szNvfbcLibPath);
if(m_handle == nullptr) {
return false;
}
// Load NvFBC exports
pNvFBC_CreateEx = reinterpret_cast<NvFBC_CreateFunctionExType>(GetProcAddress(m_handle, "NvFBC_CreateEx"));
pNvFBC_SetGlobalFlags = reinterpret_cast<NvFBC_SetGlobalFlagsType>(GetProcAddress(m_handle, "NvFBC_SetGlobalFlags"));
pNvFBC_GetStatusEx = reinterpret_cast<NvFBC_GetStatusExFunctionType>(GetProcAddress(m_handle, "NvFBC_GetStatusEx"));
pNvFBC_Enable = reinterpret_cast<NvFBC_EnableFunctionType>(GetProcAddress(m_handle, "NvFBC_Enable"));
if((pNvFBC_CreateEx == nullptr) || (pNvFBC_SetGlobalFlags == nullptr) || (pNvFBC_GetStatusEx == nullptr) || (pNvFBC_Enable == nullptr)) {
Close();
return false;
}
return true;
}
void NvFBCLibrary::Close() {
if(m_handle != nullptr)
FreeLibrary(m_handle);
m_handle = NULL;
pNvFBC_CreateEx = NULL;
pNvFBC_GetStatusEx = NULL;
pNvFBC_Enable = NULL;
}
NVFBCRESULT NvFBCLibrary::GetStatus(NvFBCStatusEx* status) {
return pNvFBC_GetStatusEx((void*)status);
}
void NvFBCLibrary::SetGlobalFlags(DWORD flags, int adapter) {
SetTargetAdapter(adapter);
pNvFBC_SetGlobalFlags(flags);
}
NVFBCRESULT NvFBCLibrary::CreateEx(NvFBCCreateParams* pParams) {
return pNvFBC_CreateEx((void*)pParams);
}
void* NvFBCLibrary::CreateRaw(DWORD type, DWORD* maxWidth, DWORD* maxHeight, int adapter, void* devicePtr) {
if(NULL == m_handle)
return NULL;
NVFBCRESULT res = NVFBC_SUCCESS;
NvFBCStatusEx status {};
status.dwVersion = NVFBC_STATUS_VER;
status.dwAdapterIdx = adapter;
res = GetStatus(&status);
if(res != NVFBC_SUCCESS) {
return nullptr;
}
if(!status.bIsCapturePossible) {
return nullptr;
}
if(!status.bCanCreateNow) {
return nullptr;
}
NvFBCCreateParams createParams {};
createParams.dwVersion = NVFBC_CREATE_PARAMS_VER;
createParams.dwInterfaceType = type;
createParams.pDevice = devicePtr;
createParams.dwAdapterIdx = adapter;
res = pNvFBC_CreateEx(&createParams);
if(maxWidth)
*maxWidth = createParams.dwMaxDisplayWidth;
if(maxHeight)
*maxHeight = createParams.dwMaxDisplayHeight;
return createParams.pNvFBC;
}
INvFBCToSys_v4* NvFBCLibrary::CreateToSys(DWORD* maxWidth, DWORD* maxHeight, int adapter) {
return static_cast<NvFBCToSys*>(CreateRaw(NVFBC_TO_SYS, maxWidth, maxHeight, adapter, nullptr));
}
NVFBCRESULT NvFBCLibrary::Enable(NVFBC_STATE nvFBCState) {
return pNvFBC_Enable(nvFBCState);
}
void NvFBCLibrary::SetTargetAdapter(int adapter) {
char targetAdapter[10] {};
_snprintf_s(targetAdapter, 10, 9, "%d", adapter);
SetEnvironmentVariableA("NVFBC_TARGET_ADAPTER", targetAdapter);
}

55
agent/src/nvfbc_library.hpp Executable file
View file

@ -0,0 +1,55 @@
#pragma once
// already includes windows.h
#include <stdio.h>
#include "NvFBC/nvFBC.h"
class INvFBCToSys_v4;
/// Wraps loading and using NvFBC
class NvFBCLibrary {
public:
NvFBCLibrary() = default;
NvFBCLibrary(const NvFBCLibrary&) = delete;
NvFBCLibrary& operator=(const NvFBCLibrary&) = delete;
~NvFBCLibrary();
/// Tries to load the NvFBC dll
bool Load();
/// Close the NvFBC DLL.
void Close();
/// Get the status for the provided adapter,
/// if no adapter is provided the default adapter is used.
NVFBCRESULT GetStatus(NvFBCStatusEx* status);
/// Sets the global flags for the provided adapter.
/// If no adapter is provided, the default adapter is used
void SetGlobalFlags(DWORD flags, int adapter = 0);
/// Creates an instance of the provided NvFBC type if possible
NVFBCRESULT CreateEx(NvFBCCreateParams* pParams);
INvFBCToSys_v4* CreateToSys(DWORD* maxWidth, DWORD* maxHeight, int adapter = 0);
/// enable/disable NVFBC
NVFBCRESULT Enable(NVFBC_STATE nvFBCState);
protected:
void SetTargetAdapter(int adapter = 0);
/// Creates an instance of the provided NvFBC type if possible.
void* CreateRaw(DWORD type, DWORD* maxWidth, DWORD* maxHeight, int adapter = 0, void* devicePtr = NULL);
private:
HMODULE m_handle { nullptr };
NvFBC_GetStatusExFunctionType pNvFBC_GetStatusEx { nullptr };
NvFBC_SetGlobalFlagsType pNvFBC_SetGlobalFlags { nullptr };
NvFBC_CreateFunctionExType pNvFBC_CreateEx { nullptr };
NvFBC_EnableFunctionType pNvFBC_Enable { nullptr };
};

69
client/Cargo.lock generated Normal file
View file

@ -0,0 +1,69 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "anyhow"
version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775"
[[package]]
name = "bitflags"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "cc"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc"
dependencies = [
"shlex",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cfg_aliases"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "hazelnut_client"
version = "0.1.0"
dependencies = [
"anyhow",
"cc",
"nix",
]
[[package]]
name = "libc"
version = "0.2.167"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc"
[[package]]
name = "nix"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
"bitflags",
"cfg-if",
"cfg_aliases",
"libc",
]
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"

12
client/Cargo.toml Normal file
View file

@ -0,0 +1,12 @@
[package]
name = "hazelnut_client"
description = "Low-level client for the Hazelnut IVSHMEM display protocol"
version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = "1.0.93"
nix = { version = "0.29.0", features = [ "fs" ] }
[build-dependencies]
cc = "1.0.99"

18
client/build.rs Normal file
View file

@ -0,0 +1,18 @@
use cc;
fn main() {
let mut build = cc::Build::new();
// HACK: cc sucks
println!("cargo:rerun-if-changed=src/rust_wrapper.cpp");
println!("cargo:rerun-if-changed=../shared/src");
build
.emit_rerun_if_env_changed(true)
.cpp(true)
.std("c++20")
.include("../shared/src")
.file("../shared/src/ivshmem.cpp")
.file("src/rust_wrapper.cpp")
.compile("hazelnut_client_cpp_native");
}

142
client/src/client.rs Normal file
View file

@ -0,0 +1,142 @@
//! Hazelnut C++ client bindings.
use nix::{fcntl::OFlag, sys::stat::Mode, NixPath};
pub(crate) mod sys {
use std::ffi;
#[repr(u32)]
#[allow(unused)] // it IS used, just not by Rust
pub enum ResultCode {
/// The frame has not been changed. (This is implemented internally by comparing the frame serial; if it has changed then the frame has too)
Unchanged,
/// The frame has been changed.
Changed,
/// The Hazelnut lock was contended, so we couldn't lock it ourselves.
LockContended,
/// A failure occured during the tick.
Fail,
}
extern "C" {
pub(crate) fn rust_new_hazelnut_client() -> *mut ffi::c_void;
pub(crate) fn rust_destroy_hazelnut_client(client: *mut ffi::c_void);
pub(crate) fn rust_hazelnut_client_open(client: *mut ffi::c_void, fd: ffi::c_int) -> bool;
pub(crate) fn rust_hazelnut_client_tick(client: *mut ffi::c_void) -> ResultCode;
// Explicitly lock/unlock.
pub(crate) fn rust_hazelnut_client_lock(client: *mut ffi::c_void);
pub(crate) fn rust_hazelnut_client_unlock(client: *mut ffi::c_void);
// Use only when locked
pub(crate) fn rust_hazelnut_client_get_framebuffer(client: *mut ffi::c_void) -> *mut u32;
pub(crate) fn rust_hazelnut_client_get_width(client: *mut ffi::c_void) -> u32;
pub(crate) fn rust_hazelnut_client_get_height(client: *mut ffi::c_void) -> u32;
}
}
pub type ResultCode = sys::ResultCode;
/// A Hazelnut IVSHMEM client. Wraps the C++ code (see ./rust_wrapper.cpp and the shared sources)
/// so that we can use it in Rust, semi-safely. (Note that I really do not like the current
/// state of these bindings, and they were written JUST to get working.
/// I am aware they are not very idiomatic and of other problems with them.)
pub struct HazelnutClient(*mut std::ffi::c_void);
impl HazelnutClient {
/// Creates a new client.
pub fn new() -> HazelnutClient {
unsafe {
let client = sys::rust_new_hazelnut_client();
assert!(
!client.is_null(),
"C++ code failed to allocate a client object"
);
Self(client)
}
}
/// Opens the given IVSHMEM shmem file.
pub fn open<P: ?Sized + NixPath>(&mut self, path: &P) -> anyhow::Result<()> {
// NOTE: `fd` is owned by the hazelnut client once it is provided to it, so we do not close it ourselves.
let fd = nix::fcntl::open(path, OFlag::O_RDWR, Mode::S_IRUSR | Mode::S_IWUSR)?;
// FIXME: this really should work by FD so we can just return io::Result<> or something, but bleh
// for now it's "fine", also it's a path in the shared sources currently.
unsafe {
if !sys::rust_hazelnut_client_open(self.0, fd) {
return Err(anyhow::anyhow!("Failed to open Hazelnut client"));
}
}
Ok(())
}
/// Ticks this client.
///
/// # Notes
/// If this returns [ResultCode::Changed], then the Hazelnut lock (see [HazelnutClient::lock] and [HazelnutClient::unlock]) is still held,
/// so you will need to unlock after your processing and let the guest VM continue processing.
pub fn tick_one(&mut self) -> ResultCode {
unsafe {
return sys::rust_hazelnut_client_tick(self.0);
}
}
/// Explicitly lock the Hazelnut IVSHMEM memory.
/// During this, the guest VM will wait for us to release the lock, and we can read from the memory without
/// risk of it being changed.
pub fn lock(&mut self) {
unsafe {
return sys::rust_hazelnut_client_lock(self.0);
}
}
/// Unlock the Hazelnut IVSHMEM memory.
pub fn unlock(&mut self) {
unsafe {
return sys::rust_hazelnut_client_unlock(self.0);
}
}
/// Obtains the framebuffer dimensions.
///
/// # Safety
/// Only use while the Hazelnut atomic lock is held!
pub fn dimensions(&mut self) -> (u32, u32) {
let tup = unsafe {
let width = sys::rust_hazelnut_client_get_width(self.0);
let height = sys::rust_hazelnut_client_get_height(self.0);
(width, height)
};
tup
}
/// Obtains a mutable slice containing the framebuffer.
///
/// # Safety
/// Only use while the Hazelnut atomic lock is held!
pub fn framebuffer(&mut self) -> &mut [u32] {
let sl = unsafe {
let fb_ptr = sys::rust_hazelnut_client_get_framebuffer(self.0);
let dim = self.dimensions();
std::slice::from_raw_parts_mut(fb_ptr, (dim.0 * dim.1) as usize * 4)
};
sl
}
}
impl Drop for HazelnutClient {
fn drop(&mut self) {
unsafe {
sys::rust_destroy_hazelnut_client(self.0);
}
self.0 = std::ptr::null_mut();
}
}

2
client/src/lib.rs Normal file
View file

@ -0,0 +1,2 @@
pub mod client;
pub use client::*;

126
client/src/rust_wrapper.cpp Normal file
View file

@ -0,0 +1,126 @@
#include "ivshmem.hpp"
#include "ivshmem_protocol.hpp"
#include "Utils.hpp"
enum class ResultCode : u32 { Unchanged, Changed, LockContended, Fail };
struct HazelnutIvshmemClient {
bool Open(int fd) {
if(!ivshmemDevice.Open(fd))
return false;
auto* ptr = (u8*)ivshmemDevice.GetPointer();
pHeader = (hazelnut::IvshHeader*)&ptr[0];
pFrameHeader = (hazelnut::FrameHeader*)&ptr[0x1000];
sessionId = pHeader->serverSessionId.load();
lastFrameSerial = 0;
return true;
}
// NOTE: This function leaves the lock held on successful returns.
ResultCode TickOne() {
if(!pHeader)
return ResultCode::Fail;
if(sessionId != pHeader->serverSessionId.load())
return ResultCode::Fail;
if(pHeader->lock.try_lock_manually()) {
// failed to lock
return ResultCode::LockContended;
}
auto current = pFrameHeader->serial.load();
if(current == lastFrameSerial) {
return ResultCode::Unchanged;
}
lastFrameSerial = current;
return ResultCode::Changed;
}
void Lock() { pHeader->lock.lock_manually(); }
void Unlock() { pHeader->lock.unlock(); }
u32* Framebuffer() {
if(pFrameHeader) {
return pFrameHeader->bits();
}
return nullptr;
}
hazelnut::IvshmemDevice ivshmemDevice;
// Protocol/memory stuff
hazelnut::IvshHeader* pHeader;
hazelnut::FrameHeader* pFrameHeader;
u32 sessionId {};
u32 lastFrameSerial {};
};
// Rust bindings
extern "C" {
void* rust_new_hazelnut_client() {
return (void*)new HazelnutIvshmemClient;
}
void rust_destroy_hazelnut_client(void* pClient) {
if(pClient)
delete(HazelnutIvshmemClient*)pClient;
}
bool rust_hazelnut_client_open(void* pClient, int fd) {
if(pClient) {
return ((HazelnutIvshmemClient*)pClient)->Open(fd);
}
return false;
}
int rust_hazelnut_client_tick(void* pClient) {
if(pClient) {
return (int)((HazelnutIvshmemClient*)pClient)->TickOne();
}
return (int)ResultCode::Fail;
}
void rust_hazelnut_client_lock(void* pClient) {
if(pClient) {
return ((HazelnutIvshmemClient*)pClient)->Lock();
}
}
void rust_hazelnut_client_unlock(void* pClient) {
if(pClient) {
return ((HazelnutIvshmemClient*)pClient)->Unlock();
}
}
u32* rust_hazelnut_client_get_framebuffer(void* pClient) {
if(pClient) {
return ((HazelnutIvshmemClient*)pClient)->Framebuffer();
}
return nullptr;
}
u32 rust_hazelnut_client_get_width(void* pClient) {
if(pClient) {
return ((HazelnutIvshmemClient*)pClient)->pFrameHeader->width.load();
}
return 0;
}
u32 rust_hazelnut_client_get_height(void* pClient) {
if(pClient) {
return ((HazelnutIvshmemClient*)pClient)->pFrameHeader->height.load();
}
return 0;
}
}

5
shared/README.md Normal file
View file

@ -0,0 +1,5 @@
# shared code
This is all of the things shared between the agent and client ends.
It is cross platform C++20.

View file

@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
#include <cstddef>
// common types
using u8 = std::uint8_t;
@ -11,7 +12,7 @@ using u32 = std::uint32_t;
using i32 = std::int32_t;
using u64 = std::uint64_t;
using i64 = std::int64_t;
using usize = std::size_t;
using usize = size_t;
using f32 = float;
using f64 = double;

View file

@ -0,0 +1,51 @@
#pragma once
#include <atomic>
#include <cstdio> //debugging
#include "Utils.hpp"
#pragma pack(push, 1)
namespace hazelnut {
/// A atomic spinlock. Can be held across threads, or virtual machines.
struct AtomicSpinlock {
struct LockGuard {
~LockGuard() { lock.unlock(); }
protected:
friend AtomicSpinlock;
LockGuard(AtomicSpinlock& lock) : lock(lock) {}
AtomicSpinlock& lock;
};
AtomicSpinlock() { __lock.store(0, std::memory_order::seq_cst); }
LockGuard lock() {
lock_manually();
return LockGuard(*this);
}
void lock_manually() {
u32 expected = 0;
while(!__lock.compare_exchange_strong(expected, 1, std::memory_order::seq_cst)) {
expected = 0;
#ifdef _WIN32
//Sleep(1);
#endif
}
}
bool try_lock_manually() {
u32 expected = 0;
return __lock.compare_exchange_strong(expected, 1, std::memory_order::seq_cst);
}
void unlock() { __lock.store(0, std::memory_order::seq_cst); }
std::atomic_uint32_t __lock;
};
} // namespace hazelnut
#pragma pack(pop)

3
shared/src/build_test.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
set -xeuo pipefail
g++ -O3 -std=c++20 ivshmem.cpp test.cpp -o test

40
shared/src/ivshmem.cpp Normal file
View file

@ -0,0 +1,40 @@
#include "ivshmem.hpp"
#include <memory>
#ifdef _WIN32
#include "ivshmem_windows.cpp"
#elif __linux__
#include "ivshmem_linux.cpp"
#else
#error YOU fucked
#endif
namespace hazelnut {
IvshmemDevice::IvshmemDevice() {
pImpl = new Impl;
}
IvshmemDevice::~IvshmemDevice() {
Close();
delete pImpl;
}
bool IvshmemDevice::Open(int fd) {
return pImpl->Open(fd);
}
void IvshmemDevice::Close() {
pImpl->Close();
}
void* IvshmemDevice::GetPointer() {
return pImpl->GetPointer();
}
usize IvshmemDevice::GetSize() {
return pImpl->GetSize();
}
} // namespace hazelnut

31
shared/src/ivshmem.hpp Normal file
View file

@ -0,0 +1,31 @@
#pragma once
#include "Utils.hpp"
namespace hazelnut {
/// Cross-platform IVSHMEM.
struct IvshmemDevice {
IvshmemDevice();
// forbid copy/move
IvshmemDevice(const IvshmemDevice&) = delete;
IvshmemDevice(IvshmemDevice&&) = delete;
~IvshmemDevice();
/// Opens the device. On Linux [fd] MUST be a valid file descriptor for a SHMEM file.
bool Open(int fd = -1);
void Close();
/// Gets pointer to IVSHMEM memory.
void* GetPointer();
usize GetSize();
private:
struct Impl;
Impl* pImpl {};
};
} // namespace hazelnut

View file

@ -0,0 +1,76 @@
#include <dirent.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
#include "Utils.hpp"
namespace hazelnut {
struct IvshmemDevice::Impl {
int fd;
void* pMap = nullptr;
usize size = 0;
bool OpenDevice(int fd) {
// fd is not optional on Linux.
if(fd == -1)
return false;
this->fd = fd;
return true;
}
bool MapMemory() {
// Device was opened, let's map memory
struct stat st {};
if(fstat(fd, &st) != 0) {
return false;
}
usize devSize = st.st_size;
void* map = mmap(0, devSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if(map == MAP_FAILED) {
return false;
}
pMap = map;
size = devSize;
return true;
}
void UnmapMemory() {
// Unmap memory.
if(pMap)
munmap(pMap, size);
}
bool Open(int fd) {
if(!OpenDevice(fd))
return false;
if(!MapMemory()) {
Close();
return false;
}
return true; // mapped
}
void Close() {
UnmapMemory();
close(fd);
fd = -1;
}
void* GetPointer() { return pMap; }
usize GetSize() { return size; }
};
} // namespace hazelnut

View file

@ -0,0 +1,42 @@
#pragma once
#include <atomic>
#include "atomic_spinlock.hpp"
namespace hazelnut {
#pragma pack(push, 1)
/// Header for Hazelnut ivshmem. At 0x0 in the ivshmem memory space.
struct IvshHeader {
std::atomic<u32> magic;
std::atomic<u32> serverSessionId{};
// When this lock is held by the host, the host can read the rest of memory freely.
// We wait for the host to release before updating memory ourselves.
AtomicSpinlock lock;
// Immediately after is FrameHeader
};
/// Stored at a page boundary
struct FrameHeader {
/// The serial of the frame. If this is unchanged between a
/// lock-grab-unlock cycle, the frame has not changed.
std::atomic<u32> serial{};
// size
std::atomic<u32> width{};
std::atomic<u32> height{};
// obtain bits at the next page boundary
u32* bits() {
return reinterpret_cast<u32*>(reinterpret_cast<u8*>(this) + 0x1000);
}
};
#pragma pack(pop)
}

View file

@ -0,0 +1,168 @@
// clang-format off
#include <windows.h>
#include <setupapi.h>
// IVSHMEM ioctls
#include <virtio/ivshmem.h>
// clang-format on
namespace hazelnut {
template <class T>
struct free_deleter {
void operator()(T* ptr) {
if(ptr)
free(ptr);
}
};
// DOES NOT UNBLESS WITH ->~T() !!!
template <class T>
using unique_malloc_ptr = std::unique_ptr<T, free_deleter<T>>;
// does not bless with placement new
template <class T>
unique_malloc_ptr<T> unique_malloc(usize len) {
return { reinterpret_cast<T*>(malloc(len)), free_deleter<T> {} };
}
struct scoped_devinfo {
scoped_devinfo(HDEVINFO hDevInfo) : hDevInfo(hDevInfo) {}
~scoped_devinfo() { SetupDiDestroyDeviceInfoList(hDevInfo); }
scoped_devinfo(const scoped_devinfo&) = delete;
scoped_devinfo(scoped_devinfo&&) = delete;
operator HDEVINFO() { return hDevInfo; }
private:
HDEVINFO hDevInfo;
};
struct IvshmemDevice::Impl {
HANDLE hIvshmem { INVALID_HANDLE_VALUE };
IVSHMEM_MMAP ivshmemMmapStruct {};
bool OpenDevice() {
memset(&ivshmemMmapStruct, 0, sizeof(IVSHMEM_MMAP));
SP_DEVINFO_DATA devInfoData = {
.cbSize = sizeof(SP_DEVINFO_DATA),
};
SP_DEVICE_INTERFACE_DATA devInterfaceData { .cbSize = sizeof(SP_DEVICE_INTERFACE_DATA) };
auto hDevInfo =
scoped_devinfo { SetupDiGetClassDevsA(&GUID_DEVINTERFACE_IVSHMEM, nullptr, nullptr, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE) };
// just do the first one for now
SetupDiEnumDeviceInfo(hDevInfo, 0, &devInfoData);
if(auto le = GetLastError(); le != ERROR_SUCCESS && le != ERROR_NO_MORE_ITEMS) {
return false;
}
if(SetupDiEnumDeviceInterfaces(hDevInfo, &devInfoData, &GUID_DEVINTERFACE_IVSHMEM, 0, &devInterfaceData) == FALSE) {
return false;
}
DWORD dwReq = 0;
SetupDiGetDeviceInterfaceDetail(hDevInfo, &devInterfaceData, nullptr, 0, &dwReq, nullptr);
if(!dwReq) {
return false;
}
auto pData = unique_malloc<SP_DEVICE_INTERFACE_DETAIL_DATA>(dwReq);
pData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
if(!SetupDiGetDeviceInterfaceDetail(hDevInfo, &devInterfaceData, pData.get(), dwReq, nullptr, nullptr)) {
return false;
}
hIvshmem = CreateFile(pData->DevicePath, 0, 0, nullptr, OPEN_EXISTING, 0, nullptr);
if(hIvshmem == INVALID_HANDLE_VALUE) {
return false;
}
return true;
}
template <class TInput, class TOutput>
bool Ioctl(u32 ctlCode, TInput& in, TOutput& out) {
// Needed because some versions of the IVSHMEM driver, notably the last one
// that works on Windows 7, assumes return length is not nullptr, and will crash
// the calling process if it is nullptr. Red Hat quality code everyone; it doesn't
// just envelope the Linux ecosystem - it even gets to take over the Windows one too!
DWORD dwDummyRetLength = 0;
if(!DeviceIoControl(hIvshmem, ctlCode, reinterpret_cast<void*>(&in), sizeof(TInput), reinterpret_cast<void*>(&out), sizeof(TOutput),
&dwDummyRetLength, nullptr)) {
return false;
}
return true;
}
// Ioctl() overload for bare
bool Ioctl(u32 ctlCode) {
DWORD dwDummyRetLength = 0;
if(!DeviceIoControl(hIvshmem, ctlCode, nullptr, 0, nullptr, 0, &dwDummyRetLength, nullptr)) {
return false;
}
return true;
}
bool MapMemory() {
// Device was opened, let's map memory
DWORD dwDummyRetLength = 0;
// Yay, one less syscall.
IVSHMEM_MMAP_CONFIG config = { .cacheMode = IVSHMEM_CACHE_WRITECOMBINED };
return Ioctl(IOCTL_IVSHMEM_REQUEST_MMAP, config, this->ivshmemMmapStruct);
}
void UnmapMemory() {
// Unmap memory.
if(ivshmemMmapStruct.ptr) {
// We do not care if this fails since the device will eventually be closed and this is done only
// on agent exit, so the map will be released by the kernel anyhow.
static_cast<void>(Ioctl(IOCTL_IVSHMEM_RELEASE_MMAP));
}
memset(&ivshmemMmapStruct, 0, sizeof(IVSHMEM_MMAP));
}
bool Open(int fd) {
if(!OpenDevice())
return false;
if(!MapMemory()) {
Close();
return false;
}
return true; // mapped
}
void Close() {
UnmapMemory();
CloseHandle(hIvshmem);
hIvshmem = INVALID_HANDLE_VALUE;
}
void* GetPointer() {
return ivshmemMmapStruct.ptr;
}
usize GetSize() {
return ivshmemMmapStruct.size;
}
};
} // namespace hazelnut

79
shared/src/test.cpp Normal file
View file

@ -0,0 +1,79 @@
#include <fcntl.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <thread>
#include "atomic_spinlock.hpp"
#include "ivshmem.hpp"
#include "ivshmem_protocol.hpp"
int main(int argc, char** argv) {
hazelnut::IvshmemDevice dev;
int fd = open("/dev/shm/lg-win7", O_RDWR, (mode_t)0600);
if(fd == -1) {
printf("Failed to open ivshmem device file\n");
}
if(!dev.Open(fd)) {
printf("Failed to open ivshmem device\n");
return 1;
}
auto size = dev.GetSize();
auto ptr = (u8*)dev.GetPointer();
printf("opened a %zu MB large ivshmem\n", (size / (1024 * 1024)));
memset(ptr, 0, size);
printf("zeroed :)\n");
#if 0
auto* pHeader = (hazelnut::IvshHeader*)&ptr[0];;
auto* pFrameHeader = (hazelnut::FrameHeader*)&ptr[0x1000];
u64 initalizedSessionId = pHeader->serverSessionId.load();
u32 lastSerial = 0;
while(true) {
if(initalizedSessionId != pHeader->serverSessionId.load()) {
printf("Agent restarted. Closing\n");
break;
}
// lock for a bit
{
if(pHeader->lock.try_lock_manually()) {
// failed to lock
continue;
}
auto current = pFrameHeader->serial.load();
if(current == lastSerial) {
pHeader->lock.unlock();
continue;
}
lastSerial = current;
printf("Frame with serial %u. Width %ux%u\n", lastSerial, pFrameHeader->width.load(), pFrameHeader->height.load());
pHeader->lock.unlock();
}
// allow the vm some time to do whatever it is it wants to do
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
#endif
return 0;
}

View file

@ -1,128 +0,0 @@
use std::{
io::Read,
net::{TcpListener, TcpStream},
};
use byteorder::{LittleEndian, ReadBytesExt};
use minifb::{Window, WindowOptions};
#[derive(Debug)]
enum Message {
Resize { width: u32, height: u32 },
Data {},
}
pub const MESSAGETYPE_RESIZE: u32 = 0;
pub const MESSAGETYPE_DATA: u32 = 1;
fn read_message(stream: &mut TcpStream, argb_buffer: &mut Vec<u32>, width: u32) -> Option<Message> {
let message_type = stream.read_u32::<LittleEndian>().expect("fuck");
let message_len = stream.read_u32::<LittleEndian>().expect("fuck");
match message_type {
MESSAGETYPE_RESIZE => {
if message_len != 8 {
return None;
}
let width = stream.read_u32::<LittleEndian>().expect("fuck");
let height = stream.read_u32::<LittleEndian>().expect("fuck");
Some(Message::Resize {
width: width,
height: height,
})
}
MESSAGETYPE_DATA => {
let tile_count = stream.read_u32::<LittleEndian>().expect("fuck");
println!("{tile_count} tiles");
for i in 0..tile_count {
// tile rect
let tile_x = stream.read_u32::<LittleEndian>().expect("fuck");
let tile_y = stream.read_u32::<LittleEndian>().expect("fuck");
let tile_width = stream.read_u32::<LittleEndian>().expect("fuck");
let tile_height = stream.read_u32::<LittleEndian>().expect("fuck");
//println!("tile{i}: {tile_x} {tile_y} {tile_width}x{tile_height}");
// tile data, painted directly onto the argb buffer. It's stupid
let argb_slice = unsafe {
std::slice::from_raw_parts_mut(
argb_buffer.as_mut_ptr() as *mut u8,
argb_buffer.len() * core::mem::size_of::<u32>(),
)
};
for y in tile_y..tile_y + tile_height {
//println!("{y} {tile_y} {tile_height}");
//for x in tile_
let dest_slice = &mut argb_slice[((y * width + tile_x) * 4) as usize
..((y * width + (tile_x + tile_width)) * 4) as usize];
stream.read_exact(&mut dest_slice[..]).expect("FUCK");
}
}
Some(Message::Data {})
}
_ => {
return None;
}
}
}
fn main() {
let listener = TcpListener::bind("192.168.1.149:9438").expect("fuck");
let (mut socket, client_addr) = listener.accept().expect("FUCK!");
let mut window = Window::new("FbcServer", 320, 200, WindowOptions::default())
.expect("you banned forever: rules do not");
let mut argb_buffer: Vec<u32> = Vec::new();
let mut screen_width: u32 = 320;
let mut screen_height: u32 = 200;
loop {
if let Some(message) = read_message(&mut socket, &mut argb_buffer, screen_width) {
match message {
Message::Resize { width, height } => {
println!("read message {:?}", message);
screen_width = width;
screen_height = height;
window = Window::new(
"FbcServer",
width as usize,
height as usize,
WindowOptions::default(),
)
.expect("you banned forever: rules do not");
argb_buffer.resize((screen_width * screen_height) as usize, 0);
}
Message::Data {} => {
//println!("read DATA");
window
.update_with_buffer(
&argb_buffer[..],
screen_width as usize,
screen_height as usize,
)
.expect("Failed to update screen");
}
}
} else {
println!("invalid message, termination.");
break;
}
//window.upd
}
println!("Hello, world!");
}

View file

@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "anyhow"
version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775"
[[package]]
name = "autocfg"
version = "1.4.0"
@ -26,12 +32,6 @@ version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "cc"
version = "1.2.1"
@ -47,6 +47,12 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cfg_aliases"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "dlib"
version = "0.5.2"
@ -78,14 +84,6 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4"
[[package]]
name = "fbcserver"
version = "0.1.0"
dependencies = [
"byteorder",
"minifb",
]
[[package]]
name = "futures"
version = "0.3.31"
@ -175,6 +173,24 @@ dependencies = [
"slab",
]
[[package]]
name = "hazelnut_client"
version = "0.1.0"
dependencies = [
"anyhow",
"cc",
"nix 0.29.0",
]
[[package]]
name = "hazelnut_testclient"
version = "0.1.0"
dependencies = [
"anyhow",
"hazelnut_client",
"minifb",
]
[[package]]
name = "instant"
version = "0.1.13"
@ -204,9 +220,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
version = "0.2.164"
version = "0.2.167"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f"
checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc"
[[package]]
name = "libloading"
@ -294,6 +310,18 @@ dependencies = [
"memoffset",
]
[[package]]
name = "nix"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
"bitflags 2.6.0",
"cfg-if",
"cfg_aliases",
"libc",
]
[[package]]
name = "once_cell"
version = "1.20.2"
@ -558,7 +586,7 @@ dependencies = [
"bitflags 1.3.2",
"downcast-rs",
"libc",
"nix",
"nix 0.24.3",
"scoped-tls",
"wayland-commons",
"wayland-scanner",
@ -571,7 +599,7 @@ version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902"
dependencies = [
"nix",
"nix 0.24.3",
"once_cell",
"smallvec",
"wayland-sys",
@ -583,7 +611,7 @@ version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661"
dependencies = [
"nix",
"nix 0.24.3",
"wayland-client",
"xcursor",
]

9
testclient/Cargo.toml Normal file
View file

@ -0,0 +1,9 @@
[package]
name = "hazelnut_testclient"
version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = "1.0.93"
minifb = "0.27.0"
hazelnut_client = { path = "../client" }

77
testclient/src/main.rs Normal file
View file

@ -0,0 +1,77 @@
use minifb::{Window, WindowOptions};
use hazelnut_client::*;
fn main() -> anyhow::Result<()> {
let mut screen_width: u32 = 320;
let mut screen_height: u32 = 200;
let mut window: Option<Window> = None;
let mut client = HazelnutClient::new();
let socket_path: String = "/dev/shm/lg-win7".into();
client.open(&socket_path[..])?;
println!("Opened IVSHMEM device.");
loop {
match window.as_mut() {
Some(window) => {
if !window.is_open() {
break;
}
}
None => {}
}
match client.tick_one() {
ResultCode::Fail => break,
ResultCode::Changed => {
let dims = client.dimensions();
if screen_width != dims.0 && screen_height != dims.1 {
screen_width = dims.0;
screen_height = dims.1;
window = Some(
Window::new(
&format!("Hazelnut client \"{socket_path}\" ({screen_width}x{screen_height})"),
screen_width as usize,
screen_height as usize,
WindowOptions::default(),
)
.expect("Could not create window"),
);
}
window
.as_mut()
.unwrap()
.update_with_buffer(
&client.framebuffer(),
screen_width as usize,
screen_height as usize,
)
.expect("Failed to update");
client.unlock();
},
ResultCode::LockContended => {
// contended
}
ResultCode::Unchanged => match window.as_mut() {
Some(window) => {
client.unlock();
window.update();
}
_ => {}
},
}
}
Ok(())
}