Merge branch 'master' into pr328

This commit is contained in:
icex2 2025-02-13 14:50:41 +01:00 committed by GitHub
commit 9a310c6fb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
122 changed files with 118563 additions and 467 deletions

View File

@ -30,7 +30,7 @@ jobs:
cd ..
- name: "Upload artifact"
uses: "actions/upload-artifact@v2"
uses: "actions/upload-artifact@v4"
with:
name: bemanitools-${{ github.sha }}
retention-days: 90

View File

@ -35,7 +35,7 @@ jobs:
cd ..
- name: "Upload artifact"
uses: "actions/upload-artifact@v2"
uses: "actions/upload-artifact@v4"
with:
name: bemanitools-${{ github.sha }}
retention-days: 90

21
Dockerfile.dev Normal file
View File

@ -0,0 +1,21 @@
FROM --platform=amd64 debian:11.6-slim@sha256:f7d141c1ec6af549958a7a2543365a7829c2cdc4476308ec2e182f8a7c59b519
LABEL description="Development environment for bemanitools"
# mingw-w64-gcc has 32-bit and 64-bit toolchains
RUN apt-get update && apt-get install -y --no-install-recommends \
mingw-w64 \
mingw-w64-common \
make \
zip \
git \
clang-format \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install mdformat
RUN mkdir /bemanitools
WORKDIR /bemanitools
ENV SHELL /bin/bash

View File

@ -13,8 +13,10 @@ BUILDDIR ?= build
builddir_docker := $(BUILDDIR)/docker
docker_container_name := "bemanitools-build"
docker_image_name := "bemanitools-build:latest"
docker_build_container_name := "bemanitools-build"
docker_build_image_name := "bemanitools-build:latest"
docker_dev_container_name := "bemanitools-dev"
docker_dev_image_name := "bemanitools-dev:latest"
depdir := $(BUILDDIR)/dep
objdir := $(BUILDDIR)/obj
@ -28,7 +30,7 @@ cppflags := -I src -I src/main -I src/test -DGITREV=$(gitrev)
cflags := -O2 -pipe -ffunction-sections -fdata-sections \
-Wall -std=c99 -DPSAPI_VERSION=1
cflags_release := -Werror
ldflags := -Wl,--gc-sections -static-libgcc
ldflags := -Wl,--gc-sections -static -static-libgcc -static-libstdc++
#
# The first target that GNU Make encounters becomes the default target.
@ -41,6 +43,7 @@ FORCE:
.PHONY: \
build-docker \
dev-docker \
clean \
code-format \
doc-format \
@ -89,21 +92,38 @@ version:
$(V)echo "$(gitrev)" > version
build-docker:
$(V)docker rm -f $(docker_container_name) 2> /dev/null || true
$(V)docker rm -f $(docker_build_container_name) 2> /dev/null || true
$(V)docker \
build \
-t $(docker_image_name) \
-f Dockerfile \
-t $(docker_build_image_name) \
-f Dockerfile.build \
.
$(V)docker \
run \
--volume $(shell pwd):/bemanitools \
--name $(docker_container_name) \
$(docker_image_name)
--name $(docker_build_container_name) \
$(docker_build_image_name)
dev-docker:
$(V)docker rm -f $(docker_dev_container_name) 2> /dev/null || true
$(V)docker \
build \
-t $(docker_dev_image_name) \
-f Dockerfile.dev \
.
$(V)docker \
run \
--interactive \
--tty \
--volume $(shell pwd):/bemanitools \
--name $(docker_dev_container_name) \
$(docker_dev_image_name)
clean-docker:
$(V)docker rm -f $(docker_container_name) || true
$(V)docker image rm -f $(docker_image_name) || true
$(V)docker rm -f $(docker_dev_container_name) || true
$(V)docker image rm -f $(docker_dev_image_name) || true
$(V)docker rm -f $(docker_build_container_name) || true
$(V)docker image rm -f $(docker_build_image_name) || true
$(V)rm -rf $(BUILDDIR)
#
@ -136,8 +156,10 @@ modules := $(dlls) $(exes) $(libs) $(avsdlls) $(avsexes) $(testdlls) $(testexes
define t_moddefs
cppflags_$3 += $(cppflags) -DBUILD_MODULE=$3
cxxflags_$3 += $(cxxflags) # Add C++-specific flags
cflags_$3 += $(cflags)
release: cflags_$3 += $(cflags_release)
release: cxxflags_$3 += $(cxxflags_release) # Add C++-specific release flags
ldflags_$3 += $(ldflags)
srcdir_$3 ?= src/main/$3
@ -192,9 +214,11 @@ abslib_$1_$2_$3 := $$(libs_$3:%=$$(bindir_$1_indep)/lib%.a)
absdpl_$1_$2_$3 := $$(deplibs_$3:%=$$(bindir_$1_$2)/lib%.a)
objdir_$1_$2_$3 := $(objdir)/$$(subdir_$1_$2)/$3
obj_$1_$2_$3 := $$(src_$3:%.c=$$(objdir_$1_$2_$3)/%.o) \
$$(cppsrc_$3:%.cpp=$$(objdir_$1_$2_$3)/%.o) \
$$(rc_$3:%.rc=$$(objdir_$1_$2_$3)/%_rc.o)
deps += $$(src_$3:%.c=$$(depdir_$1_$2_$3)/%.d)
deps += $$(src_$3:%.c=$$(depdir_$1_$2_$3)/%.d) \
$$(cppsrc_$3:%.cpp=$$(depdir_$1_$2_$3)/%.d)
$$(depdir_$1_$2_$3):
$(V)mkdir -p $$@
@ -203,16 +227,24 @@ $$(objdir_$1_$2_$3):
$(V)mkdir -p $$@
$$(volatile_$3:%.c=$$(objdir_$1_$2_$3)/%.o): FORCE
$$(volatile_cpp_$3:%.cpp=$$(objdir_$1_$2_$3)/%.o): FORCE
$$(objdir_$1_$2_$3)/%.o: $$(srcdir_$3)/%.c \
| $$(depdir_$1_$2_$3) $$(objdir_$1_$2_$3)
$(V)echo ... $$@
$(V)echo \(.c\) ... $$@
$(V)$$(toolchain_$1)gcc $$(cflags_$3) $$(cppflags_$3) \
-MMD -MF $$(depdir_$1_$2_$3)/$$*.d -MT $$@ -MP \
-DAVS_VERSION=$2 -c -o $$@ $$<
$$(objdir_$1_$2_$3)/%.o: $$(srcdir_$3)/%.cpp \
| $$(depdir_$1_$2_$3) $$(objdir_$1_$2_$3)
$(V)echo \(.cpp\) ... $$@
$(V)$$(toolchain_$1)g++ $$(cxxflags_$3) $$(cppflags_$3) \
-MMD -MF $$(depdir_$1_$2_$3)/$$*.d -MT $$@ -MP \
-DAVS_VERSION=$2 -c -o $$@ $$<
$$(objdir_$1_$2_$3)/%_rc.o: $$(srcdir_$3)/%.rc
$(V)echo ... $$@ [windres]
$(V)echo \(.rc\) ... $$@ [windres]
$(V)$$(toolchain_$1)windres $$(cppflags_$3) $$< $$@
endef
@ -224,7 +256,7 @@ define t_archive
$(t_compile)
$$(bindir_$1_$2)/lib$3.a: $$(obj_$1_$2_$3) | $$(bindir_$1_$2)
$(V)echo ... $$@
$(V)echo \(.a\) ... $$@
$(V)$$(toolchain_$1)ar r $$@ $$^ 2> /dev/null
$(V)$$(toolchain_$1)ranlib $$@
@ -242,8 +274,8 @@ implib_$1_$2_$3 := $$(bindir_$1_$2)/lib$3.a
$$(dll_$1_$2_$3) $$(implib_$1_$2_$3): $$(obj_$1_$2_$3) $$(abslib_$1_$2_$3) \
$$(absdpl_$1_$2_$3) \
$$(srcdir_$3)/$3.def | $$(bindir_$1_$2)
$(V)echo ... $$(dll_$1_$2_$3)
$(V)$$(toolchain_$1)gcc -shared \
$(V)echo \(.dll\) ... $$(dll_$1_$2_$3)
$(V)$$(toolchain_$1)g++ -shared \
-o $$(dll_$1_$2_$3) -Wl,--out-implib,$$(implib_$1_$2_$3) \
-Wl,--start-group $$^ -Wl,--end-group $$(ldflags_$3)
$(V)$$(toolchain_$1)strip $$(dll_$1_$2_$3)
@ -261,8 +293,8 @@ exe_$1_$2_$3 := $$(bindir_$1_$2)/$3.exe
$$(exe_$1_$2_$3): $$(obj_$1_$2_$3) $$(abslib_$1_$2_$3) $$(absdpl_$1_$2_$3) \
| $$(bindir_$1_$2)
$(V)echo ... $$@
$(V)$$(toolchain_$1)gcc -o $$@ $$^ $$(ldflags_$3)
$(V)echo \(.exe\) ... $$@
$(V)$$(toolchain_$1)g++ -o $$@ $$^ $$(ldflags_$3)
$(V)$$(toolchain_$1)strip $$@
endef
@ -274,7 +306,7 @@ define t_import
impdef_$1_$2_$3 ?= src/imports/import_$1_$2_$3.def
$$(bindir_$1_$2)/lib$3.a: $$(impdef_$1_$2_$3) | $$(bindir_$1_$2)
$(V)echo ... $$@ [dlltool]
$(V)echo \(.a\) ... $$@ [dlltool]
$(V)$$(toolchain_$1)dlltool --kill-at -l $$@ -d $$<
endef

View File

@ -100,6 +100,8 @@ include src/main/bstio/Module.mk
include src/main/camhook/Module.mk
include src/main/cconfig/Module.mk
include src/main/config/Module.mk
include src/main/d3d9-frame-graph-hook/Module.mk
include src/main/d3d9-monitor-check/Module.mk
include src/main/d3d9-util/Module.mk
include src/main/d3d9exhook/Module.mk
include src/main/ddrhook-util/Module.mk
@ -154,11 +156,15 @@ include src/main/iidxhook6/Module.mk
include src/main/iidxhook7/Module.mk
include src/main/iidxhook8/Module.mk
include src/main/iidxhook9/Module.mk
include src/main/iidxio-async/Module.mk
include src/main/iidxio-bio2/Module.mk
include src/main/iidxio-ezusb/Module.mk
include src/main/iidxio-ezusb2/Module.mk
include src/main/iidxio/Module.mk
include src/main/iidxiotest/Module.mk
include src/main/imgui/Module.mk
include src/main/imgui-bt/Module.mk
include src/main/imgui-debug/Module.mk
include src/main/inject/Module.mk
include src/main/jbio-magicbox/Module.mk
include src/main/jbio-p4io/Module.mk
@ -172,6 +178,8 @@ include src/main/jbhook3/Module.mk
include src/main/launcher/Module.mk
include src/main/mempatch-hook/Module.mk
include src/main/mm/Module.mk
include src/main/nv/Module.mk
include src/main/nvgpu/Module.mk
include src/main/p3io/Module.mk
include src/main/p3iodrv/Module.mk
include src/main/p3ioemu/Module.mk
@ -232,6 +240,9 @@ $(zipdir)/tools.zip: \
build/bin/indep-32/ezusb2-dbg-hook.dll \
build/bin/indep-32/ezusb2-tool.exe \
build/bin/indep-32/ezusb-tool.exe \
build/bin/indep-32/nvgpu.exe \
build/bin/indep-32/d3d9-frame-graph-hook.dll \
build/bin/indep-32/d3d9-monitor-check.exe \
| $(zipdir)/
$(V)echo ... $@
$(V)zip -j $@ $^
@ -246,6 +257,9 @@ $(zipdir)/tools-x64.zip: \
build/bin/indep-64/iidx-ezusb2-exit-hook.dll \
build/bin/indep-64/jbiotest.exe \
build/bin/indep-64/mempatch-hook.dll \
build/bin/indep-64/nvgpu.exe \
build/bin/indep-64/d3d9-frame-graph-hook.dll \
build/bin/indep-64/d3d9-monitor-check.exe \
| $(zipdir)/
$(V)echo ... $@
$(V)zip -j $@ $^
@ -292,7 +306,7 @@ $(zipdir)/iidx-13.zip: \
$(V)zip -j $@ $^
$(zipdir)/iidx-14-to-17.zip: \
build/bin/avs2_0-32/iidxhook3.dll \
build/bin/avs2_803-32/iidxhook3.dll \
build/bin/indep-32/config.exe \
build/bin/indep-32/eamio.dll \
build/bin/indep-32/geninput.dll \
@ -431,7 +445,7 @@ $(zipdir)/iidx-25-to-26.zip: \
$(V)echo ... $@
$(V)zip -j $@ $^
$(zipdir)/iidx-27-to-30.zip: \
$(zipdir)/iidx-27-to-31.zip: \
build/bin/avs2_1700-64/iidxhook9.dll \
build/bin/avs2_1700-64/launcher.exe \
build/bin/indep-64/config.exe \
@ -444,10 +458,12 @@ $(zipdir)/iidx-27-to-30.zip: \
dist/iidx/gamestart-28.bat \
dist/iidx/gamestart-29.bat \
dist/iidx/gamestart-30.bat \
dist/iidx/gamestart-31.bat \
dist/iidx/iidxhook-27.conf \
dist/iidx/iidxhook-28.conf \
dist/iidx/iidxhook-29.conf \
dist/iidx/iidxhook-30.conf \
dist/iidx/iidxhook-31.conf \
dist/iidx/vefx.txt \
| $(zipdir)/
$(V)echo ... $@
@ -456,6 +472,7 @@ $(zipdir)/iidx-27-to-30.zip: \
$(zipdir)/iidx-hwio-x86.zip: \
build/bin/indep-32/aciomgr.dll \
build/bin/indep-32/eamio-icca.dll \
build/bin/indep-32/iidxio-async.dll \
build/bin/indep-32/iidxio-bio2.dll \
build/bin/indep-32/iidxio-ezusb.dll \
build/bin/indep-32/iidxio-ezusb2.dll \
@ -469,6 +486,7 @@ $(zipdir)/iidx-hwio-x86.zip: \
$(zipdir)/iidx-hwio-x64.zip: \
build/bin/indep-64/aciomgr.dll \
build/bin/indep-64/eamio-icca.dll \
build/bin/indep-64/iidxio-async.dll \
build/bin/indep-64/iidxio-bio2.dll \
build/bin/indep-64/iidxio-ezusb.dll \
build/bin/indep-64/iidxio-ezusb2.dll \
@ -710,6 +728,8 @@ $(zipdir)/ddr-14-to-18.zip: \
build/bin/indep-32/eamio.dll \
build/bin/indep-32/geninput.dll \
dist/ddr/config.bat \
dist/ddr/gamestart-17.bat \
dist/ddr/gamestart-18.bat \
dist/ddr/gamestart-14.bat \
dist/ddr/gamestart-15.bat \
dist/ddr/gamestart-16.bat \
@ -728,6 +748,8 @@ $(zipdir)/ddr-16-to-18-x64.zip: \
build/bin/indep-64/eamio.dll \
build/bin/indep-64/geninput.dll \
dist/ddr/config.bat \
dist/ddr/gamestart-17.bat \
dist/ddr/gamestart-18.bat \
dist/ddr/gamestart-16.bat \
dist/ddr/gamestart-17.bat \
dist/ddr/gamestart-18.bat \
@ -847,7 +869,7 @@ $(BUILDDIR)/bemanitools.zip: \
$(zipdir)/iidx-20-cn.zip \
$(zipdir)/iidx-21-to-24.zip \
$(zipdir)/iidx-25-to-26.zip \
$(zipdir)/iidx-27-to-30.zip \
$(zipdir)/iidx-27-to-31.zip \
$(zipdir)/iidx-hwio-x86.zip \
$(zipdir)/iidx-hwio-x64.zip \
$(zipdir)/jb-01.zip \

View File

@ -71,6 +71,7 @@ The following games are supported with their corresponding hook-libraries.
- Beatmania IIDX 28 BISTROVER (`iidx-27-to-30.zip`): [iidxhook9](doc/iidxhook/iidxhook9.md)
- Beatmania IIDX 29 CASTHOUR (`iidx-27-to-30.zip`): [iidxhook9](doc/iidxhook/iidxhook9.md)
- Beatmania IIDX 30 RESIDENT (`iidx-27-to-30.zip`): [iidxhook9](doc/iidxhook/iidxhook9.md)
- Beatmania IIDX 31 EPOLIS (`iidx-27-to-31.zip`): [iidxhook9](doc/iidxhook/iidxhook9.md)
- [jubeat](doc/jbhook/README.md)
- jubeat (`jb-01.zip`): [jbhook1](doc/jbhook/jbhook1.md)
- jubeat ripples (`jb-02.zip`): [jbhook1](doc/jbhook/jbhook1.md)
@ -119,9 +120,12 @@ The following games are supported with their corresponding hook-libraries.
- [extiotest](doc/tools/extiotest.md)
- [aciotest](doc/tools/aciotest.md): Command line tool to quickly test ACIO devices
- config: UI input/output configuration tool when using the default bemanitools API (geninput)
- [d3d9-monitor-check](doc/tools/d3d9-monitor-check.md): Command line tool to check the monitor refresh rate of the
current GPU + monitor configuration
- ir-beat-patch-9/10: Patch the IR beat phase on IIDX 9 and 10
- [mempatch-hook](doc/tools/mempatch-hook.md): Patch raw memory locations in the target process
based on the provided configuration
- [nvgpu](doc/tools/nvgpu.md): Command line tool to configure and tweak the NVIDIA GPU driver
- [pcbidgen](doc/tools/pcbidgen.md): Konami PCBID generator tool
- [ViGEm clients](doc/vigem/README.md): Expose BT5 APIs as XBOX game controllers to play any games
with real cabinet hardware.

16
dist/iidx/gamestart-31.bat vendored Normal file
View File

@ -0,0 +1,16 @@
@echo off
cd /d %~dp0
if not exist dev mkdir dev
if not exist dev\e mkdir dev\e
if not exist dev\g mkdir dev\g
if not exist dev\nvram mkdir dev\nvram
if not exist dev\raw mkdir dev\raw
if not exist dev\raw\log mkdir dev\raw\log
if not exist dev\raw\fscache mkdir dev\raw\fscache
for /R prop\defaults %%D in (*.*) do (
if not exist dev\nvram\%%~nxD copy /y prop\defaults\%%~nxD dev\nvram
)
modules\launcher -H 134217728 -B iidxhook9.dll bm2dx.dll --config iidxhook-31.conf %*

View File

@ -22,6 +22,9 @@ io.tt_multiplier=1.0
# Disables the camera emulation
cam.disable_emu=true
# Camera port layout (0 = LDJ, 1 = CLDJ/TDJ-JA, 2 = TDJ-JB)
cam.port_layout=1
# Disable camera 1. Use, i.e., if you only have one camera and want it to be mapped to camera 2 ingame.
cam.disable_camera1=false

View File

@ -22,6 +22,9 @@ io.tt_multiplier=1.0
# Disables the camera emulation
cam.disable_emu=true
# Camera port layout (0 = LDJ, 1 = CLDJ/TDJ-JA, 2 = TDJ-JB)
cam.port_layout=1
# Disable camera 1. Use, i.e., if you only have one camera and want it to be mapped to camera 2 ingame.
cam.disable_camera1=false

View File

@ -22,6 +22,9 @@ io.tt_multiplier=1.0
# Disables the camera emulation
cam.disable_emu=true
# Camera port layout (0 = LDJ, 1 = CLDJ/TDJ-JA, 2 = TDJ-JB)
cam.port_layout=1
# Disable camera 1. Use, i.e., if you only have one camera and want it to be mapped to camera 2 ingame.
cam.disable_camera1=true

View File

@ -22,6 +22,9 @@ io.tt_multiplier=1.0
# Disables the camera emulation
cam.disable_emu=true
# Camera port layout (0 = LDJ, 1 = CLDJ/TDJ-JA, 2 = TDJ-JB)
cam.port_layout=1
# Disable camera 1. Use, i.e., if you only have one camera and want it to be mapped to camera 2 ingame.
cam.disable_camera1=true

84
dist/iidx/iidxhook-31.conf vendored Normal file
View File

@ -0,0 +1,84 @@
# Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted readers)
io.disable_card_reader_emu=false
# Disable BIO2 emulation and enable usage of real BIO2 hardware
io.disable_bio2_emu=false
# Disables the poll limiter, warning very high CPU usage may arise
io.disable_poll_limiter=false
# Lightning cab mode (requires additional IO emulation)
io.lightning_mode=false
# Disable camera connection
io.disable_cams=true
# Disables the built in file hooks, requiring manual file creation
io.disable_file_hooks=false
# Turntable sensitivity multiplier (1.0 is default)
io.tt_multiplier=1.0
# Disables the camera emulation
cam.disable_emu=true
# Disable camera 1. Use, i.e., if you only have one camera and want it to be mapped to camera 2 ingame.
cam.disable_camera1=true
# Disable camera 2. Use, i.e., if you have more than one camera but only want to map camera 1 ingame.
cam.disable_camera2=false
# Override camera device ID detection (copy from device manager, do not escape)
cam.device_id1=
# Override camera device ID detection (copy from device manager, do not escape)
cam.device_id2=
# Run the game in a framed window (requires windowed option)
gfx.framed=true
# Run the game windowed
gfx.windowed=false
# Confine mouse cursor to window
gfx.confined=false
# Windowed width, -1 for default size
gfx.window_width=-1
# Windowed height, -1 for default size
gfx.window_height=-1
# Windowed X, -1 for default X position
gfx.window_x=-1
# Windowed Y, -1 for default Y position
gfx.window_y=-1
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
gfx.forced_refresh_rate=-1
# D3D9ex device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
gfx.device_adapter=-1
# Orientation to force monitor into, -1 to use default, 0, 1, 2, 3 to do 0, 90, 180, 270 degrees
gfx.force_orientation=-1
# Force a screen resolution (width), -1 to disable. Use this if the game does not auto detect your monitor's resolution properly, e.g. 1368x768 instead of 1280x720.
gfx.force_screen_res.width=-1
# Force a screen resolution (height), -1 to disable. Use this if the game does not auto detect your monitor's resolution properly, e.g. 1368x768 instead of 1280x720.
gfx.force_screen_res.height=-1
# IP of adapter to force override with
adapter.override_ip=
# Force ASIO audio mode/device (if applicable / TDJ default)
asio.force_asio=false
# Force WASAPI audio mode (if applicable / LDJ default)
asio.force_wasapi=true
# The ASIO device name to use
asio.device_name=XONAR SOUND CARD(64)

View File

@ -48,6 +48,8 @@ Available implementations that can be swapped out depending on which kind of IO
use:
- `iidxio`: Default implementation supporting keyboard, mouse and USB game controllers
- [iidxio-async](iidxhook/iidxio-async.md): Shim implementation that runs another iidxio implementation in a dedicated
thread
- [iidxio-bio2](iidxhook/iidxio-bio2.md): Support BIO2 hardware
- [iidxio-ezusb](iidxhook/iidxio-ezusb.md): Support C02 ezusb FX hardware
- [iidxio-ezusb2](iidxhook/iidxio-ezusb2.md): Support IO2 ezusb FX2 hardware

View File

@ -6,6 +6,7 @@ The following games are compatible with this version of iidxhook:
- BISTROVER
- CASTHOUR
- RESIDENT
- EPOLIS
The games must be bootstrapped using [launcher](../launcher.md).
@ -57,7 +58,7 @@ unpacked data looks like this:
- Unpack the package containing iidxhook9 into the root folder so iidxhook9.dll and all other
files are located in the same folder as *data*, *prop*, *bm2dx.dll*, etc.
- For version 30
- For version 30-31
- Unpack the package containing iidxhook9 into the `modules` folder so iidxhook9.dll and all other
files are located in the same folder as the game's DLLs, e.g. *bm2dx.dll*, etc.
@ -93,6 +94,12 @@ The syntax for the "key=value" is the same as in the config file. Make sure to h
However, if a parameter is specifed in the configuration file and as a command line argument, the
command line argument overrides the config file's value.
# Note on camhook
The cammera hook (camhook) is used to allow other class compliant cameras to be used. Depending on the variant of the game, you will need to select the correct camera port layout.
For original LDJ, this is always 0, for conversion kit LDJ and original TDJ-JA, this is 1, and for TDJ-JB this will be 2 (this case is rare / you will know if this is needed on your setup).
# Eamuse network setup
If you want to run the games online, you need a valid PCBID and the service URL. Open

View File

@ -0,0 +1,22 @@
# IIDXIO async API implementation
This implementation of the iidxio API is a shim library that takes another iidxio library and
runs the functions `iidx_io_ep1_send`, `iidx_io_ep2_recv` and `iidx_io_ep3_write_16seg` in a
dedicated thread. State synchronization to the getter and setter functions is also handled
transparently.
Usage of this **may** improve performance of certain iidxio implementations or when using them
in certain integrations, e.g. the send and receive functions of a iidxio implementation for some
target IO hardware calls are synchronous and expensive.
This is not a fix/solution to a badly implemented iidxio library with poor performance as it cannot
make it go faster and address potential latency issues, for example.
Use with caution and know why and when you need to use it.
## Setup
* Add `iidxio-async.dll` in the same folder as your `iidxhookX.dll`
* Rename your `iidxio.dll` to `iidxio-async-child.dll`
* Rename `iidxio-async.dll` to `iidxio.dll`
* Run the game

View File

@ -0,0 +1,27 @@
# D3D9 Monitor Check
A separate application to run the infamous IIDX “monitor check” without having to run the actual
game. The tool can be used to test measure the current avg. monitor refresh rate or debug/check if
that value is fluctuating for some reason.
The final avg. value that is provided at the end of the test can be used as input for other tooling
or settings (e.g. patching charts to a different refresh rate on older games with bemanitools).
Simply run the tool without any arguments to get a full synopsis with usage instructions.
## "Accuracy" remarks
The tool has been tested on an actual cabinet with `nvgpu` setting different custom timings. The
accuracy seems to be even higher than what IIDXs monitor check is actually showing. For example,
with a custom timing of 59.900 hz, this tool yields fairly accurate and stable avg. 59.902 hz.
The monitor check of IIDX 29 shows results of 59.8981 hz to 59.8997 hz on screen. As these are the
only visible values to the user, determining a specific (avg.) value that can be used as input for
other tooling or settings (e.g. patching charts to a different refresh rate on older games with
bemanitools) is difficult. This doesn't mean that the game's monitor checks are actually
inaccurate or wrong. Modern games with a built-in monitor check (starting IIDX 20) are syncing up
fine and don't need any further patching or modifications.
For older games, picking a value that is not as close as possible to an accurate avg. value can
easily lead to issues with sync. So it's recommended to use the d3d9-monitor-check tool to get the
most accurate value.

View File

@ -220,6 +220,9 @@ void property_file_write(struct property *prop, const char *path);
int property_set_flag(struct property *prop, int flags, int mask);
void property_destroy(struct property *prop);
avs_error property_get_error(struct property *prop);
void property_clear_error(struct property *prop);
int property_psmap_import(
struct property *prop,
struct property_node *root,

View File

@ -25,6 +25,8 @@ EXPORTS
property_destroy
property_file_write
property_insert_read
property_clear_error
property_get_error
property_mem_write
property_read_query_memsize
property_search

View File

@ -28,6 +28,8 @@ EXPORTS
property_destroy
property_file_write
property_insert_read
property_clear_error
property_get_error
property_mem_write
property_read_query_memsize
property_search

View File

@ -26,6 +26,8 @@ EXPORTS
property_desc_to_buffer @246 NONAME
property_destroy @247 NONAME
property_insert_read @255 NONAME
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_node_create @266 NONAME
property_node_datasize @267 NONAME
property_node_name @274 NONAME

View File

@ -25,6 +25,8 @@ EXPORTS
property_desc_to_buffer @201 NONAME
property_destroy @264 NONAME
property_insert_read @23 NONAME
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_node_create @316 NONAME
property_node_datasize @249 NONAME
property_node_name @255 NONAME

View File

@ -25,6 +25,8 @@ EXPORTS
property_desc_to_buffer @201 NONAME == XC058ba50000cd
property_destroy @264 NONAME == XC058ba500010f
property_insert_read @23 NONAME == XC058ba5000016
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_node_create @316 NONAME == XC058ba5000143
property_node_datasize @249 NONAME == XC058ba5000100
property_node_name @255 NONAME == XC058ba5000106

View File

@ -24,6 +24,8 @@ EXPORTS
property_desc_to_buffer @131 NONAME
property_destroy @130 NONAME
property_insert_read @133 NONAME
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_node_name @573 NONAME ==
property_node_read @573 NONAME ==
property_node_remove @148 NONAME

View File

@ -26,6 +26,8 @@ EXPORTS
property_desc_to_buffer @129 NONAME
property_destroy @128 NONAME
property_insert_read @131 NONAME
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_node_create @145 NONAME
property_node_name @150 NONAME
property_node_read @154 NONAME == XCd229cc0000f3

View File

@ -19,6 +19,8 @@ EXPORTS
property_destroy @125 NONAME
property_desc_to_buffer @126 NONAME
property_insert_read @128 NONAME
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_search @141 NONAME
property_node_create @142 NONAME
property_node_name @147 NONAME == XCnbrep7000092

View File

@ -19,6 +19,8 @@ EXPORTS
property_destroy @146 NONAME
property_desc_to_buffer @147 NONAME
property_insert_read @149 NONAME
property_clear_error @158 NONAME == XCnbrep700009d
property_get_error @159 NONAME == XCnbrep700009e
property_search @162 NONAME
property_node_create @163 NONAME
property_node_name @168 NONAME == XCnbrep70000a7

View File

@ -21,6 +21,8 @@ EXPORTS
property_destroy @146 NONAME
property_desc_to_buffer @147 NONAME
property_insert_read @149 NONAME
property_clear_error @158 NONAME == XCgsqzn000009d
property_get_error @159 NONAME == XCgsqzn000009e
property_search @162 NONAME
property_node_create @163 NONAME
property_node_name @168 NONAME == XCgsqzn00000a7

View File

@ -25,6 +25,8 @@ EXPORTS
property_destroy
property_file_write
property_insert_read
property_clear_error
property_get_error
property_mem_write
property_read_query_memsize
property_search

View File

@ -26,6 +26,8 @@ EXPORTS
property_desc_to_buffer @129 NONAME
property_destroy @128 NONAME
property_insert_read @131 NONAME
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_node_create @145 NONAME
property_node_name @150 NONAME
property_node_read @154 NONAME == XCd229cc0000f3

View File

@ -26,6 +26,8 @@ EXPORTS
property_desc_to_buffer @129 NONAME
property_destroy @128 NONAME
property_insert_read @131 NONAME
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_node_create @145 NONAME
property_node_name @573 NONAME ==
property_node_read @573 NONAME ==

View File

@ -19,6 +19,8 @@ EXPORTS
property_destroy @125 NONAME
property_desc_to_buffer @126 NONAME
property_insert_read @128 NONAME
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_search @141 NONAME
property_node_create @142 NONAME
property_node_name @147 NONAME == XCnbrep7000092

View File

@ -19,12 +19,14 @@ EXPORTS
property_destroy @146 NONAME
property_desc_to_buffer @147 NONAME
property_insert_read @149 NONAME
property_clear_error @158 NONAME == XCnbrep700009d
property_get_error @159 NONAME == XCnbrep700009e
property_search @162 NONAME
property_node_create @163 NONAME
property_node_name @168 NONAME == XCnbrep70000a7
property_node_remove @164 NONAME
property_node_type @169 NONAME == XCnbrep70000a8
property_node_clone @165 NONAME
property_node_clone @165 NONAME == XCnbrep70000a4
property_node_traversal @167 NONAME
property_node_refdata @166 NONAME == XCnbrep70000a5
property_node_datasize @171 NONAME == XCnbrep70000aa

View File

@ -21,6 +21,8 @@ EXPORTS
property_destroy @146 NONAME
property_desc_to_buffer @147 NONAME
property_insert_read @149 NONAME
property_clear_error @158 NONAME == XCgsqzn000009d
property_get_error @159 NONAME == XCgsqzn000009e
property_search @162 NONAME
property_node_create @163 NONAME
property_node_name @168 NONAME == XCgsqzn00000a7

View File

@ -0,0 +1,947 @@
/*********************************************************************************************************\
|* *|
|* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. *|
|* SPDX-License-Identifier: MIT *|
|* *|
|* Permission is hereby granted, free of charge, to any person obtaining a *|
|* copy of this software and associated documentation files (the "Software"), *|
|* to deal in the Software without restriction, including without limitation *|
|* the rights to use, copy, modify, merge, publish, distribute, sublicense, *|
|* and/or sell copies of the Software, and to permit persons to whom the *|
|* Software is furnished to do so, subject to the following conditions: *|
|* *|
|* The above copyright notice and this permission notice shall be included in *|
|* all copies or substantial portions of the Software. *|
|* *|
|* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *|
|* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *|
|* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *|
|* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *|
|* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *|
|* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *|
|* DEALINGS IN THE SOFTWARE. *|
|* *|
|* *|
\*********************************************************************************************************/
#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_CPL_GDI_COMPATIBILITY g_valuesOGL_CPL_GDI_COMPATIBILITY[OGL_CPL_GDI_COMPATIBILITY_NUM_VALUES] =
{
OGL_CPL_GDI_COMPATIBILITY_PREFER_DISABLED,
OGL_CPL_GDI_COMPATIBILITY_PREFER_ENABLED,
OGL_CPL_GDI_COMPATIBILITY_AUTO,
};
EValues_OGL_CPL_PREFER_DXPRESENT g_valuesOGL_CPL_PREFER_DXPRESENT[OGL_CPL_PREFER_DXPRESENT_NUM_VALUES] =
{
OGL_CPL_PREFER_DXPRESENT_PREFER_DISABLED,
OGL_CPL_PREFER_DXPRESENT_PREFER_ENABLED,
OGL_CPL_PREFER_DXPRESENT_AUTO,
};
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_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_SLI_MULTICAST g_valuesOGL_SLI_MULTICAST[OGL_SLI_MULTICAST_NUM_VALUES] =
{
OGL_SLI_MULTICAST_DISABLE,
OGL_SLI_MULTICAST_ENABLE,
OGL_SLI_MULTICAST_FORCE_DISABLE,
OGL_SLI_MULTICAST_ALLOW_MOSAIC,
};
EValues_OGL_THREAD_CONTROL g_valuesOGL_THREAD_CONTROL[OGL_THREAD_CONTROL_NUM_VALUES] =
{
OGL_THREAD_CONTROL_ENABLE,
OGL_THREAD_CONTROL_DISABLE,
};
EValues_OGL_TMON_LEVEL g_valuesOGL_TMON_LEVEL[OGL_TMON_LEVEL_NUM_VALUES] =
{
OGL_TMON_LEVEL_DISABLE,
OGL_TMON_LEVEL_CRITICAL,
OGL_TMON_LEVEL_WARNING,
OGL_TMON_LEVEL_INFORMATION,
OGL_TMON_LEVEL_MOST,
OGL_TMON_LEVEL_VERBOSE,
};
EValues_OGL_TRIPLE_BUFFER g_valuesOGL_TRIPLE_BUFFER[OGL_TRIPLE_BUFFER_NUM_VALUES] =
{
OGL_TRIPLE_BUFFER_DISABLED,
OGL_TRIPLE_BUFFER_ENABLED,
};
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_ANSEL_ALLOW g_valuesANSEL_ALLOW[ANSEL_ALLOW_NUM_VALUES] =
{
ANSEL_ALLOW_DISALLOWED,
ANSEL_ALLOW_ALLOWED,
};
EValues_ANSEL_ALLOWLISTED g_valuesANSEL_ALLOWLISTED[ANSEL_ALLOWLISTED_NUM_VALUES] =
{
ANSEL_ALLOWLISTED_DISALLOWED,
ANSEL_ALLOWLISTED_ALLOWED,
};
EValues_ANSEL_ENABLE g_valuesANSEL_ENABLE[ANSEL_ENABLE_NUM_VALUES] =
{
ANSEL_ENABLE_OFF,
ANSEL_ENABLE_ON,
};
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_BATTERY_BOOST_APP_FPS g_valuesBATTERY_BOOST_APP_FPS[BATTERY_BOOST_APP_FPS_NUM_VALUES] =
{
BATTERY_BOOST_APP_FPS_MIN,
BATTERY_BOOST_APP_FPS_MAX,
BATTERY_BOOST_APP_FPS_NO_OVERRIDE,
};
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_EXTERNAL_QUIET_MODE g_valuesEXTERNAL_QUIET_MODE[EXTERNAL_QUIET_MODE_NUM_VALUES] =
{
EXTERNAL_QUIET_MODE_ON,
EXTERNAL_QUIET_MODE_OFF,
};
EValues_FRL_FPS g_valuesFRL_FPS[FRL_FPS_NUM_VALUES] =
{
FRL_FPS_DISABLED,
FRL_FPS_MIN,
FRL_FPS_MAX,
};
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_LATENCY_INDICATOR_AUTOALIGN g_valuesLATENCY_INDICATOR_AUTOALIGN[LATENCY_INDICATOR_AUTOALIGN_NUM_VALUES] =
{
LATENCY_INDICATOR_AUTOALIGN_DISABLED,
LATENCY_INDICATOR_AUTOALIGN_ENABLED,
};
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_OPTIMAL_POWER,
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_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_RESERVED1,
SHIM_RENDERING_OPTIONS_ENABLE_DWM_ASYNC_PRESENT,
SHIM_RENDERING_OPTIONS_RESERVED2,
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,
SHIM_RENDERING_OPTIONS_EXPLICIT_ADAPTER_OPTED_BY_APP,
SHIM_RENDERING_OPTIONS_ALLOW_DYNAMIC_DISPLAY_MUX_SWITCH,
SHIM_RENDERING_OPTIONS_DISALLOW_DYNAMIC_DISPLAY_MUX_SWITCH,
SHIM_RENDERING_OPTIONS_DISABLE_TURING_POWER_POLICY,
SHIM_RENDERING_OPTIONS_ALLOW_DYNAMIC_DISPLAY_MUX_SWITCH_MDM,
SHIM_RENDERING_OPTIONS_DISALLOW_DYNAMIC_DISPLAY_MUX_SWITCH_MDM,
};
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_DP_INBAND,
WKS_API_STEREO_MODE_USE_HW_DEFAULT,
WKS_API_STEREO_MODE_DEFAULT_GL,
};
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,
WKS_STEREO_SWAP_MODE_PER_EYE_FOR_SWAP_GROUP,
};
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_EXPORT_PERF_COUNTERS_DX9_ONLY g_valuesEXPORT_PERF_COUNTERS_DX9_ONLY[EXPORT_PERF_COUNTERS_DX9_ONLY_NUM_VALUES] =
{
EXPORT_PERF_COUNTERS_DX9_ONLY_OFF,
EXPORT_PERF_COUNTERS_DX9_ONLY_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_SHADERDISKCACHE_MAX_SIZE g_valuesPS_SHADERDISKCACHE_MAX_SIZE[PS_SHADERDISKCACHE_MAX_SIZE_NUM_VALUES] =
{
PS_SHADERDISKCACHE_MAX_SIZE_MIN,
PS_SHADERDISKCACHE_MAX_SIZE_MAX,
};
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_QUALITY_ENHANCEMENT_SUBSTITUTION g_valuesQUALITY_ENHANCEMENT_SUBSTITUTION[QUALITY_ENHANCEMENT_SUBSTITUTION_NUM_VALUES] =
{
QUALITY_ENHANCEMENT_SUBSTITUTION_NO_SUBSTITUTION,
QUALITY_ENHANCEMENT_SUBSTITUTION_HIGHQUALITY_BECOMES_QUALITY,
};
EValues_REFRESH_RATE_OVERRIDE g_valuesREFRESH_RATE_OVERRIDE[REFRESH_RATE_OVERRIDE_NUM_VALUES] =
{
REFRESH_RATE_OVERRIDE_APPLICATION_CONTROLLED,
REFRESH_RATE_OVERRIDE_HIGHEST_AVAILABLE,
REFRESH_RATE_OVERRIDE_LOW_LATENCY_RR_MASK,
};
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,
VSYNCMODE_VIRTUAL,
};
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_CPL_GDI_COMPATIBILITY_ID, OGL_CPL_GDI_COMPATIBILITY_STRING, 3, (NvU32 *)g_valuesOGL_CPL_GDI_COMPATIBILITY, OGL_CPL_GDI_COMPATIBILITY_AUTO},
{OGL_CPL_PREFER_DXPRESENT_ID, OGL_CPL_PREFER_DXPRESENT_STRING, 3, (NvU32 *)g_valuesOGL_CPL_PREFER_DXPRESENT, OGL_CPL_PREFER_DXPRESENT_AUTO},
{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_ALL},
{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_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_SLI_MULTICAST_ID, OGL_SLI_MULTICAST_STRING, 4, (NvU32 *)g_valuesOGL_SLI_MULTICAST, OGL_SLI_MULTICAST_DISABLE},
{OGL_THREAD_CONTROL_ID, OGL_THREAD_CONTROL_STRING, 2, (NvU32 *)g_valuesOGL_THREAD_CONTROL, 0x00000000},
{OGL_TMON_LEVEL_ID, OGL_TMON_LEVEL_STRING, 6, (NvU32 *)g_valuesOGL_TMON_LEVEL, OGL_TMON_LEVEL_MOST},
{OGL_TRIPLE_BUFFER_ID, OGL_TRIPLE_BUFFER_STRING, 2, (NvU32 *)g_valuesOGL_TRIPLE_BUFFER, OGL_TRIPLE_BUFFER_DISABLED},
{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},
{ANSEL_ALLOW_ID, ANSEL_ALLOW_STRING, 2, (NvU32 *)g_valuesANSEL_ALLOW, ANSEL_ALLOW_ALLOWED},
{ANSEL_ALLOWLISTED_ID, ANSEL_ALLOWLISTED_STRING, 2, (NvU32 *)g_valuesANSEL_ALLOWLISTED, ANSEL_ALLOWLISTED_DISALLOWED},
{ANSEL_ENABLE_ID, ANSEL_ENABLE_STRING, 2, (NvU32 *)g_valuesANSEL_ENABLE, ANSEL_ENABLE_ON},
{APPIDLE_DYNAMIC_FRL_FPS_ID, APPIDLE_DYNAMIC_FRL_FPS_STRING, 0, NULL, 0x00000000},
{APPIDLE_DYNAMIC_FRL_THRESHOLD_TIME_ID, APPIDLE_DYNAMIC_FRL_THRESHOLD_TIME_STRING, 0, NULL, 0x00000000},
{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},
{BATTERY_BOOST_APP_FPS_ID, BATTERY_BOOST_APP_FPS_STRING, 3, (NvU32 *)g_valuesBATTERY_BOOST_APP_FPS, BATTERY_BOOST_APP_FPS_NO_OVERRIDE},
{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},
{EXTERNAL_QUIET_MODE_ID, EXTERNAL_QUIET_MODE_STRING, 2, (NvU32 *)g_valuesEXTERNAL_QUIET_MODE, EXTERNAL_QUIET_MODE_OFF},
{FRL_FPS_ID, FRL_FPS_STRING, 3, (NvU32 *)g_valuesFRL_FPS, FRL_FPS_DISABLED},
{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},
{LATENCY_INDICATOR_AUTOALIGN_ID, LATENCY_INDICATOR_AUTOALIGN_STRING, 2, (NvU32 *)g_valuesLATENCY_INDICATOR_AUTOALIGN, LATENCY_INDICATOR_AUTOALIGN_ENABLED},
{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, 8, (NvU32 *)g_valuesPREFERRED_PSTATE, PREFERRED_PSTATE_OPTIMAL_POWER},
{PREVENT_UI_AF_OVERRIDE_ID, PREVENT_UI_AF_OVERRIDE_STRING, 2, (NvU32 *)g_valuesPREVENT_UI_AF_OVERRIDE, PREVENT_UI_AF_OVERRIDE_OFF},
{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, 30, (NvU32 *)g_valuesSHIM_RENDERING_OPTIONS, 0x00000000},
{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, 25, (NvU32 *)g_valuesWKS_API_STEREO_MODE, WKS_API_STEREO_MODE_SHUTTER_GLASSES},
{WKS_STEREO_DONGLE_SUPPORT_ID, WKS_STEREO_DONGLE_SUPPORT_STRING, 3, (NvU32 *)g_valuesWKS_STEREO_DONGLE_SUPPORT, WKS_STEREO_DONGLE_SUPPORT_DAC},
{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, 5, (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},
{EXPORT_PERF_COUNTERS_DX9_ONLY_ID, EXPORT_PERF_COUNTERS_DX9_ONLY_STRING, 2, (NvU32 *)g_valuesEXPORT_PERF_COUNTERS_DX9_ONLY, EXPORT_PERF_COUNTERS_DX9_ONLY_OFF},
{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, PS_SHADERDISKCACHE_ON},
{PS_SHADERDISKCACHE_MAX_SIZE_ID, PS_SHADERDISKCACHE_MAX_SIZE_STRING, 2, (NvU32 *)g_valuesPS_SHADERDISKCACHE_MAX_SIZE, 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},
{QUALITY_ENHANCEMENT_SUBSTITUTION_ID, QUALITY_ENHANCEMENT_SUBSTITUTION_STRING, 2, (NvU32 *)g_valuesQUALITY_ENHANCEMENT_SUBSTITUTION, QUALITY_ENHANCEMENT_SUBSTITUTION_NO_SUBSTITUTION},
{REFRESH_RATE_OVERRIDE_ID, REFRESH_RATE_OVERRIDE_STRING, 3, (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, 7, (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""},
{PS_SHADERDISKCACHE_DLL_PATH_WCHAR_ID, PS_SHADERDISKCACHE_DLL_PATH_WCHAR_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

@ -0,0 +1,758 @@
/*********************************************************************************************************\
|* *|
|* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. *|
|* SPDX-License-Identifier: MIT *|
|* *|
|* Permission is hereby granted, free of charge, to any person obtaining a *|
|* copy of this software and associated documentation files (the "Software"), *|
|* to deal in the Software without restriction, including without limitation *|
|* the rights to use, copy, modify, merge, publish, distribute, sublicense, *|
|* and/or sell copies of the Software, and to permit persons to whom the *|
|* Software is furnished to do so, subject to the following conditions: *|
|* *|
|* The above copyright notice and this permission notice shall be included in *|
|* all copies or substantial portions of the Software. *|
|* *|
|* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *|
|* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *|
|* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *|
|* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *|
|* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *|
|* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *|
|* DEALINGS IN THE SOFTWARE. *|
|* *|
|* *|
\*********************************************************************************************************/
////////////////////////// NVIDIA SHADER EXTENSIONS /////////////////
// internal functions
// Functions in this file are not expected to be called by apps directly
#include "imports/nvapi/nvShaderExtnEnums.h"
struct NvShaderExtnStruct
{
uint opcode; // opcode
uint rid; // resource ID
uint sid; // sampler ID
uint4 dst1u; // destination operand 1 (for instructions that need extra destination operands)
uint4 src3u; // source operand 3
uint4 src4u; // source operand 4
uint4 src5u; // source operand 5
uint4 src0u; // uint source operand 0
uint4 src1u; // uint source operand 0
uint4 src2u; // uint source operand 0
uint4 dst0u; // uint destination operand
uint markUavRef; // the next store to UAV is fake and is used only to identify the uav slot
uint numOutputsForIncCounter; // Used for output to IncrementCounter
float padding1[27]; // struct size: 256 bytes
};
// RW structured buffer for Nvidia shader extensions
// Application needs to define NV_SHADER_EXTN_SLOT as a unused slot, which should be
// set using NvAPI_D3D11_SetNvShaderExtnSlot() call before creating the first shader that
// uses nvidia shader extensions. E.g before including this file in shader define it as:
// #define NV_SHADER_EXTN_SLOT u7
// For SM5.1, application needs to define NV_SHADER_EXTN_REGISTER_SPACE as register space
// E.g. before including this file in shader define it as:
// #define NV_SHADER_EXTN_REGISTER_SPACE space2
// Note that other operations to this UAV will be ignored so application
// should bind a null resource
#ifdef NV_SHADER_EXTN_REGISTER_SPACE
RWStructuredBuffer<NvShaderExtnStruct> g_NvidiaExt : register( NV_SHADER_EXTN_SLOT, NV_SHADER_EXTN_REGISTER_SPACE );
#else
RWStructuredBuffer<NvShaderExtnStruct> g_NvidiaExt : register( NV_SHADER_EXTN_SLOT );
#endif
//----------------------------------------------------------------------------//
// the exposed SHFL instructions accept a mask parameter in src2
// To compute lane mask from width of segment:
// minLaneID : currentLaneId & src2[12:8]
// maxLaneID : minLaneId | (src2[4:0] & ~src2[12:8])
// where [minLaneId, maxLaneId] defines the segment where currentLaneId belongs
// we always set src2[4:0] to 11111 (0x1F), and set src2[12:8] as (32 - width)
int __NvGetShflMaskFromWidth(uint width)
{
return ((NV_WARP_SIZE - width) << 8) | 0x1F;
}
//----------------------------------------------------------------------------//
void __NvReferenceUAVForOp(RWByteAddressBuffer uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav.Store(index, 0);
}
void __NvReferenceUAVForOp(RWTexture1D<float2> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[index] = float2(0,0);
}
void __NvReferenceUAVForOp(RWTexture2D<float2> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint2(index,index)] = float2(0,0);
}
void __NvReferenceUAVForOp(RWTexture3D<float2> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint3(index,index,index)] = float2(0,0);
}
void __NvReferenceUAVForOp(RWTexture1D<float4> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[index] = float4(0,0,0,0);
}
void __NvReferenceUAVForOp(RWTexture2D<float4> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint2(index,index)] = float4(0,0,0,0);
}
void __NvReferenceUAVForOp(RWTexture3D<float4> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint3(index,index,index)] = float4(0,0,0,0);
}
void __NvReferenceUAVForOp(RWTexture1D<float> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[index] = 0.0f;
}
void __NvReferenceUAVForOp(RWTexture2D<float> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint2(index,index)] = 0.0f;
}
void __NvReferenceUAVForOp(RWTexture3D<float> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint3(index,index,index)] = 0.0f;
}
void __NvReferenceUAVForOp(RWTexture1D<uint2> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[index] = uint2(0,0);
}
void __NvReferenceUAVForOp(RWTexture2D<uint2> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint2(index,index)] = uint2(0,0);
}
void __NvReferenceUAVForOp(RWTexture3D<uint2> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint3(index,index,index)] = uint2(0,0);
}
void __NvReferenceUAVForOp(RWTexture1D<uint4> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[index] = uint4(0,0,0,0);
}
void __NvReferenceUAVForOp(RWTexture2D<uint4> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint2(index,index)] = uint4(0,0,0,0);
}
void __NvReferenceUAVForOp(RWTexture3D<uint4> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint3(index,index,index)] = uint4(0,0,0,0);
}
void __NvReferenceUAVForOp(RWTexture1D<uint> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[index] = 0;
}
void __NvReferenceUAVForOp(RWTexture2D<uint> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint2(index,index)] = 0;
}
void __NvReferenceUAVForOp(RWTexture3D<uint> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint3(index,index,index)] = 0;
}
void __NvReferenceUAVForOp(RWTexture1D<int2> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[index] = int2(0,0);
}
void __NvReferenceUAVForOp(RWTexture2D<int2> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint2(index,index)] = int2(0,0);
}
void __NvReferenceUAVForOp(RWTexture3D<int2> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint3(index,index,index)] = int2(0,0);
}
void __NvReferenceUAVForOp(RWTexture1D<int4> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[index] = int4(0,0,0,0);
}
void __NvReferenceUAVForOp(RWTexture2D<int4> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint2(index,index)] = int4(0,0,0,0);
}
void __NvReferenceUAVForOp(RWTexture3D<int4> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint3(index,index,index)] = int4(0,0,0,0);
}
void __NvReferenceUAVForOp(RWTexture1D<int> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[index] = 0;
}
void __NvReferenceUAVForOp(RWTexture2D<int> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint2(index,index)] = 0;
}
void __NvReferenceUAVForOp(RWTexture3D<int> uav)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].markUavRef = 1;
uav[uint3(index,index,index)] = 0;
}
//----------------------------------------------------------------------------//
// ATOMIC op sub-opcodes
#define NV_EXTN_ATOM_AND 0
#define NV_EXTN_ATOM_OR 1
#define NV_EXTN_ATOM_XOR 2
#define NV_EXTN_ATOM_ADD 3
#define NV_EXTN_ATOM_MAX 6
#define NV_EXTN_ATOM_MIN 7
#define NV_EXTN_ATOM_SWAP 8
#define NV_EXTN_ATOM_CAS 9
//----------------------------------------------------------------------------//
// performs Atomic operation on two consecutive fp16 values in the given UAV
// the uint paramater 'fp16x2Val' is treated as two fp16 values
// the passed sub-opcode 'op' should be an immediate constant
// byteAddress must be multiple of 4
// the returned value are the two fp16 values packed into a single uint
uint __NvAtomicOpFP16x2(RWByteAddressBuffer uav, uint byteAddress, uint fp16x2Val, uint atomicOpType)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = byteAddress;
g_NvidiaExt[index].src1u.x = fp16x2Val;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC;
return g_NvidiaExt[index].dst0u.x;
}
//----------------------------------------------------------------------------//
// performs Atomic operation on a R16G16_FLOAT UAV at the given address
// the uint paramater 'fp16x2Val' is treated as two fp16 values
// the passed sub-opcode 'op' should be an immediate constant
// the returned value are the two fp16 values (.x and .y components) packed into a single uint
// Warning: Behaviour of these set of functions is undefined if the UAV is not
// of R16G16_FLOAT format (might result in app crash or TDR)
uint __NvAtomicOpFP16x2(RWTexture1D<float2> uav, uint address, uint fp16x2Val, uint atomicOpType)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = address;
g_NvidiaExt[index].src1u.x = fp16x2Val;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC;
return g_NvidiaExt[index].dst0u.x;
}
uint __NvAtomicOpFP16x2(RWTexture2D<float2> uav, uint2 address, uint fp16x2Val, uint atomicOpType)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.xy = address;
g_NvidiaExt[index].src1u.x = fp16x2Val;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC;
return g_NvidiaExt[index].dst0u.x;
}
uint __NvAtomicOpFP16x2(RWTexture3D<float2> uav, uint3 address, uint fp16x2Val, uint atomicOpType)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.xyz = address;
g_NvidiaExt[index].src1u.x = fp16x2Val;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC;
return g_NvidiaExt[index].dst0u.x;
}
//----------------------------------------------------------------------------//
// performs Atomic operation on a R16G16B16A16_FLOAT UAV at the given address
// the uint2 paramater 'fp16x2Val' is treated as four fp16 values
// i.e, fp16x2Val.x = uav.xy and fp16x2Val.y = uav.yz
// the passed sub-opcode 'op' should be an immediate constant
// the returned value are the four fp16 values (.xyzw components) packed into uint2
// Warning: Behaviour of these set of functions is undefined if the UAV is not
// of R16G16B16A16_FLOAT format (might result in app crash or TDR)
uint2 __NvAtomicOpFP16x2(RWTexture1D<float4> uav, uint address, uint2 fp16x2Val, uint atomicOpType)
{
__NvReferenceUAVForOp(uav);
// break it down into two fp16x2 atomic ops
uint2 retVal;
// first op has x-coordinate = x * 2
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = address * 2;
g_NvidiaExt[index].src1u.x = fp16x2Val.x;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC;
retVal.x = g_NvidiaExt[index].dst0u.x;
// second op has x-coordinate = x * 2 + 1
index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = address * 2 + 1;
g_NvidiaExt[index].src1u.x = fp16x2Val.y;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC;
retVal.y = g_NvidiaExt[index].dst0u.x;
return retVal;
}
uint2 __NvAtomicOpFP16x2(RWTexture2D<float4> uav, uint2 address, uint2 fp16x2Val, uint atomicOpType)
{
__NvReferenceUAVForOp(uav);
// break it down into two fp16x2 atomic ops
uint2 retVal;
// first op has x-coordinate = x * 2
uint2 addressTemp = uint2(address.x * 2, address.y);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.xy = addressTemp;
g_NvidiaExt[index].src1u.x = fp16x2Val.x;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC;
retVal.x = g_NvidiaExt[index].dst0u.x;
// second op has x-coordinate = x * 2 + 1
addressTemp.x++;
index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.xy = addressTemp;
g_NvidiaExt[index].src1u.x = fp16x2Val.y;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC;
retVal.y = g_NvidiaExt[index].dst0u.x;
return retVal;
}
uint2 __NvAtomicOpFP16x2(RWTexture3D<float4> uav, uint3 address, uint2 fp16x2Val, uint atomicOpType)
{
__NvReferenceUAVForOp(uav);
// break it down into two fp16x2 atomic ops
uint2 retVal;
// first op has x-coordinate = x * 2
uint3 addressTemp = uint3(address.x * 2, address.y, address.z);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.xyz = addressTemp;
g_NvidiaExt[index].src1u.x = fp16x2Val.x;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC;
retVal.x = g_NvidiaExt[index].dst0u.x;
// second op has x-coordinate = x * 2 + 1
addressTemp.x++;
index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.xyz = addressTemp;
g_NvidiaExt[index].src1u.x = fp16x2Val.y;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC;
retVal.y = g_NvidiaExt[index].dst0u.x;
return retVal;
}
uint __fp32x2Tofp16x2(float2 val)
{
return (f32tof16(val.y)<<16) | f32tof16(val.x) ;
}
uint2 __fp32x4Tofp16x4(float4 val)
{
return uint2( (f32tof16(val.y)<<16) | f32tof16(val.x), (f32tof16(val.w)<<16) | f32tof16(val.z) ) ;
}
//----------------------------------------------------------------------------//
// FP32 Atomic functions
// performs Atomic operation treating the uav as float (fp32) values
// the passed sub-opcode 'op' should be an immediate constant
// byteAddress must be multiple of 4
float __NvAtomicAddFP32(RWByteAddressBuffer uav, uint byteAddress, float val)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = byteAddress;
g_NvidiaExt[index].src1u.x = asuint(val); // passing as uint to make it more convinient for the driver to translate
g_NvidiaExt[index].src2u.x = NV_EXTN_ATOM_ADD;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP32_ATOMIC;
return asfloat(g_NvidiaExt[index].dst0u.x);
}
float __NvAtomicAddFP32(RWTexture1D<float> uav, uint address, float val)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = address;
g_NvidiaExt[index].src1u.x = asuint(val);
g_NvidiaExt[index].src2u.x = NV_EXTN_ATOM_ADD;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP32_ATOMIC;
return asfloat(g_NvidiaExt[index].dst0u.x);
}
float __NvAtomicAddFP32(RWTexture2D<float> uav, uint2 address, float val)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.xy = address;
g_NvidiaExt[index].src1u.x = asuint(val);
g_NvidiaExt[index].src2u.x = NV_EXTN_ATOM_ADD;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP32_ATOMIC;
return asfloat(g_NvidiaExt[index].dst0u.x);
}
float __NvAtomicAddFP32(RWTexture3D<float> uav, uint3 address, float val)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.xyz = address;
g_NvidiaExt[index].src1u.x = asuint(val);
g_NvidiaExt[index].src2u.x = NV_EXTN_ATOM_ADD;
g_NvidiaExt[index].opcode = NV_EXTN_OP_FP32_ATOMIC;
return asfloat(g_NvidiaExt[index].dst0u.x);
}
//----------------------------------------------------------------------------//
// UINT64 Atmoic Functions
// The functions below performs atomic operation on the given UAV treating the value as uint64
// byteAddress must be multiple of 8
// The returned value is the value present in memory location before the atomic operation
// uint2 vector type is used to represent a single uint64 value with the x component containing the low 32 bits and y component the high 32 bits.
uint2 __NvAtomicCompareExchangeUINT64(RWByteAddressBuffer uav, uint byteAddress, uint2 compareValue, uint2 value)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = byteAddress;
g_NvidiaExt[index].src1u.xy = compareValue;
g_NvidiaExt[index].src1u.zw = value;
g_NvidiaExt[index].src2u.x = NV_EXTN_ATOM_CAS;
g_NvidiaExt[index].opcode = NV_EXTN_OP_UINT64_ATOMIC;
return g_NvidiaExt[index].dst0u.xy;
}
uint2 __NvAtomicOpUINT64(RWByteAddressBuffer uav, uint byteAddress, uint2 value, uint atomicOpType)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = byteAddress;
g_NvidiaExt[index].src1u.xy = value;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_UINT64_ATOMIC;
return g_NvidiaExt[index].dst0u.xy;
}
uint2 __NvAtomicCompareExchangeUINT64(RWTexture1D<uint2> uav, uint address, uint2 compareValue, uint2 value)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = address;
g_NvidiaExt[index].src1u.xy = compareValue;
g_NvidiaExt[index].src1u.zw = value;
g_NvidiaExt[index].src2u.x = NV_EXTN_ATOM_CAS;
g_NvidiaExt[index].opcode = NV_EXTN_OP_UINT64_ATOMIC;
return g_NvidiaExt[index].dst0u.xy;
}
uint2 __NvAtomicOpUINT64(RWTexture1D<uint2> uav, uint address, uint2 value, uint atomicOpType)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = address;
g_NvidiaExt[index].src1u.xy = value;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_UINT64_ATOMIC;
return g_NvidiaExt[index].dst0u.xy;
}
uint2 __NvAtomicCompareExchangeUINT64(RWTexture2D<uint2> uav, uint2 address, uint2 compareValue, uint2 value)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.xy = address;
g_NvidiaExt[index].src1u.xy = compareValue;
g_NvidiaExt[index].src1u.zw = value;
g_NvidiaExt[index].src2u.x = NV_EXTN_ATOM_CAS;
g_NvidiaExt[index].opcode = NV_EXTN_OP_UINT64_ATOMIC;
return g_NvidiaExt[index].dst0u.xy;
}
uint2 __NvAtomicOpUINT64(RWTexture2D<uint2> uav, uint2 address, uint2 value, uint atomicOpType)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.xy = address;
g_NvidiaExt[index].src1u.xy = value;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_UINT64_ATOMIC;
return g_NvidiaExt[index].dst0u.xy;
}
uint2 __NvAtomicCompareExchangeUINT64(RWTexture3D<uint2> uav, uint3 address, uint2 compareValue, uint2 value)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.xyz = address;
g_NvidiaExt[index].src1u.xy = compareValue;
g_NvidiaExt[index].src1u.zw = value;
g_NvidiaExt[index].src2u.x = NV_EXTN_ATOM_CAS;
g_NvidiaExt[index].opcode = NV_EXTN_OP_UINT64_ATOMIC;
return g_NvidiaExt[index].dst0u.xy;
}
uint2 __NvAtomicOpUINT64(RWTexture3D<uint2> uav, uint3 address, uint2 value, uint atomicOpType)
{
__NvReferenceUAVForOp(uav);
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.xyz = address;
g_NvidiaExt[index].src1u.xy = value;
g_NvidiaExt[index].src2u.x = atomicOpType;
g_NvidiaExt[index].opcode = NV_EXTN_OP_UINT64_ATOMIC;
return g_NvidiaExt[index].dst0u.xy;
}
uint4 __NvFootprint(uint texSpace, uint texIndex, uint smpSpace, uint smpIndex, uint texType, float3 location, uint footprintmode, uint gran, int3 offset = int3(0, 0, 0))
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = texIndex;
g_NvidiaExt[index].src0u.y = smpIndex;
g_NvidiaExt[index].src1u.xyz = asuint(location);
g_NvidiaExt[index].src1u.w = gran;
g_NvidiaExt[index].src3u.x = texSpace;
g_NvidiaExt[index].src3u.y = smpSpace;
g_NvidiaExt[index].src3u.z = texType;
g_NvidiaExt[index].src3u.w = footprintmode;
g_NvidiaExt[index].src4u.xyz = asuint(offset);
g_NvidiaExt[index].opcode = NV_EXTN_OP_FOOTPRINT;
g_NvidiaExt[index].numOutputsForIncCounter = 4;
// result is returned as the return value of IncrementCounter on fake UAV slot
uint4 op;
op.x = g_NvidiaExt.IncrementCounter();
op.y = g_NvidiaExt.IncrementCounter();
op.z = g_NvidiaExt.IncrementCounter();
op.w = g_NvidiaExt.IncrementCounter();
return op;
}
uint4 __NvFootprintBias(uint texSpace, uint texIndex, uint smpSpace, uint smpIndex, uint texType, float3 location, uint footprintmode, uint gran, float bias, int3 offset = int3(0, 0, 0))
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = texIndex;
g_NvidiaExt[index].src0u.y = smpIndex;
g_NvidiaExt[index].src1u.xyz = asuint(location);
g_NvidiaExt[index].src1u.w = gran;
g_NvidiaExt[index].src2u.x = asuint(bias);
g_NvidiaExt[index].src3u.x = texSpace;
g_NvidiaExt[index].src3u.y = smpSpace;
g_NvidiaExt[index].src3u.z = texType;
g_NvidiaExt[index].src3u.w = footprintmode;
g_NvidiaExt[index].src4u.xyz = asuint(offset);
g_NvidiaExt[index].opcode = NV_EXTN_OP_FOOTPRINT_BIAS;
g_NvidiaExt[index].numOutputsForIncCounter = 4;
// result is returned as the return value of IncrementCounter on fake UAV slot
uint4 op;
op.x = g_NvidiaExt.IncrementCounter();
op.y = g_NvidiaExt.IncrementCounter();
op.z = g_NvidiaExt.IncrementCounter();
op.w = g_NvidiaExt.IncrementCounter();
return op;
}
uint4 __NvFootprintLevel(uint texSpace, uint texIndex, uint smpSpace, uint smpIndex, uint texType, float3 location, uint footprintmode, uint gran, float lodLevel, int3 offset = int3(0, 0, 0))
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = texIndex;
g_NvidiaExt[index].src0u.y = smpIndex;
g_NvidiaExt[index].src1u.xyz = asuint(location);
g_NvidiaExt[index].src1u.w = gran;
g_NvidiaExt[index].src2u.x = asuint(lodLevel);
g_NvidiaExt[index].src3u.x = texSpace;
g_NvidiaExt[index].src3u.y = smpSpace;
g_NvidiaExt[index].src3u.z = texType;
g_NvidiaExt[index].src3u.w = footprintmode;
g_NvidiaExt[index].src4u.xyz = asuint(offset);
g_NvidiaExt[index].opcode = NV_EXTN_OP_FOOTPRINT_LEVEL;
g_NvidiaExt[index].numOutputsForIncCounter = 4;
// result is returned as the return value of IncrementCounter on fake UAV slot
uint4 op;
op.x = g_NvidiaExt.IncrementCounter();
op.y = g_NvidiaExt.IncrementCounter();
op.z = g_NvidiaExt.IncrementCounter();
op.w = g_NvidiaExt.IncrementCounter();
return op;
}
uint4 __NvFootprintGrad(uint texSpace, uint texIndex, uint smpSpace, uint smpIndex, uint texType, float3 location, uint footprintmode, uint gran, float3 ddx, float3 ddy, int3 offset = int3(0, 0, 0))
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = texIndex;
g_NvidiaExt[index].src0u.y = smpIndex;
g_NvidiaExt[index].src1u.xyz = asuint(location);
g_NvidiaExt[index].src1u.w = gran;
g_NvidiaExt[index].src2u.xyz = asuint(ddx);
g_NvidiaExt[index].src5u.xyz = asuint(ddy);
g_NvidiaExt[index].src3u.x = texSpace;
g_NvidiaExt[index].src3u.y = smpSpace;
g_NvidiaExt[index].src3u.z = texType;
g_NvidiaExt[index].src3u.w = footprintmode;
g_NvidiaExt[index].src4u.xyz = asuint(offset);
g_NvidiaExt[index].opcode = NV_EXTN_OP_FOOTPRINT_GRAD;
g_NvidiaExt[index].numOutputsForIncCounter = 4;
// result is returned as the return value of IncrementCounter on fake UAV slot
uint4 op;
op.x = g_NvidiaExt.IncrementCounter();
op.y = g_NvidiaExt.IncrementCounter();
op.z = g_NvidiaExt.IncrementCounter();
op.w = g_NvidiaExt.IncrementCounter();
return op;
}
// returns value of special register - specify subopcode from any of NV_SPECIALOP_* specified in nvShaderExtnEnums.h - other opcodes undefined behavior
uint __NvGetSpecial(uint subOpCode)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].opcode = NV_EXTN_OP_GET_SPECIAL;
g_NvidiaExt[index].src0u.x = subOpCode;
return g_NvidiaExt.IncrementCounter();
}
// predicate is returned in laneValid indicating if srcLane is in range and val from specified lane is returned.
int __NvShflGeneric(int val, uint srcLane, uint maskClampVal, out uint laneValid)
{
uint index = g_NvidiaExt.IncrementCounter();
g_NvidiaExt[index].src0u.x = val; // variable to be shuffled
g_NvidiaExt[index].src0u.y = srcLane; // source lane
g_NvidiaExt[index].src0u.z = maskClampVal;
g_NvidiaExt[index].opcode = NV_EXTN_OP_SHFL_GENERIC;
g_NvidiaExt[index].numOutputsForIncCounter = 2;
laneValid = asuint(g_NvidiaExt.IncrementCounter());
return g_NvidiaExt.IncrementCounter();
}

View File

@ -0,0 +1,142 @@
/*********************************************************************************************************\
|* *|
|* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. *|
|* SPDX-License-Identifier: MIT *|
|* *|
|* Permission is hereby granted, free of charge, to any person obtaining a *|
|* copy of this software and associated documentation files (the "Software"), *|
|* to deal in the Software without restriction, including without limitation *|
|* the rights to use, copy, modify, merge, publish, distribute, sublicense, *|
|* and/or sell copies of the Software, and to permit persons to whom the *|
|* Software is furnished to do so, subject to the following conditions: *|
|* *|
|* The above copyright notice and this permission notice shall be included in *|
|* all copies or substantial portions of the Software. *|
|* *|
|* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *|
|* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *|
|* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *|
|* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *|
|* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *|
|* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *|
|* DEALINGS IN THE SOFTWARE. *|
|* *|
|* *|
\*********************************************************************************************************/
////////////////////////////////////////////////////////////////////////////////
////////////////////////// NVIDIA SHADER EXTENSIONS ////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// This file can be included both from HLSL shader code as well as C++ code.
// The app should call NvAPI_D3D11_IsNvShaderExtnOpCodeSupported() / NvAPI_D3D12_IsNvShaderExtnOpCodeSupported()
// to check for support for every nv shader extension opcode it plans to use
//----------------------------------------------------------------------------//
//---------------------------- NV Shader Extn Version -----------------------//
//----------------------------------------------------------------------------//
#define NV_SHADER_EXTN_VERSION 1
//----------------------------------------------------------------------------//
//---------------------------- Misc constants --------------------------------//
//----------------------------------------------------------------------------//
#define NV_WARP_SIZE 32
#define NV_WARP_SIZE_LOG2 5
//----------------------------------------------------------------------------//
//---------------------------- opCode constants ------------------------------//
//----------------------------------------------------------------------------//
#define NV_EXTN_OP_SHFL 1
#define NV_EXTN_OP_SHFL_UP 2
#define NV_EXTN_OP_SHFL_DOWN 3
#define NV_EXTN_OP_SHFL_XOR 4
#define NV_EXTN_OP_VOTE_ALL 5
#define NV_EXTN_OP_VOTE_ANY 6
#define NV_EXTN_OP_VOTE_BALLOT 7
#define NV_EXTN_OP_GET_LANE_ID 8
#define NV_EXTN_OP_FP16_ATOMIC 12
#define NV_EXTN_OP_FP32_ATOMIC 13
#define NV_EXTN_OP_GET_SPECIAL 19
#define NV_EXTN_OP_UINT64_ATOMIC 20
#define NV_EXTN_OP_MATCH_ANY 21
// FOOTPRINT - For Sample and SampleBias
#define NV_EXTN_OP_FOOTPRINT 28
#define NV_EXTN_OP_FOOTPRINT_BIAS 29
#define NV_EXTN_OP_GET_SHADING_RATE 30
// FOOTPRINT - For SampleLevel and SampleGrad
#define NV_EXTN_OP_FOOTPRINT_LEVEL 31
#define NV_EXTN_OP_FOOTPRINT_GRAD 32
// SHFL Generic
#define NV_EXTN_OP_SHFL_GENERIC 33
#define NV_EXTN_OP_VPRS_EVAL_ATTRIB_AT_SAMPLE 51
#define NV_EXTN_OP_VPRS_EVAL_ATTRIB_SNAPPED 52
// HitObject API
#define NV_EXTN_OP_HIT_OBJECT_TRACE_RAY 67
#define NV_EXTN_OP_HIT_OBJECT_MAKE_HIT 68
#define NV_EXTN_OP_HIT_OBJECT_MAKE_HIT_WITH_RECORD_INDEX 69
#define NV_EXTN_OP_HIT_OBJECT_MAKE_MISS 70
#define NV_EXTN_OP_HIT_OBJECT_REORDER_THREAD 71
#define NV_EXTN_OP_HIT_OBJECT_INVOKE 72
#define NV_EXTN_OP_HIT_OBJECT_IS_MISS 73
#define NV_EXTN_OP_HIT_OBJECT_GET_INSTANCE_ID 74
#define NV_EXTN_OP_HIT_OBJECT_GET_INSTANCE_INDEX 75
#define NV_EXTN_OP_HIT_OBJECT_GET_PRIMITIVE_INDEX 76
#define NV_EXTN_OP_HIT_OBJECT_GET_GEOMETRY_INDEX 77
#define NV_EXTN_OP_HIT_OBJECT_GET_HIT_KIND 78
#define NV_EXTN_OP_HIT_OBJECT_GET_RAY_DESC 79
#define NV_EXTN_OP_HIT_OBJECT_GET_ATTRIBUTES 80
#define NV_EXTN_OP_HIT_OBJECT_GET_SHADER_TABLE_INDEX 81
#define NV_EXTN_OP_HIT_OBJECT_LOAD_LOCAL_ROOT_TABLE_CONSTANT 82
#define NV_EXTN_OP_HIT_OBJECT_IS_HIT 83
#define NV_EXTN_OP_HIT_OBJECT_IS_NOP 84
#define NV_EXTN_OP_HIT_OBJECT_MAKE_NOP 85
// Micro-map API
#define NV_EXTN_OP_RT_TRIANGLE_OBJECT_POSITIONS 86
#define NV_EXTN_OP_RT_MICRO_TRIANGLE_OBJECT_POSITIONS 87
#define NV_EXTN_OP_RT_MICRO_TRIANGLE_BARYCENTRICS 88
#define NV_EXTN_OP_RT_IS_MICRO_TRIANGLE_HIT 89
#define NV_EXTN_OP_RT_IS_BACK_FACING 90
#define NV_EXTN_OP_RT_MICRO_VERTEX_OBJECT_POSITION 91
#define NV_EXTN_OP_RT_MICRO_VERTEX_BARYCENTRICS 92
//----------------------------------------------------------------------------//
//-------------------- GET_SPECIAL subOpCode constants -----------------------//
//----------------------------------------------------------------------------//
#define NV_SPECIALOP_THREADLTMASK 4
#define NV_SPECIALOP_FOOTPRINT_SINGLELOD_PRED 5
#define NV_SPECIALOP_GLOBAL_TIMER_LO 9
#define NV_SPECIALOP_GLOBAL_TIMER_HI 10
//----------------------------------------------------------------------------//
//----------------------------- Texture Types -------------------------------//
//----------------------------------------------------------------------------//
#define NV_EXTN_TEXTURE_1D 2
#define NV_EXTN_TEXTURE_1D_ARRAY 3
#define NV_EXTN_TEXTURE_2D 4
#define NV_EXTN_TEXTURE_2D_ARRAY 5
#define NV_EXTN_TEXTURE_3D 6
#define NV_EXTN_TEXTURE_CUBE 7
#define NV_EXTN_TEXTURE_CUBE_ARRAY 8
//---------------------------------------------------------------------------//
//----------------FOOTPRINT Enums for NvFootprint* extns---------------------//
//---------------------------------------------------------------------------//
#define NV_EXTN_FOOTPRINT_MODE_FINE 0
#define NV_EXTN_FOOTPRINT_MODE_COARSE 1

24002
src/imports/nvapi/nvapi.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,529 @@
/*********************************************************************************************************\
|* *|
|* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. *|
|* SPDX-License-Identifier: MIT *|
|* *|
|* Permission is hereby granted, free of charge, to any person obtaining a *|
|* copy of this software and associated documentation files (the "Software"), *|
|* to deal in the Software without restriction, including without limitation *|
|* the rights to use, copy, modify, merge, publish, distribute, sublicense, *|
|* and/or sell copies of the Software, and to permit persons to whom the *|
|* Software is furnished to do so, subject to the following conditions: *|
|* *|
|* The above copyright notice and this permission notice shall be included in *|
|* all copies or substantial portions of the Software. *|
|* *|
|* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *|
|* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *|
|* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *|
|* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *|
|* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *|
|* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *|
|* DEALINGS IN THE SOFTWARE. *|
|* *|
|* *|
\*********************************************************************************************************/
#ifndef _NVAPI_INTERFACE_H
#define _NVAPI_INTERFACE_H
struct NVAPI_INTERFACE_TABLE { const char * func; unsigned int id; };
struct NVAPI_INTERFACE_TABLE nvapi_interface_table[] =
{
{ "NvAPI_Initialize", 0x0150e828 },
{ "NvAPI_Unload", 0xd22bdd7e },
{ "NvAPI_GetErrorMessage", 0x6c2d048c },
{ "NvAPI_GetInterfaceVersionString", 0x01053fa5 },
{ "NvAPI_GPU_GetEDID", 0x37d32e69 },
{ "NvAPI_SetView", 0x0957d7b6 },
{ "NvAPI_SetViewEx", 0x06b89e68 },
{ "NvAPI_GetDisplayDriverVersion", 0xf951a4d1 },
{ "NvAPI_SYS_GetDriverAndBranchVersion", 0x2926aaad },
{ "NvAPI_GPU_GetMemoryInfo", 0x07f9b368 },
{ "NvAPI_GPU_GetMemoryInfoEx", 0xc0599498 },
{ "NvAPI_OGL_ExpertModeSet", 0x3805ef7a },
{ "NvAPI_OGL_ExpertModeGet", 0x22ed9516 },
{ "NvAPI_OGL_ExpertModeDefaultsSet", 0xb47a657e },
{ "NvAPI_OGL_ExpertModeDefaultsGet", 0xae921f12 },
{ "NvAPI_EnumPhysicalGPUs", 0xe5ac921f },
{ "NvAPI_EnumTCCPhysicalGPUs", 0xd9930b07 },
{ "NvAPI_EnumLogicalGPUs", 0x48b3ea59 },
{ "NvAPI_GetPhysicalGPUsFromDisplay", 0x34ef9506 },
{ "NvAPI_GetPhysicalGPUFromUnAttachedDisplay", 0x5018ed61 },
{ "NvAPI_GetLogicalGPUFromDisplay", 0xee1370cf },
{ "NvAPI_GetLogicalGPUFromPhysicalGPU", 0xadd604d1 },
{ "NvAPI_GetPhysicalGPUsFromLogicalGPU", 0xaea3fa32 },
{ "NvAPI_GetPhysicalGPUFromGPUID", 0x5380ad1a },
{ "NvAPI_GetGPUIDfromPhysicalGPU", 0x6533ea3e },
{ "NvAPI_GPU_GetShaderSubPipeCount", 0x0be17923 },
{ "NvAPI_GPU_GetGpuCoreCount", 0xc7026a87 },
{ "NvAPI_GPU_GetAllOutputs", 0x7d554f8e },
{ "NvAPI_GPU_GetConnectedOutputs", 0x1730bfc9 },
{ "NvAPI_GPU_GetConnectedSLIOutputs", 0x0680de09 },
{ "NvAPI_GPU_GetConnectedDisplayIds", 0x0078dba2 },
{ "NvAPI_GPU_GetAllDisplayIds", 0x785210a2 },
{ "NvAPI_GPU_GetConnectedOutputsWithLidState", 0xcf8caf39 },
{ "NvAPI_GPU_GetConnectedSLIOutputsWithLidState", 0x96043cc7 },
{ "NvAPI_GPU_GetSystemType", 0xbaaabfcc },
{ "NvAPI_GPU_GetActiveOutputs", 0xe3e89b6f },
{ "NvAPI_GPU_SetEDID", 0xe83d6456 },
{ "NvAPI_GPU_GetOutputType", 0x40a505e4 },
{ "NvAPI_GPU_ValidateOutputCombination", 0x34c9c2d4 },
{ "NvAPI_GPU_GetFullName", 0xceee8e9f },
{ "NvAPI_GPU_GetPCIIdentifiers", 0x2ddfb66e },
{ "NvAPI_GPU_GetGPUType", 0xc33baeb1 },
{ "NvAPI_GPU_GetBusType", 0x1bb18724 },
{ "NvAPI_GPU_GetBusId", 0x1be0b8e5 },
{ "NvAPI_GPU_GetBusSlotId", 0x2a0a350f },
{ "NvAPI_GPU_GetIRQ", 0xe4715417 },
{ "NvAPI_GPU_GetVbiosRevision", 0xacc3da0a },
{ "NvAPI_GPU_GetVbiosOEMRevision", 0x2d43fb31 },
{ "NvAPI_GPU_GetVbiosVersionString", 0xa561fd7d },
{ "NvAPI_GPU_GetAGPAperture", 0x6e042794 },
{ "NvAPI_GPU_GetCurrentAGPRate", 0xc74925a0 },
{ "NvAPI_GPU_GetCurrentPCIEDownstreamWidth", 0xd048c3b1 },
{ "NvAPI_GPU_GetPhysicalFrameBufferSize", 0x46fbeb03 },
{ "NvAPI_GPU_GetVirtualFrameBufferSize", 0x5a04b644 },
{ "NvAPI_GPU_GetQuadroStatus", 0xe332fa47 },
{ "NvAPI_GPU_GetBoardInfo", 0x22d54523 },
{ "NvAPI_GPU_GetRamBusWidth", 0x7975c581 },
{ "NvAPI_GPU_GetArchInfo", 0xd8265d24 },
{ "NvAPI_I2CRead", 0x2fde12c5 },
{ "NvAPI_I2CWrite", 0xe812eb07 },
{ "NvAPI_GPU_WorkstationFeatureSetup", 0x6c1f3fe4 },
{ "NvAPI_GPU_WorkstationFeatureQuery", 0x004537df },
{ "NvAPI_GPU_GetHDCPSupportStatus", 0xf089eef5 },
{ "NvAPI_GPU_CudaEnumComputeCapableGpus", 0x5786cc6e },
{ "NvAPI_GPU_GetTachReading", 0x5f608315 },
{ "NvAPI_GPU_GetECCStatusInfo", 0xca1ddaf3 },
{ "NvAPI_GPU_GetECCErrorInfo", 0xc71f85a6 },
{ "NvAPI_GPU_ResetECCErrorInfo", 0xc02eec20 },
{ "NvAPI_GPU_GetECCConfigurationInfo", 0x77a796f3 },
{ "NvAPI_GPU_SetECCConfiguration", 0x1cf639d9 },
{ "NvAPI_GPU_QueryWorkstationFeatureSupport", 0x80b1abb9 },
{ "NvAPI_GPU_SetScanoutIntensity", 0xa57457a4 },
{ "NvAPI_GPU_GetScanoutIntensityState", 0xe81ce836 },
{ "NvAPI_GPU_SetScanoutWarping", 0xb34bab4f },
{ "NvAPI_GPU_GetScanoutWarpingState", 0x6f5435af },
{ "NvAPI_GPU_SetScanoutCompositionParameter", 0xf898247d },
{ "NvAPI_GPU_GetScanoutCompositionParameter", 0x58fe51e6 },
{ "NvAPI_GPU_GetScanoutConfiguration", 0x6a9f5b63 },
{ "NvAPI_GPU_GetScanoutConfigurationEx", 0xe2e1e6f0 },
{ "NvAPI_GPU_GetAdapterIdFromPhysicalGpu", 0x0ff07fde },
{ "NvAPI_GPU_GetVirtualizationInfo", 0x44e022a9 },
{ "NvAPI_GPU_GetLogicalGpuInfo", 0x842b066e },
{ "NvAPI_GPU_GetLicensableFeatures", 0x3fc596aa },
{ "NvAPI_GPU_NVLINK_GetCaps", 0xbef1119d },
{ "NvAPI_GPU_NVLINK_GetStatus", 0xc72a38e3 },
{ "NvAPI_GPU_GetGPUInfo", 0xafd1b02c },
{ "NvAPI_GPU_GetVRReadyData", 0x81d629c5 },
{ "NvAPI_GPU_GetGspFeatures", 0x581c4391 },
{ "NvAPI_GPU_GetPerfDecreaseInfo", 0x7f7f4600 },
{ "NvAPI_GPU_GetPstatesInfoEx", 0x843c0256 },
{ "NvAPI_GPU_GetPstates20", 0x6ff81213 },
{ "NvAPI_GPU_GetCurrentPstate", 0x927da4f6 },
{ "NvAPI_GPU_GetDynamicPstatesInfoEx", 0x60ded2ed },
{ "NvAPI_GPU_GetThermalSettings", 0xe3640a56 },
{ "NvAPI_GPU_GetAllClockFrequencies", 0xdcb616c3 },
{ "NvAPI_GPU_QueryIlluminationSupport", 0xa629da31 },
{ "NvAPI_GPU_GetIllumination", 0x9a1b9365 },
{ "NvAPI_GPU_SetIllumination", 0x0254a187 },
{ "NvAPI_GPU_ClientIllumDevicesGetInfo", 0xd4100e58 },
{ "NvAPI_GPU_ClientIllumDevicesGetControl", 0x73c01d58 },
{ "NvAPI_GPU_ClientIllumDevicesSetControl", 0x57024c62 },
{ "NvAPI_GPU_ClientIllumZonesGetInfo", 0x4b81241b },
{ "NvAPI_GPU_ClientIllumZonesGetControl", 0x3dbf5764 },
{ "NvAPI_GPU_ClientIllumZonesSetControl", 0x197d065e },
{ "NvAPI_Event_RegisterCallback", 0xe6dbea69 },
{ "NvAPI_Event_UnregisterCallback", 0xde1f9b45 },
{ "NvAPI_EnumNvidiaDisplayHandle", 0x9abdd40d },
{ "NvAPI_EnumNvidiaUnAttachedDisplayHandle", 0x20de9260 },
{ "NvAPI_CreateDisplayFromUnAttachedDisplay", 0x63f9799e },
{ "NvAPI_GetAssociatedNvidiaDisplayHandle", 0x35c29134 },
{ "NvAPI_DISP_GetAssociatedUnAttachedNvidiaDisplayHandle", 0xa70503b2 },
{ "NvAPI_GetAssociatedNvidiaDisplayName", 0x22a78b05 },
{ "NvAPI_GetUnAttachedAssociatedDisplayName", 0x4888d790 },
{ "NvAPI_EnableHWCursor", 0x2863148d },
{ "NvAPI_DisableHWCursor", 0xab163097 },
{ "NvAPI_GetVBlankCounter", 0x67b5db55 },
{ "NvAPI_SetRefreshRateOverride", 0x3092ac32 },
{ "NvAPI_GetAssociatedDisplayOutputId", 0xd995937e },
{ "NvAPI_GetDisplayPortInfo", 0xc64ff367 },
{ "NvAPI_SetDisplayPort", 0xfa13e65a },
{ "NvAPI_GetHDMISupportInfo", 0x6ae16ec3 },
{ "NvAPI_Disp_InfoFrameControl", 0x6067af3f },
{ "NvAPI_Disp_ColorControl", 0x92f9d80d },
{ "NvAPI_Disp_GetHdrCapabilities", 0x84f2a8df },
{ "NvAPI_Disp_HdrColorControl", 0x351da224 },
{ "NvAPI_Disp_SetSourceColorSpace", 0x473b6caf },
{ "NvAPI_Disp_GetSourceColorSpace", 0xceedc85b },
{ "NvAPI_Disp_SetSourceHdrMetadata", 0x905eb63b },
{ "NvAPI_Disp_GetSourceHdrMetadata", 0x0d3f52da },
{ "NvAPI_Disp_SetOutputMode", 0x98e7661a },
{ "NvAPI_Disp_GetOutputMode", 0x81fed88d },
{ "NvAPI_Disp_SetHdrToneMapping", 0xdd6da362 },
{ "NvAPI_Disp_GetHdrToneMapping", 0xfbd36e71 },
{ "NvAPI_DISP_GetTiming", 0x175167e9 },
{ "NvAPI_DISP_GetMonitorCapabilities", 0x3b05c7e1 },
{ "NvAPI_DISP_GetMonitorColorCapabilities", 0x6ae4cfb5 },
{ "NvAPI_DISP_EnumCustomDisplay", 0xa2072d59 },
{ "NvAPI_DISP_TryCustomDisplay", 0x1f7db630 },
{ "NvAPI_DISP_DeleteCustomDisplay", 0x552e5b9b },
{ "NvAPI_DISP_SaveCustomDisplay", 0x49882876 },
{ "NvAPI_DISP_RevertCustomDisplayTrial", 0xcbbd40f0 },
{ "NvAPI_GetView", 0xd6b99d89 },
{ "NvAPI_GetViewEx", 0xdbbc0af4 },
{ "NvAPI_GetSupportedViews", 0x66fb7fc0 },
{ "NvAPI_DISP_GetDisplayIdByDisplayName", 0xae457190 },
{ "NvAPI_DISP_GetGDIPrimaryDisplayId", 0x1e9d8a31 },
{ "NvAPI_DISP_GetDisplayConfig", 0x11abccf8 },
{ "NvAPI_DISP_SetDisplayConfig", 0x5d8cf8de },
{ "NvAPI_DISP_GetEdidData", 0x436ced76 },
{ "NvAPI_DISP_GetAdaptiveSyncData", 0xb73d1ee9 },
{ "NvAPI_DISP_SetAdaptiveSyncData", 0x3eebba1d },
{ "NvAPI_DISP_GetVirtualRefreshRateData", 0x8c00429a },
{ "NvAPI_DISP_SetVirtualRefreshRateData", 0x5abbe6a3 },
{ "NvAPI_DISP_SetPreferredStereoDisplay", 0xc9d0e25f },
{ "NvAPI_DISP_GetPreferredStereoDisplay", 0x1f6b4666 },
{ "NvAPI_DISP_GetNvManagedDedicatedDisplays", 0xdbdf0cb2 },
{ "NvAPI_DISP_AcquireDedicatedDisplay", 0x47c917ba },
{ "NvAPI_DISP_ReleaseDedicatedDisplay", 0x1247825f },
{ "NvAPI_DISP_GetNvManagedDedicatedDisplayMetadata", 0xd645d80c },
{ "NvAPI_DISP_SetNvManagedDedicatedDisplayMetadata", 0x3d8b129a },
{ "NvAPI_Disp_GetDisplayIdInfo", 0xbae8aa5e },
{ "NvAPI_Disp_GetDisplayIdsFromTarget", 0xe7e5f89e },
{ "NvAPI_Disp_GetVRRInfo", 0xdf8fda57 },
{ "NvAPI_Mosaic_GetSupportedTopoInfo", 0xfdb63c81 },
{ "NvAPI_Mosaic_GetTopoGroup", 0xcb89381d },
{ "NvAPI_Mosaic_GetOverlapLimits", 0x989685f0 },
{ "NvAPI_Mosaic_SetCurrentTopo", 0x9b542831 },
{ "NvAPI_Mosaic_GetCurrentTopo", 0xec32944e },
{ "NvAPI_Mosaic_EnableCurrentTopo", 0x5f1aa66c },
{ "NvAPI_Mosaic_GetDisplayViewportsByResolution", 0xdc6dc8d3 },
{ "NvAPI_Mosaic_SetDisplayGrids", 0x4d959a89 },
{ "NvAPI_Mosaic_ValidateDisplayGrids", 0xcf43903d },
{ "NvAPI_Mosaic_EnumDisplayModes", 0x78db97d7 },
{ "NvAPI_Mosaic_EnumDisplayGrids", 0xdf2887af },
{ "NvAPI_GetSupportedMosaicTopologies", 0x410b5c25 },
{ "NvAPI_GetCurrentMosaicTopology", 0xf60852bd },
{ "NvAPI_SetCurrentMosaicTopology", 0xd54b8989 },
{ "NvAPI_EnableCurrentMosaicTopology", 0x74073cc9 },
{ "NvAPI_GSync_EnumSyncDevices", 0xd9639601 },
{ "NvAPI_GSync_QueryCapabilities", 0x44a3f1d1 },
{ "NvAPI_GSync_GetTopology", 0x4562bc38 },
{ "NvAPI_GSync_SetSyncStateSettings", 0x60acdfdd },
{ "NvAPI_GSync_GetControlParameters", 0x16de1c6a },
{ "NvAPI_GSync_SetControlParameters", 0x8bbff88b },
{ "NvAPI_GSync_AdjustSyncDelay", 0x2d11ff51 },
{ "NvAPI_GSync_GetSyncStatus", 0xf1f5b434 },
{ "NvAPI_GSync_GetStatusParameters", 0x70d404ec },
{ "NvAPI_D3D_GetCurrentSLIState", 0x4b708b54 },
{ "NvAPI_D3D9_RegisterResource", 0xa064bdfc },
{ "NvAPI_D3D9_UnregisterResource", 0xbb2b17aa },
{ "NvAPI_D3D9_AliasSurfaceAsTexture", 0xe5ceae41 },
{ "NvAPI_D3D9_StretchRectEx", 0x22de03aa },
{ "NvAPI_D3D9_ClearRT", 0x332d3942 },
{ "NvAPI_D3D_GetObjectHandleForResource", 0xfceac864 },
{ "NvAPI_D3D_SetResourceHint", 0x6c0ed98c },
{ "NvAPI_D3D_BeginResourceRendering", 0x91123d6a },
{ "NvAPI_D3D_EndResourceRendering", 0x37e7191c },
{ "NvAPI_D3D9_GetSurfaceHandle", 0x0f2dd3f2 },
{ "NvAPI_D3D9_VideoSetStereoInfo", 0xb852f4db },
{ "NvAPI_D3D10_SetDepthBoundsTest", 0x4eadf5d2 },
{ "NvAPI_D3D11_CreateDevice", 0x6a16d3a0 },
{ "NvAPI_D3D11_CreateDeviceAndSwapChain", 0xbb939ee5 },
{ "NvAPI_D3D11_SetDepthBoundsTest", 0x7aaf7a04 },
{ "NvAPI_D3D11_IsNvShaderExtnOpCodeSupported", 0x5f68da40 },
{ "NvAPI_D3D11_SetNvShaderExtnSlot", 0x8e90bb9f },
{ "NvAPI_D3D12_SetNvShaderExtnSlotSpace", 0xac2dfeb5 },
{ "NvAPI_D3D12_SetNvShaderExtnSlotSpaceLocalThread", 0x43d867c0 },
{ "NvAPI_D3D11_SetNvShaderExtnSlotLocalThread", 0x0e6482a0 },
{ "NvAPI_D3D11_BeginUAVOverlapEx", 0xba08208a },
{ "NvAPI_D3D11_BeginUAVOverlap", 0x65b93ca8 },
{ "NvAPI_D3D11_EndUAVOverlap", 0x2216a357 },
{ "NvAPI_D3D11_GetResourceHandle", 0x09d52986 },
{ "NvAPI_D3D_SetFPSIndicatorState", 0xa776e8db },
{ "NvAPI_D3D9_Present", 0x05650beb },
{ "NvAPI_D3D9_QueryFrameCount", 0x9083e53a },
{ "NvAPI_D3D9_ResetFrameCount", 0xfa6a0675 },
{ "NvAPI_D3D9_QueryMaxSwapGroup", 0x5995410d },
{ "NvAPI_D3D9_QuerySwapGroup", 0xeba4d232 },
{ "NvAPI_D3D9_JoinSwapGroup", 0x7d44bb54 },
{ "NvAPI_D3D9_BindSwapBarrier", 0x9c39c246 },
{ "NvAPI_D3D_SetVerticalSyncMode", 0x5526cfd1 },
{ "NvAPI_D3D1x_Present", 0x03b845a1 },
{ "NvAPI_D3D1x_QueryFrameCount", 0x9152e055 },
{ "NvAPI_D3D1x_ResetFrameCount", 0xfbbb031a },
{ "NvAPI_D3D1x_QueryMaxSwapGroup", 0x9bb9d68f },
{ "NvAPI_D3D1x_QuerySwapGroup", 0x407f67aa },
{ "NvAPI_D3D1x_JoinSwapGroup", 0x14610cd7 },
{ "NvAPI_D3D1x_BindSwapBarrier", 0x9de8c729 },
{ "NvAPI_D3D12_QueryPresentBarrierSupport", 0xa15faef7 },
{ "NvAPI_D3D12_CreatePresentBarrierClient", 0x4d815de9 },
{ "NvAPI_D3D12_RegisterPresentBarrierResources", 0xd53c9ef0 },
{ "NvAPI_DestroyPresentBarrierClient", 0x3c5c351b },
{ "NvAPI_JoinPresentBarrier", 0x17f6bf82 },
{ "NvAPI_LeavePresentBarrier", 0xc3ec5a7f },
{ "NvAPI_QueryPresentBarrierFrameStatistics", 0x61b844a1 },
{ "NvAPI_D3D12_CreateDDisplayPresentBarrierClient", 0xb5a21987 },
{ "NvAPI_D3D11_CreateRasterizerState", 0xdb8d28af },
{ "NvAPI_D3D_ConfigureAnsel", 0x341c6c7f },
{ "NvAPI_D3D11_CreateTiledTexture2DArray", 0x7886981a },
{ "NvAPI_D3D11_CheckFeatureSupport", 0x106a487e },
{ "NvAPI_D3D11_CreateImplicitMSAATexture2D", 0xb8f79632 },
{ "NvAPI_D3D12_CreateCommittedImplicitMSAATexture2D", 0x24c6a07b },
{ "NvAPI_D3D11_ResolveSubresourceRegion", 0xe6bfedd6 },
{ "NvAPI_D3D12_ResolveSubresourceRegion", 0xc24a15bf },
{ "NvAPI_D3D11_TiledTexture2DArrayGetDesc", 0xf1a2b9d5 },
{ "NvAPI_D3D11_UpdateTileMappings", 0x9a06ea07 },
{ "NvAPI_D3D11_CopyTileMappings", 0xc09ee6bc },
{ "NvAPI_D3D11_TiledResourceBarrier", 0xd6839099 },
{ "NvAPI_D3D11_AliasMSAATexture2DAsNonMSAA", 0xf1c54fc9 },
{ "NvAPI_D3D11_CreateGeometryShaderEx_2", 0x99ed5c1c },
{ "NvAPI_D3D11_CreateVertexShaderEx", 0x0beaa0b2 },
{ "NvAPI_D3D11_CreateHullShaderEx", 0xb53cab00 },
{ "NvAPI_D3D11_CreateDomainShaderEx", 0xa0d7180d },
{ "NvAPI_D3D11_CreatePixelShaderEx_2", 0x4162822b },
{ "NvAPI_D3D11_CreateFastGeometryShaderExplicit", 0x71ab7c9c },
{ "NvAPI_D3D11_CreateFastGeometryShader", 0x525d43be },
{ "NvAPI_D3D11_DecompressView", 0x3a94e822 },
{ "NvAPI_D3D12_CreateGraphicsPipelineState", 0x2fc28856 },
{ "NvAPI_D3D12_CreateComputePipelineState", 0x2762deac },
{ "NvAPI_D3D12_SetDepthBoundsTestValues", 0xb9333fe9 },
{ "NvAPI_D3D12_CreateReservedResource", 0x2c85f101 },
{ "NvAPI_D3D12_CreateHeap", 0x5cb397cf },
{ "NvAPI_D3D12_CreateHeap2", 0x924be9d6 },
{ "NvAPI_D3D12_QueryCpuVisibleVidmem", 0x26322bc3 },
{ "NvAPI_D3D12_ReservedResourceGetDesc", 0x9aa2aabb },
{ "NvAPI_D3D12_UpdateTileMappings", 0xc6017a7d },
{ "NvAPI_D3D12_CopyTileMappings", 0x47f78194 },
{ "NvAPI_D3D12_ResourceAliasingBarrier", 0xb942bab7 },
{ "NvAPI_D3D12_CaptureUAVInfo", 0x6e5ea9db },
{ "NvAPI_D3D11_GetResourceGPUVirtualAddressEx", 0xaf6d14da },
{ "NvAPI_D3D11_EnumerateMetaCommands", 0xc7453ba8 },
{ "NvAPI_D3D11_CreateMetaCommand", 0xf505fba0 },
{ "NvAPI_D3D11_InitializeMetaCommand", 0xaec629e9 },
{ "NvAPI_D3D11_ExecuteMetaCommand", 0x82236c47 },
{ "NvAPI_D3D12_EnumerateMetaCommands", 0xcd9141d8 },
{ "NvAPI_D3D12_CreateMetaCommand", 0xeb29634b },
{ "NvAPI_D3D12_InitializeMetaCommand", 0xa4125399 },
{ "NvAPI_D3D12_ExecuteMetaCommand", 0xde24fc3d },
{ "NvAPI_D3D12_CreateCommittedResource", 0x027e98ae },
{ "NvAPI_D3D12_GetCopyableFootprints", 0xf6305eb5 },
{ "NvAPI_D3D12_CopyTextureRegion", 0x82b91b25 },
{ "NvAPI_D3D12_IsNvShaderExtnOpCodeSupported", 0x3dfacec8 },
{ "NvAPI_D3D12_GetOptimalThreadCountForMesh", 0xb43995cb },
{ "NvAPI_D3D_IsGSyncCapable", 0x9c1eed78 },
{ "NvAPI_D3D_IsGSyncActive", 0xe942b0ff },
{ "NvAPI_D3D1x_DisableShaderDiskCache", 0xd0cbca7d },
{ "NvAPI_D3D11_MultiGPU_GetCaps", 0xd2d25687 },
{ "NvAPI_D3D11_MultiGPU_Init", 0x017be49e },
{ "NvAPI_D3D11_CreateMultiGPUDevice", 0xbdb20007 },
{ "NvAPI_D3D_QuerySinglePassStereoSupport", 0x6f5f0a6d },
{ "NvAPI_D3D_SetSinglePassStereoMode", 0xa39e6e6e },
{ "NvAPI_D3D12_QuerySinglePassStereoSupport", 0x3b03791b },
{ "NvAPI_D3D12_SetSinglePassStereoMode", 0x83556d87 },
{ "NvAPI_D3D_QueryMultiViewSupport", 0xb6e0a41c },
{ "NvAPI_D3D_SetMultiViewMode", 0x8285c8da },
{ "NvAPI_D3D_QueryModifiedWSupport", 0xcbf9f4f5 },
{ "NvAPI_D3D_SetModifiedWMode", 0x06ea4bf4 },
{ "NvAPI_D3D12_QueryModifiedWSupport", 0x51235248 },
{ "NvAPI_D3D12_SetModifiedWMode", 0xe1fdaba7 },
{ "NvAPI_D3D_CreateLateLatchObject", 0x2db27d09 },
{ "NvAPI_D3D_QueryLateLatchSupport", 0x8ceca0ec },
{ "NvAPI_D3D_RegisterDevice", 0x8c02c4d0 },
{ "NvAPI_D3D11_MultiDrawInstancedIndirect", 0xd4e26bbf },
{ "NvAPI_D3D11_MultiDrawIndexedInstancedIndirect", 0x59e890f9 },
{ "NvAPI_D3D_ImplicitSLIControl", 0x2aede111 },
{ "NvAPI_D3D12_GetNeedsAppFPBlendClamping", 0x6ef4d2d1 },
{ "NvAPI_D3D12_UseDriverHeapPriorities", 0xf0d978a8 },
{ "NvAPI_D3D12_Mosaic_GetCompanionAllocations", 0xa46022c7 },
{ "NvAPI_D3D12_Mosaic_GetViewportAndGpuPartitions", 0xb092b818 },
{ "NvAPI_D3D1x_GetGraphicsCapabilities", 0x52b1499a },
{ "NvAPI_D3D12_GetGraphicsCapabilities", 0x01e87354 },
{ "NvAPI_D3D11_RSSetExclusiveScissorRects", 0xae4d73ef },
{ "NvAPI_D3D11_RSSetViewportsPixelShadingRates", 0x34f7938f },
{ "NvAPI_D3D11_CreateShadingRateResourceView", 0x99ca2dff },
{ "NvAPI_D3D11_RSSetShadingRateResourceView", 0x1b0c2f83 },
{ "NvAPI_D3D11_RSGetPixelShadingRateSampleOrder", 0x092442a1 },
{ "NvAPI_D3D11_RSSetPixelShadingRateSampleOrder", 0xa942373a },
{ "NvAPI_D3D_InitializeVRSHelper", 0x4780d70b },
{ "NvAPI_D3D_InitializeNvGazeHandler", 0x5b3b7479 },
{ "NvAPI_D3D_InitializeSMPAssist", 0x42763d0c },
{ "NvAPI_D3D_QuerySMPAssistSupport", 0xc57921de },
{ "NvAPI_D3D_GetSleepStatus", 0xaef96ca1 },
{ "NvAPI_D3D_SetSleepMode", 0xac1ca9e0 },
{ "NvAPI_D3D_Sleep", 0x852cd1d2 },
{ "NvAPI_D3D_SetReflexSync", 0xb9f6faff },
{ "NvAPI_D3D_GetLatency", 0x1a587f9c },
{ "NvAPI_D3D_SetLatencyMarker", 0xd9984c05 },
{ "NvAPI_D3D12_SetAsyncFrameMarker", 0x13c98f73 },
{ "NvAPI_D3D11_SetAsyncFrameMarker", 0x59c2c510 },
{ "NvAPI_D3D12_NotifyOutOfBandCommandQueue", 0x03d6e8cb },
{ "NvAPI_D3D12_SetCreateCommandQueueLowLatencyHint", 0x548c224f },
{ "NvAPI_D3D12_CreateCubinComputeShaderExV2", 0x299f5fdc },
{ "NvAPI_D3D12_CreateCubinComputeShader", 0x2a2c79e8 },
{ "NvAPI_D3D12_CreateCubinComputeShaderEx", 0x3151211b },
{ "NvAPI_D3D12_CreateCubinComputeShaderWithName", 0x1dc7261f },
{ "NvAPI_D3D12_LaunchCubinShader", 0x5c52bb86 },
{ "NvAPI_D3D12_DestroyCubinComputeShader", 0x7fb785ba },
{ "NvAPI_D3D12_GetCudaMergedTextureSamplerObject", 0x329fe6e0 },
{ "NvAPI_D3D12_GetCudaIndependentDescriptorObject", 0x0ddac234 },
{ "NvAPI_D3D12_GetCudaTextureObject", 0x80403fc9 },
{ "NvAPI_D3D12_GetCudaSurfaceObject", 0x48f5b2ee },
{ "NvAPI_D3D12_IsFatbinPTXSupported", 0x70c07832 },
{ "NvAPI_D3D12_CreateCuModule", 0xad1a677d },
{ "NvAPI_D3D12_EnumFunctionsInModule", 0x7ab88d88 },
{ "NvAPI_D3D12_CreateCuFunction", 0xe2436e22 },
{ "NvAPI_D3D12_LaunchCuKernelChain", 0x24973538 },
{ "NvAPI_D3D12_LaunchCuKernelChainEx", 0x846a9bf0 },
{ "NvAPI_D3D12_DestroyCuModule", 0x41c65285 },
{ "NvAPI_D3D12_DestroyCuFunction", 0xdf295ea6 },
{ "NvAPI_D3D11_CreateCubinComputeShader", 0x0ed98181 },
{ "NvAPI_D3D11_CreateCubinComputeShaderEx", 0x32c2a0f6 },
{ "NvAPI_D3D11_CreateCubinComputeShaderWithName", 0xb672be19 },
{ "NvAPI_D3D11_LaunchCubinShader", 0x427e236d },
{ "NvAPI_D3D11_DestroyCubinComputeShader", 0x01682c86 },
{ "NvAPI_D3D11_IsFatbinPTXSupported", 0x6086bd93 },
{ "NvAPI_D3D11_CreateUnorderedAccessView", 0x74a497a1 },
{ "NvAPI_D3D11_CreateShaderResourceView", 0x65cb431e },
{ "NvAPI_D3D11_CreateSamplerState", 0x89eca416 },
{ "NvAPI_D3D11_GetCudaTextureObject", 0x9006fa68 },
{ "NvAPI_D3D11_GetResourceGPUVirtualAddress", 0x1819b423 },
{ "NvAPI_D3D12_GetRaytracingCaps", 0x85a6c2a0 },
{ "NvAPI_D3D12_EnableRaytracingValidation", 0x1de5991b },
{ "NvAPI_D3D12_RegisterRaytracingValidationMessageCallback", 0x8554eb38 },
{ "NvAPI_D3D12_UnregisterRaytracingValidationMessageCallback", 0x26975da6 },
{ "NvAPI_D3D12_FlushRaytracingValidationMessages", 0xb8fb1fcb },
{ "NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo", 0xfa99b6de },
{ "NvAPI_D3D12_GetRaytracingOpacityMicromapArrayPrebuildInfo", 0x4726d180 },
{ "NvAPI_D3D12_SetCreatePipelineStateOptions", 0x5c607a27 },
{ "NvAPI_D3D12_CheckDriverMatchingIdentifierEx", 0xafb237d4 },
{ "NvAPI_D3D12_GetRaytracingAccelerationStructurePrebuildInfoEx", 0x8d025b77 },
{ "NvAPI_D3D12_BuildRaytracingOpacityMicromapArray", 0x814f8d11 },
{ "NvAPI_D3D12_RelocateRaytracingOpacityMicromapArray", 0x0425c538 },
{ "NvAPI_D3D12_BuildRaytracingDisplacementMicromapArray", 0x066f569d },
{ "NvAPI_D3D12_RelocateRaytracingDisplacementMicromapArray", 0x1c142308 },
{ "NvAPI_D3D12_EmitRaytracingDisplacementMicromapArrayPostbuildInfo", 0x68b9a790 },
{ "NvAPI_D3D12_EmitRaytracingOpacityMicromapArrayPostbuildInfo", 0x1d9a39b6 },
{ "NvAPI_D3D12_BuildRaytracingAccelerationStructureEx", 0xe24ead45 },
{ "NvAPI_D3D12_QueryWorkstationFeatureProperties", 0xa92ea23a },
{ "NvAPI_D3D12_CreateCommittedRDMABuffer", 0xe78dcb44 },
{ "NvAPI_DirectD3D12GraphicsCommandList_Create", 0x74a4e712 },
{ "NvAPI_DirectD3D12GraphicsCommandList_Release", 0x99da3dde },
{ "NvAPI_DirectD3D12GraphicsCommandList_Reset", 0x999c26d8 },
{ "NvAPI_VIO_GetCapabilities", 0x1dc91303 },
{ "NvAPI_VIO_Open", 0x44ee4841 },
{ "NvAPI_VIO_Close", 0xd01bd237 },
{ "NvAPI_VIO_Status", 0x0e6ce4f1 },
{ "NvAPI_VIO_SyncFormatDetect", 0x118d48a3 },
{ "NvAPI_VIO_GetConfig", 0xd34a789b },
{ "NvAPI_VIO_SetConfig", 0x0e4eec07 },
{ "NvAPI_VIO_SetCSC", 0xa1ec8d74 },
{ "NvAPI_VIO_GetCSC", 0x7b0d72a3 },
{ "NvAPI_VIO_SetGamma", 0x964bf452 },
{ "NvAPI_VIO_GetGamma", 0x51d53d06 },
{ "NvAPI_VIO_SetSyncDelay", 0x2697a8d1 },
{ "NvAPI_VIO_GetSyncDelay", 0x462214a9 },
{ "NvAPI_VIO_GetPCIInfo", 0xb981d935 },
{ "NvAPI_VIO_IsRunning", 0x96bd040e },
{ "NvAPI_VIO_Start", 0xcde8e1a3 },
{ "NvAPI_VIO_Stop", 0x6ba2a5d6 },
{ "NvAPI_VIO_IsFrameLockModeCompatible", 0x7bf0a94d },
{ "NvAPI_VIO_EnumDevices", 0xfd7c5557 },
{ "NvAPI_VIO_QueryTopology", 0x869534e2 },
{ "NvAPI_VIO_EnumSignalFormats", 0xead72fe4 },
{ "NvAPI_VIO_EnumDataFormats", 0x221fa8e8 },
{ "NvAPI_Stereo_CreateConfigurationProfileRegistryKey", 0xbe7692ec },
{ "NvAPI_Stereo_DeleteConfigurationProfileRegistryKey", 0xf117b834 },
{ "NvAPI_Stereo_SetConfigurationProfileValue", 0x24409f48 },
{ "NvAPI_Stereo_DeleteConfigurationProfileValue", 0x49bceecf },
{ "NvAPI_Stereo_Enable", 0x239c4545 },
{ "NvAPI_Stereo_Disable", 0x2ec50c2b },
{ "NvAPI_Stereo_IsEnabled", 0x348ff8e1 },
{ "NvAPI_Stereo_GetStereoSupport", 0x296c434d },
{ "NvAPI_Stereo_CreateHandleFromIUnknown", 0xac7e37f4 },
{ "NvAPI_Stereo_DestroyHandle", 0x3a153134 },
{ "NvAPI_Stereo_Activate", 0xf6a1ad68 },
{ "NvAPI_Stereo_Deactivate", 0x2d68de96 },
{ "NvAPI_Stereo_IsActivated", 0x1fb0bc30 },
{ "NvAPI_Stereo_GetSeparation", 0x451f2134 },
{ "NvAPI_Stereo_SetSeparation", 0x5c069fa3 },
{ "NvAPI_Stereo_DecreaseSeparation", 0xda044458 },
{ "NvAPI_Stereo_IncreaseSeparation", 0xc9a8ecec },
{ "NvAPI_Stereo_GetConvergence", 0x4ab00934 },
{ "NvAPI_Stereo_SetConvergence", 0x3dd6b54b },
{ "NvAPI_Stereo_DecreaseConvergence", 0x4c87e317 },
{ "NvAPI_Stereo_IncreaseConvergence", 0xa17daabe },
{ "NvAPI_Stereo_GetFrustumAdjustMode", 0xe6839b43 },
{ "NvAPI_Stereo_SetFrustumAdjustMode", 0x7be27fa2 },
{ "NvAPI_Stereo_CaptureJpegImage", 0x932cb140 },
{ "NvAPI_Stereo_InitActivation", 0xc7177702 },
{ "NvAPI_Stereo_Trigger_Activation", 0x0d6c6cd2 },
{ "NvAPI_Stereo_CapturePngImage", 0x8b7e99b5 },
{ "NvAPI_Stereo_ReverseStereoBlitControl", 0x3cd58f89 },
{ "NvAPI_Stereo_SetNotificationMessage", 0x6b9b409e },
{ "NvAPI_Stereo_SetActiveEye", 0x96eea9f8 },
{ "NvAPI_Stereo_SetDriverMode", 0x5e8f0bec },
{ "NvAPI_Stereo_GetEyeSeparation", 0xce653127 },
{ "NvAPI_Stereo_IsWindowedModeSupported", 0x40c8ed5e },
{ "NvAPI_Stereo_SetSurfaceCreationMode", 0xf5dcfcba },
{ "NvAPI_Stereo_GetSurfaceCreationMode", 0x36f1c736 },
{ "NvAPI_Stereo_Debug_WasLastDrawStereoized", 0xed4416c5 },
{ "NvAPI_Stereo_SetDefaultProfile", 0x44f0ecd1 },
{ "NvAPI_Stereo_GetDefaultProfile", 0x624e21c2 },
{ "NvAPI_D3D1x_CreateSwapChain", 0x1bc21b66 },
{ "NvAPI_D3D9_CreateSwapChain", 0x1a131e09 },
{ "NvAPI_Vulkan_InitLowLatencyDevice", 0x5c1696b6 },
{ "NvAPI_Vulkan_DestroyLowLatencyDevice", 0x11a5932b },
{ "NvAPI_Vulkan_GetSleepStatus", 0xadf966af },
{ "NvAPI_Vulkan_SetSleepMode", 0x2acfd162 },
{ "NvAPI_Vulkan_Sleep", 0x36732b1e },
{ "NvAPI_Vulkan_GetLatency", 0x3233d44a },
{ "NvAPI_Vulkan_SetLatencyMarker", 0xa17d13d6 },
{ "NvAPI_Vulkan_NotifyOutOfBandVkQueue", 0x5d6d3840 },
{ "NvAPI_DRS_CreateSession", 0x0694d52e },
{ "NvAPI_DRS_DestroySession", 0xdad9cff8 },
{ "NvAPI_DRS_LoadSettings", 0x375dbd6b },
{ "NvAPI_DRS_SaveSettings", 0xfcbc7e14 },
{ "NvAPI_DRS_LoadSettingsFromFile", 0xd3ede889 },
{ "NvAPI_DRS_SaveSettingsToFile", 0x2be25df8 },
{ "NvAPI_DRS_CreateProfile", 0xcc176068 },
{ "NvAPI_DRS_DeleteProfile", 0x17093206 },
{ "NvAPI_DRS_SetCurrentGlobalProfile", 0x1c89c5df },
{ "NvAPI_DRS_GetCurrentGlobalProfile", 0x617bff9f },
{ "NvAPI_DRS_GetProfileInfo", 0x61cd6fd6 },
{ "NvAPI_DRS_SetProfileInfo", 0x16abd3a9 },
{ "NvAPI_DRS_FindProfileByName", 0x7e4a9a0b },
{ "NvAPI_DRS_EnumProfiles", 0xbc371ee0 },
{ "NvAPI_DRS_GetNumProfiles", 0x1dae4fbc },
{ "NvAPI_DRS_CreateApplication", 0x4347a9de },
{ "NvAPI_DRS_DeleteApplicationEx", 0xc5ea85a1 },
{ "NvAPI_DRS_DeleteApplication", 0x2c694bc6 },
{ "NvAPI_DRS_GetApplicationInfo", 0xed1f8c69 },
{ "NvAPI_DRS_EnumApplications", 0x7fa2173a },
{ "NvAPI_DRS_FindApplicationByName", 0xeee566b2 },
{ "NvAPI_DRS_SetSetting", 0x577dd202 },
{ "NvAPI_DRS_GetSetting", 0x73bf8338 },
{ "NvAPI_DRS_EnumSettings", 0xae3039da },
{ "NvAPI_DRS_EnumAvailableSettingIds", 0xf020614a },
{ "NvAPI_DRS_EnumAvailableSettingValues", 0x2ec39f90 },
{ "NvAPI_DRS_GetSettingIdFromName", 0xcb7309cd },
{ "NvAPI_DRS_GetSettingNameFromId", 0xd61cbe6e },
{ "NvAPI_DRS_DeleteProfileSetting", 0xe4a26362 },
{ "NvAPI_DRS_RestoreAllDefaults", 0x5927b094 },
{ "NvAPI_DRS_RestoreProfileDefault", 0xfa5f6134 },
{ "NvAPI_DRS_RestoreProfileDefaultSetting", 0x53f0381e },
{ "NvAPI_DRS_GetBaseProfile", 0xda8466a0 },
{ "NvAPI_SYS_GetChipSetInfo", 0x53dabbca },
{ "NvAPI_SYS_GetLidAndDockInfo", 0xcda14d8a },
{ "NvAPI_SYS_GetDisplayIdFromGpuAndOutputId", 0x08f2bab4 },
{ "NvAPI_SYS_GetGpuAndOutputIdFromDisplayId", 0x112ba1a5 },
{ "NvAPI_SYS_GetPhysicalGpuFromDisplayId", 0x9ea74659 },
{ "NvAPI_SYS_GetDisplayDriverInfo", 0x721faceb },
{ "NvAPI_SYS_GetPhysicalGPUs", 0xd3b24d2d },
{ "NvAPI_SYS_GetLogicalGPUs", 0xccfffc10 },
{ "NvAPI_GPU_ClientRegisterForUtilizationSampleUpdates", 0xadeeaf67 },
};
#endif // _NVAPI_INTERFACE_H

View File

@ -0,0 +1,659 @@
/*********************************************************************************************************\
|* *|
|* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. *|
|* SPDX-License-Identifier: MIT *|
|* *|
|* Permission is hereby granted, free of charge, to any person obtaining a *|
|* copy of this software and associated documentation files (the "Software"), *|
|* to deal in the Software without restriction, including without limitation *|
|* the rights to use, copy, modify, merge, publish, distribute, sublicense, *|
|* and/or sell copies of the Software, and to permit persons to whom the *|
|* Software is furnished to do so, subject to the following conditions: *|
|* *|
|* The above copyright notice and this permission notice shall be included in *|
|* all copies or substantial portions of the Software. *|
|* *|
|* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *|
|* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *|
|* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *|
|* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *|
|* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *|
|* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *|
|* DEALINGS IN THE SOFTWARE. *|
|* *|
|* *|
\*********************************************************************************************************/
#pragma once
#include"imports/nvapi/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
#if NVAPI_USE_STDINT
typedef uint32_t NvV32; /* "void": enumerated or multiple fields */
typedef uint32_t NvU32; /* 0 to 4294967295 */
typedef int32_t NvS32; /* -2147483648 to 2147483647 */
#else
// 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
#if !(NVOS_IS_UNIX || (defined(__unix)))
// 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
#else
typedef unsigned int NvU32; /* 0 to 4294967295 */
#endif
#endif
typedef unsigned long temp_NvU32; /* 0 to 4294967295 */
typedef signed short NvS16;
typedef unsigned short NvU16;
typedef unsigned char NvU8;
typedef signed char NvS8;
typedef float NvF32;
typedef double NvF64;
/*!
* Macro to convert NvU32 to NvF32.
*/
#define NvU32TONvF32(_pData) *(NvF32 *)(_pData)
/*!
* Macro to convert NvF32 to NvU32.
*/
#define NvF32TONvU32(_pData) *(NvU32 *)(_pData)
/* Boolean type */
typedef NvU8 NvBool;
#define NV_TRUE ((NvBool)(0 == 0))
#define NV_FALSE ((NvBool)(0 != 0))
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(NvLogicalGpuHandle); //!< One or more physical GPUs acting in concert (SLI)
NV_DECLARE_HANDLE(NvPhysicalGpuHandle); //!< A single physical GPU
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(NvVisualComputingDeviceHandle); //!< A handle to a Visual Computing Device
NV_DECLARE_HANDLE(NvEventHandle); //!< A handle to an event registration instance
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
NV_DECLARE_HANDLE(NvPcfClientHandle); //!< A handle for NVPCF clients
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;
NV_DECLARE_HANDLE(NvPresentBarrierClientHandle); //!< PresentBarrier client object
//! @}
//! \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 NVAPI_SYSTEM_MAX_HWBCS 128
#define NVAPI_SYSTEM_HWBC_INVALID_ID 0xffffffff
#define NVAPI_SYSTEM_MAX_DISPLAYS NVAPI_MAX_PHYSICAL_GPUS * NV_MAX_HEADS
#define NV_MAX_HEADS 4 //!< Maximum heads, each with NVAPI_DESKTOP_RES resolution
#define NVAPI_MAX_HEADS_PER_GPU 32
#define NV_MAX_VID_STREAMS 4 //!< Maximum number of input video streams, each with a #NVAPI_VIDEO_SRC_INFO
#define NV_MAX_VID_STREAMS_EX 20 //!< Increasing MAX no. 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_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];
typedef NvU16 NvAPI_UnicodeShortString[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, //!< The application will require Administrator privileges to access this API.
//!< The application can be elevated to a higher permission level by selecting "Run as Administrator".
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_D3D_DEVICE_NOT_REGISTERED = -202, //!< The user tried to use a deferred context without registering the device first
NVAPI_RESOURCE_NOT_ACQUIRED = -203, //!< Head or SourceId was not reserved for the VR Display before doing the Modeset or the dedicated display.
NVAPI_TIMING_NOT_SUPPORTED = -204, //!< Provided timing is not supported.
NVAPI_HDCP_ENCRYPTION_FAILED = -205, //!< HDCP Encryption Failed for the device. Would be applicable when the device is HDCP Capable.
NVAPI_PCLK_LIMITATION_FAILED = -206, //!< Provided mode is over sink device pclk limitation.
NVAPI_NO_CONNECTOR_FOUND = -207, //!< No connector on GPU found.
NVAPI_HDCP_DISABLED = -208, //!< When a non-HDCP capable HMD is connected, we would inform user by this code.
NVAPI_API_IN_USE = -209, //!< Atleast an API is still being called
NVAPI_NVIDIA_DISPLAY_NOT_FOUND = -210, //!< No display found on Nvidia GPU(s).
NVAPI_PRIV_SEC_VIOLATION = -211, //!< Priv security violation, improper access to a secured register.
NVAPI_INCORRECT_VENDOR = -212, //!< NVAPI cannot be called by this vendor
NVAPI_DISPLAY_IN_USE = -213, //!< DirectMode Display is already in use
NVAPI_UNSUPPORTED_CONFIG_NON_HDCP_HMD = -214, //!< The Config is having Non-NVidia GPU with Non-HDCP HMD connected
NVAPI_MAX_DISPLAY_LIMIT_REACHED = -215, //!< GPU's Max Display Limit has Reached
NVAPI_INVALID_DIRECT_MODE_DISPLAY = -216, //!< DirectMode not Enabled on the Display
NVAPI_GPU_IN_DEBUG_MODE = -217, //!< GPU is in debug mode, OC is NOT allowed.
NVAPI_D3D_CONTEXT_NOT_FOUND = -218, //!< No NvAPI context was found for this D3D object
NVAPI_STEREO_VERSION_MISMATCH = -219, //!< there is version mismatch between stereo driver and dx driver
NVAPI_GPU_NOT_POWERED = -220, //!< GPU is not powered and so the request cannot be completed.
NVAPI_ERROR_DRIVER_RELOAD_IN_PROGRESS = -221, //!< The display driver update in progress.
NVAPI_WAIT_FOR_HW_RESOURCE = -222, //!< Wait for HW resources allocation
NVAPI_REQUIRE_FURTHER_HDCP_ACTION = -223, //!< operation requires further HDCP action
NVAPI_DISPLAY_MUX_TRANSITION_FAILED = -224, //!< Dynamic Mux transition failure
NVAPI_INVALID_DSC_VERSION = -225, //!< Invalid DSC version
NVAPI_INVALID_DSC_SLICECOUNT = -226, //!< Invalid DSC slice count
NVAPI_INVALID_DSC_OUTPUT_BPP = -227, //!< Invalid DSC output BPP
NVAPI_FAILED_TO_LOAD_FROM_DRIVER_STORE = -228, //!< There was an error while loading nvapi.dll from the driver store.
NVAPI_NO_VULKAN = -229, //!< OpenGL does not export Vulkan fake extensions
NVAPI_REQUEST_PENDING = -230, //!< A request for NvTOPPs telemetry CData has already been made and is pending a response.
NVAPI_RESOURCE_IN_USE = -231, //!< Operation cannot be performed because the resource is in use.
NVAPI_INVALID_IMAGE = -232, //!< Device kernel image is invalid
NVAPI_INVALID_PTX = -233, //!< PTX JIT compilation failed
NVAPI_NVLINK_UNCORRECTABLE = -234, //!< Uncorrectable NVLink error was detected during the execution
NVAPI_JIT_COMPILER_NOT_FOUND = -235, //!< PTX JIT compiler library was not found.
NVAPI_INVALID_SOURCE = -236, //!< Device kernel source is invalid.
NVAPI_ILLEGAL_INSTRUCTION = -237, //!< While executing a kernel, the device encountered an illegal instruction.
NVAPI_INVALID_PC = -238, //!< While executing a kernel, the device program counter wrapped its address space
NVAPI_LAUNCH_FAILED = -239, //!< An exception occurred on the device while executing a kernel
NVAPI_NOT_PERMITTED = -240, //!< Attempted operation is not permitted.
NVAPI_CALLBACK_ALREADY_REGISTERED = -241, //!< The callback function has already been registered.
NVAPI_CALLBACK_NOT_FOUND = -242, //!< The callback function is not found or not registered.
NVAPI_INVALID_OUTPUT_WIRE_FORMAT = -243, //!< Invalid Wire Format for the VR HMD
} NvAPI_Status;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_SYS_GetDriverAndBranchVersion
//
//! DESCRIPTION: This API returns display driver version and driver-branch string.
//!
//! SUPPORTED OS: Windows 10 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
//! 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.
NvU32 dedicatedVideoMemoryEvictionsSize; //!< Size(in kb) of the total size of memory released as a result of the evictions.
NvU32 dedicatedVideoMemoryEvictionCount; //!< Indicates the number of eviction events that caused an allocation to be removed from dedicated video memory to free GPU
//!< video memory to make room for other allocations.
} NV_DISPLAY_DRIVER_MEMORY_INFO_V3;
//! \ingroup driverapi
typedef NV_DISPLAY_DRIVER_MEMORY_INFO_V3 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
//! Macro for constructing the version field of NV_DISPLAY_DRIVER_MEMORY_INFO_V3
#define NV_DISPLAY_DRIVER_MEMORY_INFO_VER_3 MAKE_NVAPI_VERSION(NV_DISPLAY_DRIVER_MEMORY_INFO_V3,3)
//! \ingroup driverapi
#define NV_DISPLAY_DRIVER_MEMORY_INFO_VER NV_DISPLAY_DRIVER_MEMORY_INFO_VER_3
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_GPU_GetMemoryInfo
//
//! DESCRIPTION: This function retrieves the available driver memory footprint for the specified GPU.
//! If the GPU is in TCC Mode, only dedicatedVideoMemory will be returned in pMemoryInfo (NV_DISPLAY_DRIVER_MEMORY_INFO).
//!
//! \deprecated Do not use this function - it is deprecated in release 520. Instead, use NvAPI_GPU_GetMemoryInfoEx.
//! SUPPORTED OS: Windows 10 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_deprecated_function("Do not use this function - it is deprecated in release 520. Instead, use NvAPI_GPU_GetMemoryInfoEx.")
NVAPI_INTERFACE NvAPI_GPU_GetMemoryInfo(NvPhysicalGpuHandle hPhysicalGpu, NV_DISPLAY_DRIVER_MEMORY_INFO *pMemoryInfo);
//! \ingroup driverapi
//! Used in NvAPI_GPU_GetMemoryInfoEx().
typedef struct
{
NvU32 version; //!< Structure version
NvU64 dedicatedVideoMemory; //!< Size(in bytes) of the physical framebuffer. Refers to the dedicated video memory on discrete GPUs.
//! It is more performant for GPU operations than the reserved systemVideoMemory.
NvU64 availableDedicatedVideoMemory; //!< Size(in bytes) of the available physical framebuffer for allocating video memory surfaces.
NvU64 systemVideoMemory; //!< Size(in bytes) of system memory the driver allocates at load time. It is a substitute for dedicated video memory.
//!< Typically used with integrated GPUs that do not have dedicated video memory.
NvU64 sharedSystemMemory; //!< Size(in bytes) of shared system memory that driver is allowed to commit for surfaces across all allocations.
//!< On discrete GPUs, it is used to utilize system memory for various operations. It does not need to be reserved during boot.
//!< It may be used by both GPU and CPU, and has an "on-demand" type of usage.
NvU64 curAvailableDedicatedVideoMemory; //!< Size(in bytes) of the current available physical framebuffer for allocating video memory surfaces.
NvU64 dedicatedVideoMemoryEvictionsSize; //!< Size(in bytes) of the total size of memory released as a result of the evictions.
NvU64 dedicatedVideoMemoryEvictionCount; //!< Indicates the number of eviction events that caused an allocation to be removed from dedicated video memory to free GPU
//!< video memory to make room for other allocations.
NvU64 dedicatedVideoMemoryPromotionsSize; //!< Size(in bytes) of the total size of memory allocated as a result of the promotions.
NvU64 dedicatedVideoMemoryPromotionCount; //!< Indicates the number of promotion events that caused an allocation to be promoted to dedicated video memory
} NV_GPU_MEMORY_INFO_EX_V1;
//! \ingroup driverapi
typedef NV_GPU_MEMORY_INFO_EX_V1 NV_GPU_MEMORY_INFO_EX;
//! \ingroup driverapi
//! Macro for constructing the version field of NV_GPU_MEMORY_INFO_EX_V1
#define NV_GPU_MEMORY_INFO_EX_VER_1 MAKE_NVAPI_VERSION(NV_GPU_MEMORY_INFO_EX_V1,1)
//! \ingroup driverapi
#define NV_GPU_MEMORY_INFO_EX_VER NV_GPU_MEMORY_INFO_EX_VER_1
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_GPU_GetMemoryInfoEx
//
//! DESCRIPTION: This function retrieves the available driver memory footprint for the specified GPU.
//! If the GPU is in TCC Mode, only dedicatedVideoMemory will be returned in pMemoryInfo (NV_GPU_MEMORY_INFO_EX).
//!
//! SUPPORTED OS: Windows 10 and higher
//!
//!
//! TCC_SUPPORTED
//!
//! MCDM_SUPPORTED
//!
//! \since Release: 520
//!
//! \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_GPU_MEMORY_INFO_EX.
//!
//! \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_GPU_MEMORY_INFO_EX structure version mismatch.
//!
//! \ingroup driverapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_GPU_GetMemoryInfoEx(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_MEMORY_INFO_EX *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 10 and higher
//!
//!
//! \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__) || defined(__d3d12_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__) || defined(__d3d12_h__)
#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) || defined(__d3d12_h__)
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_D3D_GetObjectHandleForResource
//
//! DESCRIPTION: This API gets a handle to a resource.
//!
//! \param [in] pDev The ID3D11Device, ID3D10Device or IDirect3DDevice9 or ID3D11DeviceContext to use
//! \param [in] pResource The ID3D11Resource, ID3D10Resource or IDirect3DResource9 from which
//! we want the NvAPI handle
//! \param [out] pHandle A handle to the resource
//!
//! SUPPORTED OS: Windows 10 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__) || defined(__d3d12_h__)
#include"imports/nvapi/nvapi_lite_salend.h"
#ifdef __cplusplus
}
#endif
#pragma pack(pop)

View File

@ -0,0 +1,184 @@
/*********************************************************************************************************\
|* *|
|* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. *|
|* SPDX-License-Identifier: MIT *|
|* *|
|* Permission is hereby granted, free of charge, to any person obtaining a *|
|* copy of this software and associated documentation files (the "Software"), *|
|* to deal in the Software without restriction, including without limitation *|
|* the rights to use, copy, modify, merge, publish, distribute, sublicense, *|
|* and/or sell copies of the Software, and to permit persons to whom the *|
|* Software is furnished to do so, subject to the following conditions: *|
|* *|
|* The above copyright notice and this permission notice shall be included in *|
|* all copies or substantial portions of the Software. *|
|* *|
|* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *|
|* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *|
|* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *|
|* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *|
|* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *|
|* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *|
|* DEALINGS IN THE SOFTWARE. *|
|* *|
|* *|
\*********************************************************************************************************/
#pragma once
#include"imports/nvapi/nvapi_lite_salstart.h"
#include"imports/nvapi/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 10 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 10 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 10 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"imports/nvapi/nvapi_lite_salend.h"
#ifdef __cplusplus
}
#endif
#pragma pack(pop)

View File

@ -0,0 +1,809 @@
/*********************************************************************************************************\
|* *|
|* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. *|
|* SPDX-License-Identifier: MIT *|
|* *|
|* Permission is hereby granted, free of charge, to any person obtaining a *|
|* copy of this software and associated documentation files (the "Software"), *|
|* to deal in the Software without restriction, including without limitation *|
|* the rights to use, copy, modify, merge, publish, distribute, sublicense, *|
|* and/or sell copies of the Software, and to permit persons to whom the *|
|* Software is furnished to do so, subject to the following conditions: *|
|* *|
|* The above copyright notice and this permission notice shall be included in *|
|* all copies or substantial portions of the Software. *|
|* *|
|* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *|
|* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *|
|* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *|
|* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *|
|* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *|
|* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *|
|* DEALINGS IN THE SOFTWARE. *|
|* *|
|* *|
\*********************************************************************************************************/
#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

@ -0,0 +1,812 @@
/*********************************************************************************************************\
|* *|
|* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. *|
|* SPDX-License-Identifier: MIT *|
|* *|
|* Permission is hereby granted, free of charge, to any person obtaining a *|
|* copy of this software and associated documentation files (the "Software"), *|
|* to deal in the Software without restriction, including without limitation *|
|* the rights to use, copy, modify, merge, publish, distribute, sublicense, *|
|* and/or sell copies of the Software, and to permit persons to whom the *|
|* Software is furnished to do so, subject to the following conditions: *|
|* *|
|* The above copyright notice and this permission notice shall be included in *|
|* all copies or substantial portions of the Software. *|
|* *|
|* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *|
|* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *|
|* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *|
|* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *|
|* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *|
|* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *|
|* DEALINGS IN THE SOFTWARE. *|
|* *|
|* *|
\*********************************************************************************************************/
// ====================================================
// 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

@ -0,0 +1,247 @@
/*********************************************************************************************************\
|* *|
|* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. *|
|* SPDX-License-Identifier: MIT *|
|* *|
|* Permission is hereby granted, free of charge, to any person obtaining a *|
|* copy of this software and associated documentation files (the "Software"), *|
|* to deal in the Software without restriction, including without limitation *|
|* the rights to use, copy, modify, merge, publish, distribute, sublicense, *|
|* and/or sell copies of the Software, and to permit persons to whom the *|
|* Software is furnished to do so, subject to the following conditions: *|
|* *|
|* The above copyright notice and this permission notice shall be included in *|
|* all copies or substantial portions of the Software. *|
|* *|
|* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *|
|* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *|
|* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *|
|* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *|
|* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *|
|* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *|
|* DEALINGS IN THE SOFTWARE. *|
|* *|
|* *|
\*********************************************************************************************************/
#pragma once
#include"imports/nvapi/nvapi_lite_salstart.h"
#include"imports/nvapi/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_V1;
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
NvU32 numVRSLIGpus; //!< [OUT] The number of GPUs used in VR-SLI. If it is 0 VR-SLI is not active
} NV_GET_CURRENT_SLI_STATE_V2;
//! \ingroup dx
#define NV_GET_CURRENT_SLI_STATE_VER1 MAKE_NVAPI_VERSION(NV_GET_CURRENT_SLI_STATE_V1,1)
#define NV_GET_CURRENT_SLI_STATE_VER2 MAKE_NVAPI_VERSION(NV_GET_CURRENT_SLI_STATE_V2,1)
#define NV_GET_CURRENT_SLI_STATE_VER NV_GET_CURRENT_SLI_STATE_VER2
#define NV_GET_CURRENT_SLI_STATE NV_GET_CURRENT_SLI_STATE_V2
#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 10 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. For DX11 devices this function is free-threaded.
//! An application is responsible to complete this call before making use of the resource
//! in a rendering context (therefore applying inter-thread synchronization as appropriate).
//! As a debug help to an application the driver enforces that a resource in this call was never bound.
//!
//! SUPPORTED OS: Windows 10 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/out] *pdwHintValue Pointer to location containing hint value, function returns previous hint value in this slot
//!
//! \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:
// NVAPI_D3D_SRH_SLI_RESPECT_DRIVER_INTERFRAME_CONTENT_SYNC:
//! \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 it's possible. Hint is static and must be set before resource starts using.
//!
//! NVAPI_D3D_SRH_SLI_RESPECT_DRIVER_INTERFRAME_CONTENT_SYNC: Valid values : 0 or 1 \n
//! Default value: 0 \n
//! Explanation: If the value is 1, the driver will do dirty resource resolve regardless of discard flags in the application profile or
//! AFR-FriendlyD3DHints.exe name 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_SRH_SLI_RESPECT_DRIVER_INTERFRAME_CONTENT_SYNC = 3
} 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 *pDeviceOrContext, 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 10 and higher
//!
//!
//! \since Release: 185
//!
//! \param [in] pDev IDirect3DDevice9, ID3D10Device, ID3D11Device or ID3D11DeviceContext that is 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 *pDeviceOrContext, 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 10 and higher
//!
//!
//! \since Release: 185
//!
//! \param [in] pDev IDirect3DDevice9, ID3D10Device, ID3D11Device or ID3D11DeviceContext that is 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 *pDeviceOrContext, NVDX_ObjectHandle obj, NvU32 Flags);
#endif //if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
#include"imports/nvapi/nvapi_lite_salend.h"
#ifdef __cplusplus
}
#endif
#pragma pack(pop)

View File

@ -0,0 +1,592 @@
/*********************************************************************************************************\
|* *|
|* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. *|
|* SPDX-License-Identifier: MIT *|
|* *|
|* Permission is hereby granted, free of charge, to any person obtaining a *|
|* copy of this software and associated documentation files (the "Software"), *|
|* to deal in the Software without restriction, including without limitation *|
|* the rights to use, copy, modify, merge, publish, distribute, sublicense, *|
|* and/or sell copies of the Software, and to permit persons to whom the *|
|* Software is furnished to do so, subject to the following conditions: *|
|* *|
|* The above copyright notice and this permission notice shall be included in *|
|* all copies or substantial portions of the Software. *|
|* *|
|* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *|
|* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *|
|* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *|
|* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *|
|* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *|
|* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *|
|* DEALINGS IN THE SOFTWARE. *|
|* *|
|* *|
\*********************************************************************************************************/
#pragma once
#include"imports/nvapi/nvapi_lite_salstart.h"
#include"imports/nvapi/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 10 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 10 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 10 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__)|| defined(__d3d12_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 10 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 10 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 10 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 10 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 10 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 10 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 10 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 10 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 10 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 10 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 10 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 10 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 10 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 10 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 10 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 10 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 10 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 10 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"imports/nvapi/nvapi_lite_salend.h"
#ifdef __cplusplus
}
#endif
#pragma pack(pop)

View File

@ -0,0 +1,95 @@
/*********************************************************************************************************\
|* *|
|* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. *|
|* SPDX-License-Identifier: MIT *|
|* *|
|* Permission is hereby granted, free of charge, to any person obtaining a *|
|* copy of this software and associated documentation files (the "Software"), *|
|* to deal in the Software without restriction, including without limitation *|
|* the rights to use, copy, modify, merge, publish, distribute, sublicense, *|
|* and/or sell copies of the Software, and to permit persons to whom the *|
|* Software is furnished to do so, subject to the following conditions: *|
|* *|
|* The above copyright notice and this permission notice shall be included in *|
|* all copies or substantial portions of the Software. *|
|* *|
|* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *|
|* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *|
|* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *|
|* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *|
|* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *|
|* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *|
|* DEALINGS IN THE SOFTWARE. *|
|* *|
|* *|
\*********************************************************************************************************/
#pragma once
#include"imports/nvapi/nvapi_lite_salstart.h"
#include"imports/nvapi/nvapi_lite_common.h"
#pragma pack(push,8)
#ifdef __cplusplus
extern "C" {
#endif
//! SUPPORTED OS: Windows 10 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)
///////////////////////////////////////////////////////////////////////////////
//
// 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.
//! SUPPORTED OS: Windows 10 and higher
//!
//! 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"imports/nvapi/nvapi_lite_salend.h"
#ifdef __cplusplus
}
#endif
#pragma pack(pop)

View File

@ -96,4 +96,14 @@ const char *avs_util_error_str(avs_error error)
}
return avs_util_error_unknown;
}
const char *avs_util_property_error_get_and_clear(struct property *prop)
{
avs_error error;
error = property_get_error(prop);
property_clear_error(prop);
return avs_util_error_str(error);
}

View File

@ -5,4 +5,6 @@
const char *avs_util_error_str(avs_error error);
#endif
const char *avs_util_property_error_get_and_clear(struct property *prop);
#endif

View File

@ -8,4 +8,5 @@ libs_camhook := \
src_camhook := \
cam.c \
cam-detect.c \
config-cam.c \

View File

@ -0,0 +1,402 @@
#define LOG_MODULE "cam-hook"
// clang-format off
// Don't format because the order is important here
#include <windows.h>
#include <initguid.h>
// clang-format on
#include <mfapi.h>
#include <mfidl.h>
#include <mfobjects.h>
#include <cfgmgr32.h>
#include <setupapi.h>
#include <stdio.h>
#include "camhook/cam-detect.h"
#include "util/defs.h"
#include "util/log.h"
#include "util/str.h"
EXTERN_GUID(
MY_MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE,
0xc60ac5fe,
0x252a,
0x478f,
0xa0,
0xef,
0xbc,
0x8f,
0xa5,
0xf7,
0xca,
0xd3);
EXTERN_GUID(
MY_MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID,
0x8ac3587a,
0x4ae7,
0x42d8,
0x99,
0xe0,
0x0a,
0x60,
0x13,
0xee,
0xf9,
0x0f);
EXTERN_GUID(
MY_MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK,
0x58f0aad8,
0x22bf,
0x4f8a,
0xbb,
0x3d,
0xd2,
0xc4,
0x97,
0x8c,
0x6e,
0x2f);
// define ourselves cause mingw has these wrong
bool check_four(const char inA[4], const char inB[4])
{
return (*(uint32_t *) inA == *(uint32_t *) inB);
}
char *grab_next_camera_id(char *buffer, size_t bsz)
{
static size_t gotten = 0;
IMFAttributes *pAttributes = NULL;
IMFActivate **ppDevices = NULL;
buffer[0] = '\0';
HRESULT hr = MFCreateAttributes(&pAttributes, 1);
if (FAILED(hr)) {
log_info("MFCreateAttributes failed: %ld", hr);
goto done;
}
hr = pAttributes->lpVtbl->SetGUID(
pAttributes,
&MY_MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE,
&MY_MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID);
if (FAILED(hr)) {
log_info("SetGUID failed: %ld", hr);
goto done;
}
UINT32 count;
hr = MFEnumDeviceSources(pAttributes, &ppDevices, &count);
if (FAILED(hr)) {
log_info("MFEnumDeviceSources failed: %ld", hr);
goto done;
}
if (count <= gotten) {
log_info("gotten failed: %d < %d", count, (int) gotten);
// not enough remaining
goto done;
}
wchar_t wSymLink[CAMERA_DATA_STRING_SIZE];
UINT32 sz;
hr = ppDevices[gotten]->lpVtbl->GetString(
ppDevices[gotten],
&MY_MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK,
wSymLink,
CAMERA_DATA_STRING_SIZE,
&sz);
if (FAILED(hr)) {
log_info("GetString failed: %ld", hr);
goto done;
}
wcstombs(buffer, wSymLink, bsz);
log_info("Detected webcam: %s\n", buffer);
++gotten;
done:
if (pAttributes) {
pAttributes->lpVtbl->Release(pAttributes);
}
for (DWORD i = 0; i < count; i++) {
if (ppDevices != NULL && ppDevices[i]) {
ppDevices[i]->lpVtbl->Release(ppDevices[i]);
}
}
CoTaskMemFree(ppDevices);
return buffer;
}
bool convert_sym_to_path(const char *sym, char *path)
{
HDEVINFO DeviceInfoSet = SetupDiCreateDeviceInfoList(NULL, NULL);
if (DeviceInfoSet == INVALID_HANDLE_VALUE) {
log_info("Could not open SetupDiCreateDeviceInfoList\n");
return 0;
}
SP_DEVICE_INTERFACE_DATA DeviceInterfaceData = {0};
DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
if (!SetupDiOpenDeviceInterfaceA(
DeviceInfoSet, sym, 0, &DeviceInterfaceData)) {
log_info("Could not SetupDiOpenDeviceInterfaceA\n");
return 0;
}
SP_DEVINFO_DATA DeviceInfoData = {0};
DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
if (!SetupDiGetDeviceInterfaceDetailA(
DeviceInfoSet,
&DeviceInterfaceData,
NULL,
0,
NULL,
&DeviceInfoData)) {
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
log_info("Could not SetupDiGetDeviceInterfaceDetailA\n");
return 0;
}
}
DWORD sz;
if (!SetupDiGetDeviceInstanceIdA(
DeviceInfoSet,
&DeviceInfoData,
path,
CAMERA_DATA_STRING_SIZE,
&sz)) {
log_info("Could not SetupDiGetDeviceInstanceIdA\n");
return 0;
}
if (DeviceInfoSet != INVALID_HANDLE_VALUE) {
if (!SetupDiDeleteDeviceInterfaceData(
DeviceInfoSet, &DeviceInterfaceData)) {
log_info("Could not SetupDiDeleteDeviceInterfaceData\n");
return 0;
}
SetupDiDestroyDeviceInfoList(DeviceInfoSet);
}
return 1;
}
void strtolower(char *str)
{
for (size_t i = 0; str[i]; i++) {
str[i] = tolower(str[i]);
}
}
bool convert_path_to_fakesym(const char *path, wchar_t *sym, char *extra_o)
{
char root[16] = {0};
char vidstr[16] = {0};
char pidstr[16] = {0};
char mistr[16] = {0};
char extra[64] = {0};
sscanf(
path,
"%[^\\]\\%[^&]&%[^&]&%[^\\]\\%s",
root,
vidstr,
pidstr,
mistr,
extra);
strcpy(extra_o, extra);
strtolower(root);
strtolower(vidstr);
strtolower(pidstr);
strtolower(mistr);
strtolower(extra);
char buffer[CAMERA_DATA_STRING_SIZE];
snprintf(
buffer,
CAMERA_DATA_STRING_SIZE,
"\\\\?\\%s#%s&%s&%s#%s",
root,
vidstr,
pidstr,
mistr,
extra);
mbstowcs(sym, buffer, CAMERA_DATA_STRING_SIZE);
return true;
}
void fill_cam_struct(struct camera_data *data, const char *devid)
{
char buffer[CAMERA_DATA_STRING_SIZE];
data->setup = false;
if (!devid || strlen(devid) == 0) {
devid = grab_next_camera_id(buffer, CAMERA_DATA_STRING_SIZE);
}
if (!devid || strlen(devid) == 0) {
// no more cameras remain?
return;
}
if (strlen(devid) >= CAMERA_DATA_STRING_SIZE) {
// error probably log something?
return;
}
// detect input type
if (check_four(devid, "\\\\?\\")) {
// SYMBOLIC_LINK
if (!convert_sym_to_path(devid, data->deviceInstancePath)) {
log_info("Could not convert %s to path", devid);
return;
}
} else if (check_four(devid, "USB\\")) {
// Device instance path
strcpy(data->deviceInstancePath, devid);
// continue
} else {
// UNKNOWN ENTRY
log_info("UNK: %s", devid);
log_info("Please enter the device instance path");
return;
}
if (!convert_path_to_fakesym(
data->deviceInstancePath,
data->deviceSymbolicLink,
data->extra_upper)) {
log_info("Could not convert %s to sym", data->deviceInstancePath);
return;
}
log_info("dev path: %s", data->deviceInstancePath);
char* vid_str = strstr(data->deviceInstancePath, "VID_");
char* pid_str = strstr(data->deviceInstancePath, "PID_");
if (!vid_str || !pid_str) {
log_info("Could not parse VID/PID in %s", data->deviceInstancePath);
return;
}
data->vid = strtol(vid_str + 4, NULL, 16);
data->pid = strtol(pid_str + 4, NULL, 16);
log_info("vid: %04x", data->vid);
log_info("pid: %04x", data->pid);
// locate device nodes
DEVINST dnDevInst;
DEVINST parentDev;
CONFIGRET cmret;
cmret = CM_Locate_DevNodeA(
&dnDevInst, data->deviceInstancePath, CM_LOCATE_DEVNODE_NORMAL);
if (cmret != CR_SUCCESS) {
log_info("CM_Locate_DevNodeA fail: %s", data->deviceInstancePath);
return;
}
cmret = CM_Get_Parent(&parentDev, dnDevInst, 0);
if (cmret != CR_SUCCESS) {
log_info("CM_Get_Parent fail: %s", data->deviceInstancePath);
return;
}
cmret = CM_Get_Device_IDA(
parentDev, data->parent_deviceInstancePath, CAMERA_DATA_STRING_SIZE, 0);
if (cmret != CR_SUCCESS) {
log_info("CM_Get_Device_IDA parent fail: %s", data->deviceInstancePath);
return;
}
ULONG szAddr;
ULONG szDesc;
ULONG szDriverKey;
szAddr = 4;
cmret = CM_Get_DevNode_Registry_PropertyA(
dnDevInst, CM_DRP_ADDRESS, NULL, &data->address, &szAddr, 0);
if (cmret != CR_SUCCESS) {
log_info(
"CM_Get_DevNode_Registry_PropertyA CM_DRP_ADDRESS fail: %s",
data->deviceInstancePath);
return;
}
szDesc = CAMERA_DATA_STRING_SIZE;
cmret = CM_Get_DevNode_Registry_PropertyA(
dnDevInst, CM_DRP_DEVICEDESC, NULL, &data->name, &szDesc, 0);
if (cmret != CR_SUCCESS) {
log_info(
"CM_Get_DevNode_Registry_PropertyA CM_DRP_DEVICEDESC fail: %s",
data->deviceInstancePath);
return;
}
szAddr = 4;
cmret = CM_Get_DevNode_Registry_PropertyA(
parentDev, CM_DRP_ADDRESS, NULL, &data->parent_address, &szAddr, 0);
if (cmret != CR_SUCCESS) {
log_info(
"CM_Get_DevNode_Registry_PropertyA CM_DRP_ADDRESS parent fail: %s",
data->deviceInstancePath);
return;
}
szDesc = CAMERA_DATA_STRING_SIZE;
cmret = CM_Get_DevNode_Registry_PropertyA(
parentDev, CM_DRP_DEVICEDESC, NULL, &data->parent_name, &szDesc, 0);
if (cmret != CR_SUCCESS) {
log_info(
"CM_Get_DevNode_Registry_PropertyA CM_DRP_DEVICEDESC parent fail: %s",
data->deviceInstancePath);
return;
}
szDriverKey = CAMERA_DATA_STRING_SIZE;
cmret = CM_Get_DevNode_Registry_PropertyA(
parentDev, CM_DRP_DRIVER, NULL, &data->parent_driverKey, &szDriverKey, 0);
if (cmret != CR_SUCCESS) {
log_info(
"CM_Get_DevNode_Registry_PropertyA CM_DRP_DRIVER parent fail: %s",
data->deviceInstancePath);
return;
}
log_info("Found %s @ %d", data->name, data->address);
log_info("Parent %s @ %d %s", data->parent_name, data->parent_address, data->parent_driverKey);
data->setup = true;
}

View File

@ -0,0 +1,34 @@
#ifndef CAMHOOK_CAM_DETECT_H
#define CAMHOOK_CAM_DETECT_H
#include <stdbool.h>
#include <stdint.h>
#include <wchar.h>
#define CAMERA_DATA_STRING_SIZE 0x100
struct camera_data {
bool setup;
char name[CAMERA_DATA_STRING_SIZE];
char deviceInstancePath[CAMERA_DATA_STRING_SIZE];
wchar_t deviceSymbolicLink[CAMERA_DATA_STRING_SIZE];
char extra_upper[CAMERA_DATA_STRING_SIZE];
int address;
char parent_name[CAMERA_DATA_STRING_SIZE];
char parent_driverKey[CAMERA_DATA_STRING_SIZE];
char parent_deviceInstancePath[CAMERA_DATA_STRING_SIZE];
int parent_address;
int16_t vid;
int16_t pid;
bool fake_addressed;
int fake_address;
bool fake_located;
size_t fake_located_node;
};
void fill_cam_struct(struct camera_data *data, const char *devid);
#endif

View File

@ -4,6 +4,8 @@
// Don't format because the order is important here
#include <windows.h>
#include <initguid.h>
#include <winioctl.h>
#include <usbioctl.h>
// clang-format on
#include <mfapi.h>
@ -19,80 +21,25 @@
#include "hook/table.h"
#include "camhook/cam.h"
#include "camhook/cam-detect.h"
#include "util/defs.h"
#include "util/log.h"
#include "util/str.h"
#include "util/time.h"
#define CAMERA_DATA_STRING_SIZE 0x100
#define CAMHOOK_NUM_LAYOUTS 3
EXTERN_GUID(
MY_MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE,
0xc60ac5fe,
0x252a,
0x478f,
0xa0,
0xef,
0xbc,
0x8f,
0xa5,
0xf7,
0xca,
0xd3);
EXTERN_GUID(
MY_MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID,
0x8ac3587a,
0x4ae7,
0x42d8,
0x99,
0xe0,
0x0a,
0x60,
0x13,
0xee,
0xf9,
0x0f);
EXTERN_GUID(
MY_MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK,
0x58f0aad8,
0x22bf,
0x4f8a,
0xbb,
0x3d,
0xd2,
0xc4,
0x97,
0x8c,
0x6e,
0x2f);
// define ourselves cause mingw has these wrong
struct CameraData {
bool setup;
char name[CAMERA_DATA_STRING_SIZE];
char deviceInstancePath[CAMERA_DATA_STRING_SIZE];
wchar_t deviceSymbolicLink[CAMERA_DATA_STRING_SIZE];
char extra_upper[CAMERA_DATA_STRING_SIZE];
int address;
char parent_name[CAMERA_DATA_STRING_SIZE];
char parent_deviceInstancePath[CAMERA_DATA_STRING_SIZE];
int parent_address;
bool fake_addressed;
int fake_address;
bool fake_located;
size_t fake_located_node;
};
static struct CameraData camData[CAMHOOK_CONFIG_CAM_MAX];
int camAddresses[CAMHOOK_CONFIG_CAM_MAX] = {
1,
7,
static struct camera_data camData[CAMHOOK_CONFIG_CAM_MAX];
int camAddresses[CAMHOOK_NUM_LAYOUTS][CAMHOOK_CONFIG_CAM_MAX] = {
{1, 7},
{4, 9},
{4, 3},
};
static size_t num_addressed_cams = 0;
static size_t num_located_cams = 0;
static int camhook_port_layout = 0;
static enum camhook_version camhook_version = CAMHOOK_VERSION_OLD;
static CONFIGRET my_CM_Locate_DevNodeA(
PDEVINST pdnDevInst, DEVINSTID_A pDeviceID, ULONG ulFlags);
@ -156,6 +103,26 @@ static HDEVINFO my_SetupDiGetClassDevsA(
static HDEVINFO (*real_SetupDiGetClassDevsA)(
CONST GUID *ClassGuid, PCSTR Enumerator, HWND hwndParent, DWORD Flags);
static BOOL STDCALL my_DeviceIoControl(
HANDLE hFile,
uint32_t dwIoControlCode,
void *lpInBuffer,
uint32_t nInBufferSize,
void *lpOutBuffer,
uint32_t nOutBufferSize,
uint32_t *lpBytesReturned,
OVERLAPPED *lpOverlapped);
static BOOL(STDCALL *real_DeviceIoControl)(
HANDLE fd,
uint32_t code,
void *in_bytes,
uint32_t in_nbytes,
void *out_bytes,
uint32_t out_nbytes,
uint32_t *out_returned,
OVERLAPPED *ovl);
static const struct hook_symbol camhook_cfgmgr32_syms[] = {
{.name = "CM_Locate_DevNodeA",
.patch = my_CM_Locate_DevNodeA,
@ -180,12 +147,24 @@ static const struct hook_symbol camhook_cfgmgr32_syms[] = {
.link = (void **) &real_SetupDiGetClassDevsA},
};
static const struct hook_symbol camhook_cfgmgr32_syms_new[] = {
{.name = "CM_Locate_DevNodeA",
.patch = my_CM_Locate_DevNodeA,
.link = (void **) &real_CM_Locate_DevNodeA},
};
static const struct hook_symbol camhook_mf_syms[] = {
{.name = "MFEnumDeviceSources",
.patch = my_MFEnumDeviceSources,
.link = (void **) &real_MFEnumDeviceSources},
};
static struct hook_symbol camhook_ioctl_syms[] = {
{.name = "DeviceIoControl",
.patch = my_DeviceIoControl,
.link = (void *) &real_DeviceIoControl},
};
DEVINST camhook_custom_nodes[CAMHOOK_CONFIG_CAM_MAX] = {
0x04040004,
0x04040008,
@ -209,25 +188,42 @@ my_CM_Locate_DevNodeA(PDEVINST pdnDevInst, DEVINSTID_A pDeviceID, ULONG ulFlags)
log_info("seeking: %s", pDeviceID);
for (size_t i = 0; i < CAMHOOK_CONFIG_CAM_MAX; ++i) {
if (camData[i].setup) {
snprintf(
builtString,
CAMERA_DATA_STRING_SIZE,
"USB\\VID_288C&PID_0002&MI_00\\%s",
camData[i].extra_upper);
if (camhook_version == CAMHOOK_VERSION_OLD) {
snprintf(
builtString,
CAMERA_DATA_STRING_SIZE,
"USB\\VID_288C&PID_0002&MI_00\\%s",
camData[i].extra_upper);
} else if (camhook_version == CAMHOOK_VERSION_NEW) {
snprintf(
builtString,
CAMERA_DATA_STRING_SIZE,
"USB\\VID_05A3&PID_9230&MI_00\\%s",
camData[i].extra_upper);
}
log_info("built: %s", builtString);
if (strcmp(pDeviceID, builtString) == 0) {
if (!camData[i].fake_located) {
camData[i].fake_located_node = num_located_cams;
camData[i].fake_located = true;
++num_located_cams;
if (camhook_version == CAMHOOK_VERSION_OLD) {
if (!camData[i].fake_located) {
camData[i].fake_located_node = num_located_cams;
camData[i].fake_located = true;
++num_located_cams;
}
log_info(
"Injecting custom device %d to node %x",
(int) i,
(int) camData[i].fake_located_node);
*pdnDevInst =
camhook_custom_nodes[camData[i].fake_located_node];
return CR_SUCCESS;
} else if (camhook_version == CAMHOOK_VERSION_NEW) {
// inject original device
log_info(
"Injecting original device %d %s -> %s",
(int) i, pDeviceID, camData[i].deviceInstancePath);
pDeviceID = camData[i].deviceInstancePath;
}
log_info(
"Injecting custom device %d to node %x",
(int) i,
(int) camData[i].fake_located_node);
*pdnDevInst =
camhook_custom_nodes[camData[i].fake_located_node];
return CR_SUCCESS;
}
}
}
@ -278,9 +274,9 @@ HRESULT my_GetAllocatedString(
IMFActivate *self, REFGUID guidKey, LPWSTR *ppwszValue, UINT32 *pcchLength)
{
HRESULT ret;
log_info("Inside: %s", __FUNCTION__);
// log_info("Inside: %s", __FUNCTION__);
// should probably check GUID, oh well
// should probably check GUID == MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK, oh well
ret = real_GetAllocatedString(self, guidKey, ppwszValue, pcchLength);
char *pMBBuffer = (char *) malloc(0x100);
wcstombs(pMBBuffer, *ppwszValue, 0x100);
@ -299,19 +295,35 @@ HRESULT my_GetAllocatedString(
// if matches, replace with target device ID
if (pwc) {
// \\?\usb#vid_288c&pid_0002&mi_00
pwc[12] = L'2';
pwc[13] = L'8';
pwc[14] = L'8';
pwc[15] = L'c';
if (camhook_version == CAMHOOK_VERSION_OLD) {
// \\?\usb#vid_288c&pid_0002&mi_00
pwc[12] = L'2';
pwc[13] = L'8';
pwc[14] = L'8';
pwc[15] = L'c';
pwc[21] = L'0';
pwc[22] = L'0';
pwc[23] = L'0';
pwc[24] = L'2';
pwc[21] = L'0';
pwc[22] = L'0';
pwc[23] = L'0';
pwc[24] = L'2';
pwc[29] = L'0';
pwc[30] = L'0';
pwc[29] = L'0';
pwc[30] = L'0';
} else if (camhook_version == CAMHOOK_VERSION_NEW) {
// \\?\usb#vid_05a3&pid_9230&mi_00
pwc[12] = L'0';
pwc[13] = L'5';
pwc[14] = L'a';
pwc[15] = L'3';
pwc[21] = L'9';
pwc[22] = L'2';
pwc[23] = L'3';
pwc[24] = L'0';
pwc[29] = L'0';
pwc[30] = L'0';
}
wcstombs(pMBBuffer, *ppwszValue, 0x100);
log_info("Replaced: %s", pMBBuffer);
@ -334,7 +346,7 @@ static HRESULT my_MFEnumDeviceSources(
HRESULT ret;
log_info("Inside: %s", __FUNCTION__);
// log_info("Inside: %s", __FUNCTION__);
ret = real_MFEnumDeviceSources(
pAttributes, pppSourceActivate, pcSourceActivate);
nsrcs = *pcSourceActivate;
@ -437,8 +449,9 @@ static BOOL my_SetupDiGetDeviceRegistryPropertyA(
if (camData[i].setup) {
if (addr == camData[i].parent_address) {
if (!camData[i].fake_addressed) {
// old style always uses set 0
camData[i].fake_address =
camAddresses[num_addressed_cams];
camAddresses[0][num_addressed_cams];
camData[i].fake_addressed = true;
++num_addressed_cams;
}
@ -491,315 +504,180 @@ static HDEVINFO my_SetupDiGetClassDevsA(
return real_SetupDiGetClassDevsA(ClassGuid, Enumerator, hwndParent, Flags);
}
bool check_four(const char inA[4], const char inB[4])
ULONG get_matching_device_replacement_id(
HANDLE hFile,
ULONG ConnectionIndex,
USB_DEVICE_DESCRIPTOR* desc)
{
return (*(uint32_t *) inA == *(uint32_t *) inB);
}
ULONG replacement_id = 0;
for (size_t i = 0; i < CAMHOOK_CONFIG_CAM_MAX; ++i) {
if (camData[i].setup) {
// log_info("Checking %lu %04x %04x vs %lu %04x %04x",
// ConnectionIndex, desc->idVendor, desc->idProduct,
// camData[i].address, camData[i].vid, camData[i].pid);
if (
ConnectionIndex == camData[i].parent_address &&
desc->idVendor == camData[i].vid &&
desc->idProduct == camData[i].pid
) {
// do secondary check for driver key using
// IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME
USB_NODE_CONNECTION_DRIVERKEY_NAME req;
req.ActualLength = 0;
req.ConnectionIndex = ConnectionIndex;
req.DriverKeyName[0] = '\0';
char *grab_next_camera_id(char *buffer, size_t bsz)
{
static size_t gotten = 0;
DWORD nBytes;
IMFAttributes *pAttributes = NULL;
IMFActivate **ppDevices = NULL;
if (!DeviceIoControl(
hFile,
IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME,
&req,
sizeof(req),
&req,
sizeof(req),
&nBytes,
0LL
)) {
log_warning(
"Failed to get driver key name size for device %04x %04x",
desc->idVendor,
desc->idProduct);
continue;
}
buffer[0] = '\0';
if (req.ActualLength <= sizeof(req)) {
log_warning(
"Driver key name size too small for device %04x %04x",
desc->idVendor,
desc->idProduct);
continue;
}
HRESULT hr = MFCreateAttributes(&pAttributes, 1);
nBytes = req.ActualLength;
if (FAILED(hr)) {
log_info("MFCreateAttributes failed: %ld", hr);
goto done;
}
USB_NODE_CONNECTION_DRIVERKEY_NAME *driverKeyNameW = malloc(nBytes);
if (!driverKeyNameW) {
log_warning("Failed to allocate driver key name buffer for device %04x %04x",
desc->idVendor,
desc->idProduct);
continue;
}
driverKeyNameW->ActualLength = 0;
driverKeyNameW->ConnectionIndex = ConnectionIndex;
driverKeyNameW->DriverKeyName[0] = '\0';
hr = pAttributes->lpVtbl->SetGUID(
pAttributes,
&MY_MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE,
&MY_MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID);
if (FAILED(hr)) {
log_info("SetGUID failed: %ld", hr);
goto done;
}
if (!DeviceIoControl(
hFile,
IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME,
driverKeyNameW,
nBytes,
driverKeyNameW,
nBytes,
&nBytes,
0LL
)) {
log_warning(
"Failed to get driver key name for device %04x %04x",
desc->idVendor,
desc->idProduct);
continue;
}
UINT32 count;
hr = MFEnumDeviceSources(pAttributes, &ppDevices, &count);
char *driverKeyNameA = NULL;
wstr_narrow(driverKeyNameW->DriverKeyName, &driverKeyNameA);
if (FAILED(hr)) {
log_info("MFEnumDeviceSources failed: %ld", hr);
goto done;
}
free(driverKeyNameW);
if (count <= gotten) {
log_info("gotten failed: %d < %d", count, (int) gotten);
// not enough remaining
goto done;
}
wchar_t wSymLink[CAMERA_DATA_STRING_SIZE];
UINT32 sz;
if (strcmp(driverKeyNameA, camData[i].parent_driverKey) != 0) {
// log just in case?
log_info(
"Driver key name mismatch for device %04x %04x %s != %s",
desc->idVendor,
desc->idProduct,
driverKeyNameA,
camData[i].parent_driverKey);
if (driverKeyNameA) {
free(driverKeyNameA);
}
continue;
}
hr = ppDevices[gotten]->lpVtbl->GetString(
ppDevices[gotten],
&MY_MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK,
wSymLink,
CAMERA_DATA_STRING_SIZE,
&sz);
log_info(
"Replacing device @ %lu with %d for %04x %04x %s",
ConnectionIndex,
camAddresses[camhook_port_layout][i],
desc->idVendor,
desc->idProduct,
driverKeyNameA);
if (FAILED(hr)) {
log_info("GetString failed: %ld", hr);
goto done;
}
if (driverKeyNameA) {
free(driverKeyNameA);
}
wcstombs(buffer, wSymLink, bsz);
log_info("Detected webcam: %s\n", buffer);
++gotten;
done:
if (pAttributes) {
pAttributes->lpVtbl->Release(pAttributes);
}
for (DWORD i = 0; i < count; i++) {
if (ppDevices != NULL && ppDevices[i]) {
ppDevices[i]->lpVtbl->Release(ppDevices[i]);
replacement_id = camAddresses[camhook_port_layout][i];
break;
}
}
}
CoTaskMemFree(ppDevices);
return buffer;
return replacement_id;
}
bool convert_sym_to_path(const char *sym, char *path)
static BOOL STDCALL my_DeviceIoControl(
HANDLE hFile,
uint32_t dwIoControlCode,
void *lpInBuffer,
uint32_t nInBufferSize,
void *lpOutBuffer,
uint32_t nOutBufferSize,
uint32_t *lpBytesReturned,
OVERLAPPED *lpOverlapped)
{
HDEVINFO DeviceInfoSet = SetupDiCreateDeviceInfoList(NULL, NULL);
BOOL res;
if (DeviceInfoSet == INVALID_HANDLE_VALUE) {
log_info("Could not open SetupDiCreateDeviceInfoList\n");
return 0;
res = real_DeviceIoControl(
hFile,
dwIoControlCode,
lpInBuffer,
nInBufferSize,
lpOutBuffer,
nOutBufferSize,
lpBytesReturned,
lpOverlapped);
// if error just return
if (!res) {
return res;
}
SP_DEVICE_INTERFACE_DATA DeviceInterfaceData = {0};
DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
// detect IOCTL_USB_GET_NODE_CONNECTION_INFORMATION (_EX)
// we don't bother faking the rest as it's never read
if (dwIoControlCode == IOCTL_USB_GET_NODE_CONNECTION_INFORMATION) {
USB_NODE_CONNECTION_INFORMATION *connectionInfo = lpOutBuffer;
if (!SetupDiOpenDeviceInterfaceA(
DeviceInfoSet, sym, 0, &DeviceInterfaceData)) {
log_info("Could not SetupDiOpenDeviceInterfaceA\n");
return 0;
}
ULONG replacement_id = get_matching_device_replacement_id(
hFile, connectionInfo->ConnectionIndex, &connectionInfo->DeviceDescriptor);
if (replacement_id > 0) {
connectionInfo->ConnectionIndex = replacement_id;
}
} else if (dwIoControlCode == IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX) {
USB_NODE_CONNECTION_INFORMATION_EX *connectionInfoEx = lpOutBuffer;
SP_DEVINFO_DATA DeviceInfoData = {0};
DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
if (!SetupDiGetDeviceInterfaceDetailA(
DeviceInfoSet,
&DeviceInterfaceData,
NULL,
0,
NULL,
&DeviceInfoData)) {
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
log_info("Could not SetupDiGetDeviceInterfaceDetailA\n");
return 0;
ULONG replacement_id = get_matching_device_replacement_id(
hFile, connectionInfoEx->ConnectionIndex, &connectionInfoEx->DeviceDescriptor);
if (replacement_id > 0) {
connectionInfoEx->ConnectionIndex = replacement_id;
}
}
DWORD sz;
if (!SetupDiGetDeviceInstanceIdA(
DeviceInfoSet,
&DeviceInfoData,
path,
CAMERA_DATA_STRING_SIZE,
&sz)) {
log_info("Could not SetupDiGetDeviceInstanceIdA\n");
return 0;
}
if (DeviceInfoSet != INVALID_HANDLE_VALUE) {
if (!SetupDiDeleteDeviceInterfaceData(
DeviceInfoSet, &DeviceInterfaceData)) {
log_info("Could not SetupDiDeleteDeviceInterfaceData\n");
return 0;
}
SetupDiDestroyDeviceInfoList(DeviceInfoSet);
}
return 1;
return res;
}
void strtolower(char *str)
{
for (size_t i = 0; str[i]; i++) {
str[i] = tolower(str[i]);
}
}
bool convert_path_to_fakesym(const char *path, wchar_t *sym, char *extra_o)
{
char root[16] = {0};
char vidstr[16] = {0};
char pidstr[16] = {0};
char mistr[16] = {0};
char extra[64] = {0};
sscanf(
path,
"%[^\\]\\%[^&]&%[^&]&%[^\\]\\%s",
root,
vidstr,
pidstr,
mistr,
extra);
strcpy(extra_o, extra);
strtolower(root);
strtolower(vidstr);
strtolower(pidstr);
strtolower(mistr);
strtolower(extra);
char buffer[CAMERA_DATA_STRING_SIZE];
snprintf(
buffer,
CAMERA_DATA_STRING_SIZE,
"\\\\?\\%s#%s&%s&%s#%s",
root,
vidstr,
pidstr,
mistr,
extra);
mbstowcs(sym, buffer, CAMERA_DATA_STRING_SIZE);
return true;
}
void fill_cam_struct(struct CameraData *data, const char *devid)
{
char buffer[CAMERA_DATA_STRING_SIZE];
data->setup = false;
if (!devid || strlen(devid) == 0) {
devid = grab_next_camera_id(buffer, CAMERA_DATA_STRING_SIZE);
}
if (!devid || strlen(devid) == 0) {
// no more cameras remain?
return;
}
if (strlen(devid) >= CAMERA_DATA_STRING_SIZE) {
// error probably log something?
return;
}
// detect input type
if (check_four(devid, "\\\\?\\")) {
// SYMBOLIC_LINK
if (!convert_sym_to_path(devid, data->deviceInstancePath)) {
log_info("Could not convert %s to path", devid);
return;
}
} else if (check_four(devid, "USB\\")) {
// Device instance path
strcpy(data->deviceInstancePath, devid);
// continue
} else {
// UNKNOWN ENTRY
log_info("UNK: %s", devid);
log_info("Please enter the device instance path");
return;
}
if (!convert_path_to_fakesym(
data->deviceInstancePath,
data->deviceSymbolicLink,
data->extra_upper)) {
log_info("Could not convert %s to sym", data->deviceInstancePath);
return;
}
log_info("dev path: %s", data->deviceInstancePath);
// locate device nodes
DEVINST dnDevInst;
DEVINST parentDev;
CONFIGRET cmret;
cmret = CM_Locate_DevNodeA(
&dnDevInst, data->deviceInstancePath, CM_LOCATE_DEVNODE_NORMAL);
if (cmret != CR_SUCCESS) {
log_info("CM_Locate_DevNodeA fail: %s", data->deviceInstancePath);
return;
}
cmret = CM_Get_Parent(&parentDev, dnDevInst, 0);
if (cmret != CR_SUCCESS) {
log_info("CM_Get_Parent fail: %s", data->deviceInstancePath);
return;
}
cmret = CM_Get_Device_IDA(
parentDev, data->parent_deviceInstancePath, CAMERA_DATA_STRING_SIZE, 0);
if (cmret != CR_SUCCESS) {
log_info("CM_Get_Device_IDA parent fail: %s", data->deviceInstancePath);
return;
}
ULONG szAddr;
ULONG szDesc;
szAddr = 4;
szDesc = CAMERA_DATA_STRING_SIZE;
cmret = CM_Get_DevNode_Registry_PropertyA(
dnDevInst, CM_DRP_ADDRESS, NULL, &data->address, &szAddr, 0);
if (cmret != CR_SUCCESS) {
log_info(
"CM_Get_DevNode_Registry_PropertyA fail: %s",
data->deviceInstancePath);
return;
}
cmret = CM_Get_DevNode_Registry_PropertyA(
dnDevInst, CM_DRP_DEVICEDESC, NULL, &data->name, &szDesc, 0);
if (cmret != CR_SUCCESS) {
log_info(
"CM_Get_DevNode_Registry_PropertyA fail: %s",
data->deviceInstancePath);
return;
}
szAddr = 4;
szDesc = CAMERA_DATA_STRING_SIZE;
cmret = CM_Get_DevNode_Registry_PropertyA(
parentDev, CM_DRP_ADDRESS, NULL, &data->parent_address, &szAddr, 0);
if (cmret != CR_SUCCESS) {
log_info(
"CM_Get_DevNode_Registry_PropertyA parent fail: %s",
data->deviceInstancePath);
return;
}
cmret = CM_Get_DevNode_Registry_PropertyA(
parentDev, CM_DRP_DEVICEDESC, NULL, &data->parent_name, &szDesc, 0);
if (cmret != CR_SUCCESS) {
log_info(
"CM_Get_DevNode_Registry_PropertyA parent fail: %s",
data->deviceInstancePath);
return;
}
log_info("Found %s @ %d", data->name, data->address);
log_info("Parent %s @ %d", data->parent_name, data->parent_address);
data->setup = true;
void camhook_set_version(enum camhook_version version) {
camhook_version = version;
}
void camhook_init(struct camhook_config_cam *config_cam)
@ -827,15 +705,42 @@ void camhook_init(struct camhook_config_cam *config_cam)
}
}
camhook_port_layout = config_cam->port_layout;
if (camhook_port_layout < 0 || camhook_port_layout >= CAMHOOK_NUM_LAYOUTS) {
camhook_port_layout = 0;
}
if (num_setup > 0) {
hook_table_apply(
NULL,
"setupapi.dll",
camhook_cfgmgr32_syms,
lengthof(camhook_cfgmgr32_syms));
// always
hook_table_apply(
NULL, "Mf.dll", camhook_mf_syms, lengthof(camhook_mf_syms));
if (camhook_version == CAMHOOK_VERSION_OLD) {
hook_table_apply(
NULL,
"cfgmgr32.dll",
camhook_cfgmgr32_syms,
lengthof(camhook_cfgmgr32_syms));
} else if (camhook_version == CAMHOOK_VERSION_NEW) {
// for CAMHOOK_VERSION_NEW we restore original VID/PID
// so the parent lookup succeeds later
// yes the DLL moved???
hook_table_apply(
NULL,
"setupapi.dll",
camhook_cfgmgr32_syms_new,
lengthof(camhook_cfgmgr32_syms_new));
// they copied / forked usb/usbview/enum.c
// however they don't use most of it
// so we only need DeviceIoControl to inject port #
hook_table_apply(
NULL,
"kernel32.dll",
camhook_ioctl_syms,
lengthof(camhook_ioctl_syms));
}
log_info("Inserted cam hooks for %d cams", (int) num_setup);
// If the user has manually disabled all cams, don't print this in the
// log

View File

@ -3,6 +3,15 @@
#include "camhook/config-cam.h"
// unused to control which camhook version is being used
// defaults to CAMHOOK_VERSION_OLD
enum camhook_version {
CAMHOOK_VERSION_OLD,
CAMHOOK_VERSION_NEW,
};
void camhook_set_version(enum camhook_version version);
void camhook_init(struct camhook_config_cam *config_cam);
void camhook_fini(void);

View File

@ -7,6 +7,9 @@
#define CAMHOOK_CONFIG_CAM_DISABLE_EMU_KEY "cam.disable_emu"
#define CAMHOOK_CONFIG_CAM_DEFAULT_DISABLE_EMU_VALUE false
#define CAMHOOK_CONFIG_CAM_PORT_LAYOUT_KEY "cam.port_layout"
#define CAMHOOK_CONFIG_CAM_DEFAULT_PORT_LAYOUT_VALUE 0
// the following four arrays are based on CAMHOOK_CONFIG_CAM_MAX
// please insert more elements if more cams are added
const char *camhook_config_disable_camera[CAMHOOK_CONFIG_CAM_MAX] = {
@ -30,7 +33,7 @@ const char *camhook_config_device_default_values[CAMHOOK_CONFIG_CAM_MAX] = {
"",
};
void camhook_config_cam_init(struct cconfig *config, size_t num_cams)
void camhook_config_cam_init(struct cconfig *config, size_t num_cams, bool use_port_layout)
{
cconfig_util_set_bool(
config,
@ -38,6 +41,14 @@ void camhook_config_cam_init(struct cconfig *config, size_t num_cams)
CAMHOOK_CONFIG_CAM_DEFAULT_DISABLE_EMU_VALUE,
"Disables the camera emulation");
if (use_port_layout) {
cconfig_util_set_int(
config,
CAMHOOK_CONFIG_CAM_PORT_LAYOUT_KEY,
CAMHOOK_CONFIG_CAM_DEFAULT_PORT_LAYOUT_VALUE,
"Camera port layout (0 = LDJ, 1 = CLDJ/TDJ-JA, 2 = TDJ-JB)");
}
for (size_t i = 0; i < num_cams; ++i) {
cconfig_util_set_bool(
config,
@ -56,7 +67,8 @@ void camhook_config_cam_init(struct cconfig *config, size_t num_cams)
void camhook_config_cam_get(
struct camhook_config_cam *config_cam,
struct cconfig *config,
size_t num_cams)
size_t num_cams,
bool use_port_layout)
{
config_cam->num_devices = num_cams;
@ -71,6 +83,21 @@ void camhook_config_cam_get(
CAMHOOK_CONFIG_CAM_DISABLE_EMU_KEY,
CAMHOOK_CONFIG_CAM_DEFAULT_DISABLE_EMU_VALUE);
}
if (use_port_layout) {
if (!cconfig_util_get_int(
config,
CAMHOOK_CONFIG_CAM_PORT_LAYOUT_KEY,
&config_cam->port_layout,
CAMHOOK_CONFIG_CAM_DEFAULT_PORT_LAYOUT_VALUE)) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%d'",
CAMHOOK_CONFIG_CAM_PORT_LAYOUT_KEY,
CAMHOOK_CONFIG_CAM_DEFAULT_PORT_LAYOUT_VALUE);
}
}
for (size_t i = 0; i < num_cams; ++i) {
if (!cconfig_util_get_bool(
config,

View File

@ -10,15 +10,20 @@
struct camhook_config_cam {
bool disable_emu;
size_t num_devices;
int port_layout;
char device_id[CAMHOOK_CONFIG_CAM_MAX][MAX_PATH];
bool disable_camera[CAMHOOK_CONFIG_CAM_MAX];
};
void camhook_config_cam_init(struct cconfig *config, size_t num_cams);
void camhook_config_cam_init(
struct cconfig *config,
size_t num_cams,
bool use_port_layout);
void camhook_config_cam_get(
struct camhook_config_cam *config_cam,
struct cconfig *config,
size_t num_cams);
size_t num_cams,
bool use_port_layout);
#endif

View File

@ -0,0 +1,16 @@
dlls += d3d9-frame-graph-hook
ldflags_d3d9-frame-graph-hook := \
-ld3d9 \
-ldwmapi\
-lgdi32 \
libs_d3d9-frame-graph-hook := \
hook \
imgui-bt \
imgui-debug \
imgui \
util \
src_d3d9-frame-graph-hook := \
main.c \

View File

@ -0,0 +1,4 @@
LIBRARY d3d9-frame-graph-hook
EXPORTS
DllMain@12 @1 NONAME

View File

@ -0,0 +1,32 @@
#include <windows.h>
#include "hook/d3d9.h"
#include "hook/table.h"
#include "imgui-bt/imgui-d3d9-hook.h"
#include "imgui-debug/frame-perf-graph.h"
#include "util/defs.h"
#include "util/log.h"
static const hook_d3d9_irp_handler_t d3d9_frame_graph_hook_handlers[] = {
imgui_hook_d3d9_irp_handler
};
BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
{
imgui_bt_component_t debug_frame_graph_component;
if (reason == DLL_PROCESS_ATTACH) {
log_to_writer(log_writer_null, NULL);
imgui_debug_frame_perf_graph_init(60.0f, &debug_frame_graph_component);
imgui_d3d9_hook_init(&debug_frame_graph_component, 1);
hook_d3d9_init(d3d9_frame_graph_hook_handlers, lengthof(d3d9_frame_graph_hook_handlers));
}
return TRUE;
}

View File

@ -0,0 +1,13 @@
exes += d3d9-monitor-check \
ldflags_d3d9-monitor-check := \
-ld3d9 \
-ldwmapi \
-lgdi32 \
-ld3dx9 \
libs_d3d9-monitor-check := \
util \
src_d3d9-monitor-check := \
main.c \

View File

@ -0,0 +1,759 @@
#include <windows.h>
#include <d3d9.h>
#include <d3dx9core.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "util/time.h"
#include "util/winerr.h"
#define printf_out(fmt, ...) \
fprintf(stdout, fmt, ##__VA_ARGS__)
#define printf_err(fmt, ...) \
fprintf(stderr, fmt, ##__VA_ARGS__)
#define printfln_out(fmt, ...) \
fprintf(stdout, fmt "\n", ##__VA_ARGS__)
#define printfln_err(fmt, ...) \
fprintf(stderr, fmt "\n", ##__VA_ARGS__)
#define printfln_winerr(fmt, ...) \
char *winerr = util_winerr_format_last_error_code(); \
fprintf(stderr, fmt ": %s\n", ##__VA_ARGS__, winerr); \
free(winerr);
static const D3DFORMAT _d3dformat = D3DFMT_X8R8G8B8;
static void _print_synopsis()
{
printfln_err("D3D9 monitor check");
printfln_err("");
printfln_err("Improved open source re-implementation of IIDX's infamous \"monitor check\" screen");
printfln_err("Run a bare D3D9 render loop to measure the refresh rate of the current GPU + monitor configuration");
printfln_err("");
printfln_err("Usage:");
printfln_err(" d3d9-monitor-check <command> <args>");
printfln_err("");
printfln_err("Available commands:");
printfln_err(" adapter: Query adapter information");
printfln_err(" modes: Query adapter modes");
printfln_err(" run <width> <height> <refresh_rate> [--warm-up-secs n] [--total-secs n] [--results-timeout-secs n] [--windowed] [--vsync-off]: Run the monitor check. Ensure that the mandatory parameters for width, height and refresh rate are values that are supported by the adapter's mode. Use the \"modes\" subcommand to get a list of supported modes.");
printfln_err(" width: Width of the rendering resolution to run the test at");
printfln_err(" height: Height of the rendering resolution to run the test at");
printfln_err(" refresh_rate: Target refresh rate to run the test at");
printfln_err(" warm-up-secs: Optional. Number of seconds to warm-up before executing the main run that counts towards the measurement results");
printfln_err(" total-secs: Optional. Total number of seconds to run the test for that count towards the measurement results");
printfln_err(" results-timeout-secs: Optional. Number of seconds to display final result after the test before exiting");
printfln_err(" windowed: Optional. Run the test in windowed mode (not recommended)");
printfln_err(" vsync-off: Optional. Run the test with vsync off (not recommended)");
}
static bool _create_d3d_context(IDirect3D9 **d3d)
{
// Initialize D3D
*d3d = Direct3DCreate9(D3D_SDK_VERSION);
if (!*d3d) {
printfln_winerr("Creating d3d context failed");
return false;
}
return true;
}
static bool _query_adapter_identifier(IDirect3D9 *d3d, D3DADAPTER_IDENTIFIER9 *identifier)
{
HRESULT hr;
hr = IDirect3D9_GetAdapterIdentifier(d3d, D3DADAPTER_DEFAULT, 0, identifier);
if (hr != D3D_OK) {
printfln_winerr("GetAdapterIdentifier failed");
return false;
}
return true;
}
static bool _create_window(uint32_t width, uint32_t height, HWND *hwnd)
{
WNDCLASSEX wc;
memset(&wc, 0, sizeof(wc));
wc.cbSize = sizeof(wc);
wc.lpfnWndProc = DefWindowProc;
wc.hInstance = GetModuleHandle(NULL);
wc.lpszClassName = "D3D9MonitorCheck";
RegisterClassExA(&wc);
// Create window
*hwnd = CreateWindowA(
wc.lpszClassName,
"D3D9 Monitor Check",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
width,
height,
NULL,
NULL,
wc.hInstance,
NULL);
if (!*hwnd) {
printfln_winerr("Failed to create window");
return false;
}
return true;
}
static bool _create_d3d_device(
HWND hwnd,
IDirect3D9 *d3d,
uint32_t width,
uint32_t height,
uint32_t refresh_rate,
bool windowed,
bool vsync_off,
IDirect3DDevice9 **device)
{
D3DPRESENT_PARAMETERS pp;
HRESULT hr;
memset(&pp, 0, sizeof(pp));
if (windowed) {
ShowWindow(hwnd, SW_SHOW);
pp.Windowed = TRUE;
pp.FullScreen_RefreshRateInHz = 0;
} else {
ShowCursor(FALSE);
pp.Windowed = FALSE;
pp.FullScreen_RefreshRateInHz = refresh_rate;
}
if (vsync_off) {
pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
} else {
pp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
}
pp.BackBufferWidth = width;
pp.BackBufferHeight = height;
pp.BackBufferFormat = _d3dformat;
pp.BackBufferCount = 2;
pp.MultiSampleType = D3DMULTISAMPLE_NONE;
pp.MultiSampleQuality = 0;
pp.SwapEffect = D3DSWAPEFFECT_DISCARD;
pp.hDeviceWindow = hwnd;
pp.EnableAutoDepthStencil = TRUE;
pp.AutoDepthStencilFormat = D3DFMT_D16;
pp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
// Create D3D device
hr = IDirect3D9_CreateDevice(
d3d,
D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
hwnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING,
&pp,
device);
if (hr != D3D_OK) {
printfln_winerr("Creating d3d device failed");
return false;
}
return true;
}
static uint32_t _get_font_height(uint32_t resolution_height)
{
// Default size for 480p
return (uint32_t) (20.0f * resolution_height / 480.0f);
}
static uint32_t _get_text_offset_x(uint32_t resolution_width)
{
// Default offset for 480p
return (uint32_t) (20.0f * resolution_width / 480.0f);
}
static uint32_t _get_text_offset_y(uint32_t resolution_height, uint32_t font_height)
{
// Default offset for 480p
return (uint32_t) (font_height + 10 * (resolution_height / 640.0f));
}
static bool _create_font(IDirect3DDevice9 *device, uint32_t font_height, ID3DXFont **font)
{
HRESULT hr;
hr = D3DXCreateFont(device, font_height, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
"Arial", font);
if (hr != D3D_OK) {
printfln_winerr("Creating font failed");
return false;
}
return true;
}
static void _draw_text(IDirect3DDevice9 *device, ID3DXFont *font, uint32_t font_height, int x, int y, const char *fmt, ...)
{
va_list args;
char text[1024];
RECT rect;
va_start(args, fmt);
vsprintf(text, fmt, args);
va_end(args);
rect.left = x;
rect.top = y;
// Base width of 300 is based on 480p
rect.right = x + (480 * (font_height / 20.0f));
rect.bottom = y + font_height;
ID3DXFont_DrawText(font, NULL, text, -1, &rect, DT_LEFT | DT_TOP, D3DCOLOR_XRGB(255, 255, 255));
}
static bool _is_esc_key_pressed()
{
return GetAsyncKeyState(VK_ESCAPE) & 0x8000;
}
static bool _is_esc_key_released()
{
return !(GetAsyncKeyState(VK_ESCAPE) & 0x8000);
}
static bool _adapter()
{
IDirect3D9 *d3d;
D3DADAPTER_IDENTIFIER9 identifier;
if (!_create_d3d_context(&d3d)) {
return false;
}
if (!_query_adapter_identifier(d3d, &identifier)) {
IDirect3D9_Release(d3d);
return false;
}
printfln_out("Driver: %s", identifier.Driver);
printfln_out("Description: %s", identifier.Description);
printfln_out("DeviceName: %s", identifier.DeviceName);
#ifdef _WIN32
printfln_out("DriverVersion: %lld", identifier.DriverVersion.QuadPart);
#else
printfln_out("DriverVersion: %lu.%lu", identifier.DriverVersionHighPart, identifier.DriverVersionLowPart);
#endif
printfln_out("VendorId: %lu", identifier.VendorId);
printfln_out("DeviceId: %lu", identifier.DeviceId);
printfln_out("SubSysId: %lu", identifier.SubSysId);
printfln_out("Revision: %lu", identifier.Revision);
printfln_out("DeviceIdentifier: {%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
identifier.DeviceIdentifier.Data1,
identifier.DeviceIdentifier.Data2,
identifier.DeviceIdentifier.Data3,
identifier.DeviceIdentifier.Data4[0],
identifier.DeviceIdentifier.Data4[1],
identifier.DeviceIdentifier.Data4[2],
identifier.DeviceIdentifier.Data4[3],
identifier.DeviceIdentifier.Data4[4],
identifier.DeviceIdentifier.Data4[5],
identifier.DeviceIdentifier.Data4[6],
identifier.DeviceIdentifier.Data4[7]);
printfln_out("WHQLLevel: %lu", identifier.WHQLLevel);
IDirect3D9_Release(d3d);
return true;
}
static bool _modes()
{
IDirect3D9 *d3d;
HRESULT hr;
UINT mode_count;
D3DDISPLAYMODE mode;
memset(&mode, 0, sizeof(D3DDISPLAYMODE));
if (!_create_d3d_context(&d3d)) {
return false;
}
mode_count = IDirect3D9_GetAdapterModeCount(d3d, D3DADAPTER_DEFAULT, _d3dformat);
printfln_err("Available adapter modes (total %d)", mode_count);
printfln_err("Mode index: width x height @ refresh rate");
for (UINT i = 0; i < mode_count; i++) {
hr = IDirect3D9_EnumAdapterModes(d3d, D3DADAPTER_DEFAULT, _d3dformat, i, &mode);
if (hr != D3D_OK) {
printfln_winerr("EnumAdapterMode index %d failed", i);
IDirect3D9_Release(d3d);
return false;
}
printfln_out("%d: %d x %d @ %d hz", i, mode.Width, mode.Height, mode.RefreshRate);
}
IDirect3D9_Release(d3d);
return true;
}
static bool _run(uint32_t width, uint32_t height, uint32_t refresh_rate, uint32_t total_warm_up_frame_count,
uint32_t total_frame_count, uint32_t results_timeout_seconds, bool windowed, bool vsync_off)
{
HWND hwnd;
IDirect3D9 *d3d;
D3DADAPTER_IDENTIFIER9 identifier;
IDirect3DDevice9 *device;
uint32_t font_height;
ID3DXFont *font;
uint32_t text_offset_x;
uint32_t text_offset_y;
MSG msg;
bool exit_loop;
bool warm_up_done;
uint32_t warm_up_frame_count;
uint32_t frame_count;
uint64_t start_time;
uint64_t end_time;
uint64_t elapsed_us;
uint64_t total_elapsed_us;
printfln_err("Creating d3d context ...");
if (!_create_d3d_context(&d3d)) {
return false;
}
printfln_err("Querying adapter identifier ...");
if (!_query_adapter_identifier(d3d, &identifier)) {
IDirect3D9_Release(d3d);
return false;
}
printfln_err("Adapter:");
printfln_err("Driver: %s", identifier.Driver);
printfln_err("Description: %s", identifier.Description);
printfln_err("DeviceName: %s", identifier.DeviceName);
#ifdef _WIN32
printfln_err("DriverVersion: %lld", identifier.DriverVersion.QuadPart);
#else
printfln_err("DriverVersion: %lu.%lu", identifier.DriverVersionHighPart, identifier.DriverVersionLowPart);
#endif
printfln_err("Creating window with %dx%d ...", width, height);
if (!_create_window(width, height, &hwnd)) {
IDirect3D9_Release(d3d);
return false;
}
printfln_err("Creating d3d device %d x %d @ %d hz %s vsync %s ...",
width,
height,
refresh_rate,
windowed ? "windowed" : "fullscreen",
vsync_off ? "off" : "on");
if (!_create_d3d_device(
hwnd,
d3d,
width,
height,
refresh_rate,
windowed,
vsync_off,
&device)) {
IDirect3D9_Release(d3d);
DestroyWindow(hwnd);
return false;
}
printfln_err("Creating font ...");
font_height = _get_font_height(height);
if (!_create_font(device, font_height, &font)) {
IDirect3DDevice9_Release(device);
IDirect3D9_Release(d3d);
DestroyWindow(hwnd);
return false;
}
text_offset_x = _get_text_offset_x(width);
text_offset_y = _get_text_offset_y(height, font_height);
// ---------------------------------------------------------------------------------------------
exit_loop = false;
warm_up_done = false;
warm_up_frame_count = 0;
frame_count = 0;
elapsed_us = 0;
total_elapsed_us = 0;
printfln_err("Warm-up for %d frames ...", total_warm_up_frame_count);
start_time = time_get_counter();
while (warm_up_frame_count + frame_count < total_warm_up_frame_count + total_frame_count) {
// reset when warm-up is done
if (warm_up_frame_count >= total_warm_up_frame_count && !warm_up_done) {
warm_up_done = true;
total_elapsed_us = 0;
printfln_err("Warm-up finished");
printfln_err("Running test for %d frames ...", total_frame_count);
}
// Required to not make windows think we are stuck and not responding
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT) {
exit_loop = true;
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if (exit_loop) {
break;
}
if (_is_esc_key_pressed()) {
// Avoid multi triggering with further key evaluations
while (!_is_esc_key_released()) {
Sleep(10);
}
exit_loop = true;
break;
}
IDirect3DDevice9_Clear(
device,
0,
NULL,
D3DCLEAR_TARGET,
D3DCOLOR_XRGB(0, 0, 0),
1.0f,
0);
IDirect3DDevice9_BeginScene(device);
_draw_text(device, font, font_height, text_offset_x, text_offset_y, "D3D9 Monitor Check");
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 3,
"GPU: %s", identifier.Description);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 4,
"Spec: %d x %d @ %d hz, %s, vsync %s", width, height, refresh_rate,
windowed ? "windowed" : "fullscreen", vsync_off ? "off" : "on");
if (warm_up_frame_count < total_warm_up_frame_count) {
// First frame won't have any data available causing division by zero in the stats
if (warm_up_frame_count != 0) {
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 6, "Status: Warm-up in progress ...");
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 7,
"Frame: %d / %d", warm_up_frame_count, total_warm_up_frame_count);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 8,
"Last frame time: %.3f ms", elapsed_us / 1000.0f);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 9,
"Avg frame time: %.3f ms", total_elapsed_us / warm_up_frame_count / 1000.0f);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 10,
"Last refresh rate: %.3f Hz", 1000.0f / (elapsed_us / 1000.0f));
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 11,
"Avg refresh rate: %.3f Hz", 1000.0f / (total_elapsed_us / warm_up_frame_count / 1000.0f));
}
} else {
// First frame won't have any data available causing division by zero in the stats
if (frame_count != 0) {
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 6, "Status: Measuring in progress ...");
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 7,
"Frame: %d / %d", frame_count, total_frame_count);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 8,
"Last frame time: %.3f ms", elapsed_us / 1000.0f);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 9,
"Avg frame time: %.3f ms", total_elapsed_us / frame_count / 1000.0f);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 10,
"Last refresh rate: %.3f Hz", 1000.0f / (elapsed_us / 1000.0f));
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 11,
"Avg refresh rate: %.3f Hz", 1000.0f / (total_elapsed_us / frame_count / 1000.0f));
}
}
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 13, "Press ESC to exit early");
IDirect3DDevice9_EndScene(device);
IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
end_time = time_get_counter();
elapsed_us = time_get_elapsed_us(end_time - start_time);
start_time = end_time;
total_elapsed_us += elapsed_us;
if (warm_up_frame_count < total_warm_up_frame_count) {
warm_up_frame_count++;
} else {
frame_count++;
}
}
// ---------------------------------------------------------------------------------------------
printfln_err("Running test finished");
IDirect3DDevice9_Clear(
device,
0,
NULL,
D3DCLEAR_TARGET,
D3DCOLOR_XRGB(0, 0, 0),
1.0f,
0);
IDirect3DDevice9_BeginScene(device);
_draw_text(device, font, font_height, text_offset_x, text_offset_y, "D3D9 Monitor Check");
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 3,
"GPU: %s", identifier.Description);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 4,
"Spec: %d x %d @ %d hz, %s, vsync %s", width, height, refresh_rate,
windowed ? "windowed" : "fullscreen", vsync_off ? "off" : "on");
if (exit_loop) {
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 6, "Status: Exited early");
} else {
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 6, "Status: Finished");
}
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 7,
"Total warm-up frame count: %d", warm_up_frame_count);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 8,
"Total sample frame count: %d", frame_count);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 9,
"Avg frame time: %.3f ms", total_elapsed_us > 0 && frame_count > 0 ? total_elapsed_us / frame_count / 1000.0f : 0);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 10,
"Avg refresh rate: %.3f Hz", total_elapsed_us > 0 && frame_count > 0 ? 1000.0f / (total_elapsed_us / frame_count / 1000.0f) : 0);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 12, "Exiting in %d seconds ...",
results_timeout_seconds);
_draw_text(device, font, font_height, text_offset_x, text_offset_y * 13, "Press ESC to exit immediately");
IDirect3DDevice9_EndScene(device);
IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
exit_loop = false;
for (uint32_t i = 0; i < results_timeout_seconds * 1000 / 10; i++) {
// Required to not make windows think we are stuck and not responding
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT) {
exit_loop = true;
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if (exit_loop) {
break;
}
// Allow quick exit
if (_is_esc_key_pressed()) {
// Avoid multi triggering with further key evaluations
while (!_is_esc_key_released()) {
Sleep(10);
}
exit_loop = true;
break;
}
Sleep(10);
}
// ---------------------------------------------------------------------------------------------
printfln_err("Final results");
printfln_out("GPU: %s", identifier.Description);
printfln_out("Spec: %d x %d @ %d hz, %s, vsync %s", width, height, refresh_rate,
windowed ? "windowed" : "fullscreen", vsync_off ? "off" : "on");
printfln_out("Avg frame time (ms): %.3f", total_elapsed_us > 0 && frame_count > 0 ? total_elapsed_us / frame_count / 1000.0f : 0);
printfln_out("Avg refresh rate (hz): %.3f", total_elapsed_us > 0 && frame_count > 0 ? 1000.0f / (total_elapsed_us / frame_count / 1000.0f) : 0);
ID3DXFont_Release(font);
IDirect3DDevice9_Release(device);
IDirect3D9_Release(d3d);
DestroyWindow(hwnd);
return true;
}
static bool _cmd_adapter()
{
return _adapter();
}
static bool _cmd_modes()
{
return _modes();
}
static bool _cmd_run(int argc, char **argv)
{
uint32_t width;
uint32_t height;
uint32_t refresh_rate;
uint32_t warm_up_seconds;
uint32_t total_seconds;
uint32_t results_timeout_seconds;
bool windowed;
bool vsync_off;
uint32_t total_warm_up_frame_count;
uint32_t total_frame_count;
if (argc < 3) {
_print_synopsis();
printfln_err("ERROR: Insufficient arguments");
return false;
}
width = atoi(argv[0]);
if (width == 0 || width > 16384) {
_print_synopsis();
printfln_err("ERROR: Invalid width: %d", width);
return false;
}
height = atoi(argv[1]);
if (height == 0 || height > 16384) {
_print_synopsis();
printfln_err("ERROR: Invalid height: %d", height);
return false;
}
refresh_rate = atoi(argv[2]);
if (refresh_rate == 0 || refresh_rate > 1000) {
_print_synopsis();
printfln_err("ERROR: Invalid refresh rate: %d", refresh_rate);
return false;
}
// Sane defaults
warm_up_seconds = 10;
total_seconds = 20;
results_timeout_seconds = 5;
windowed = false;
vsync_off = false;
for (int i = 3; i < argc; i++) {
if (!strcmp(argv[i], "--warm-up-secs")) {
if (i + 1 < argc) {
warm_up_seconds = atoi(argv[++i]);
if (warm_up_seconds == 0) {
_print_synopsis();
printfln_err("ERROR: Invalid warm-up seconds: %d", warm_up_seconds);
return false;
}
} else {
_print_synopsis();
printfln_err("ERROR: Missing argument for --warm-up-secs");
return false;
}
} else if (!strcmp(argv[i], "--total-secs")) {
if (i + 1 < argc) {
total_seconds = atoi(argv[++i]);
if (total_seconds == 0) {
_print_synopsis();
printfln_err("ERROR: Invalid total seconds: %d", total_seconds);
return false;
}
} else {
_print_synopsis();
printfln_err("ERROR: Missing argument for --total-secs");
return false;
}
} else if (!strcmp(argv[i], "--results-timeout-secs")) {
if (i + 1 < argc) {
results_timeout_seconds = atoi(argv[++i]);
} else {
_print_synopsis();
printfln_err("ERROR: Missing argument for --results-timeout-secs");
}
} else if (!strcmp(argv[i], "--windowed")) {
windowed = true;
} else if (!strcmp(argv[i], "--vsync-off")) {
vsync_off = true;
}
}
total_warm_up_frame_count = warm_up_seconds * refresh_rate;
total_frame_count = total_seconds * refresh_rate;
return _run(width, height, refresh_rate, total_warm_up_frame_count, total_frame_count, results_timeout_seconds, windowed, vsync_off);
}
int main(int argc, char **argv)
{
const char *command;
if (argc < 2) {
_print_synopsis();
printfln_err("ERROR: Insufficient arguments");
return 1;
}
command = argv[1];
if (!strcmp(command, "adapter")) {
if (!_cmd_adapter(argc - 2, argv + 2)) {
return 1;
}
} else if (!strcmp(command, "modes")) {
if (!_cmd_modes(argc - 2, argv + 2)) {
return 1;
}
} else if (!strcmp(command, "run")) {
if (!_cmd_run(argc - 2, argv + 2)) {
return 1;
}
} else {
_print_synopsis(argv[0]);
printfln_err("ERROR: Unknown command: %s", command);
return 1;
}
return 0;
}

View File

@ -15,12 +15,21 @@ static const size_t apiset_prefix_len = sizeof(apiset_prefix) - 1;
static void hook_table_apply_to_all(
const char *depname, const struct hook_symbol *syms, size_t nsyms);
static void hook_table_revert_to_all(
const char *depname, const struct hook_symbol *syms, size_t nsyms);
static void hook_table_apply_to_iid(
HMODULE target,
const pe_iid_t *iid,
const struct hook_symbol *syms,
size_t nsyms);
static void hook_table_revert_to_iid(
HMODULE target,
const pe_iid_t *iid,
const struct hook_symbol *syms,
size_t nsyms);
static bool hook_table_match_module(
HMODULE target, const char *iid_name, const char *depname);
@ -44,6 +53,23 @@ static void hook_table_apply_to_all(
}
}
static void hook_table_revert_to_all(
const char *depname, const struct hook_symbol *syms, size_t nsyms)
{
const peb_dll_t *dll;
HMODULE pe;
for (dll = peb_dll_get_first(); dll != NULL; dll = peb_dll_get_next(dll)) {
pe = peb_dll_get_base(dll);
if (pe == NULL) {
continue; /* ?? Happens sometimes. */
}
hook_table_revert(pe, depname, syms, nsyms);
}
}
void hook_table_apply(
HMODULE target,
const char *depname,
@ -73,6 +99,35 @@ void hook_table_apply(
}
}
void hook_table_revert(
HMODULE target,
const char *depname,
const struct hook_symbol *syms,
size_t nsyms)
{
const pe_iid_t *iid;
const char *iid_name;
assert(depname != NULL);
assert(syms != NULL || nsyms == 0);
if (target == NULL) {
/* Call out, which will then call us back repeatedly. Awkward, but
viewed from the outside it's good for usability. */
hook_table_revert_to_all(depname, syms, nsyms);
} else {
for (iid = pe_iid_get_first(target); iid != NULL;
iid = pe_iid_get_next(target, iid)) {
iid_name = pe_iid_get_name(target, iid);
if (hook_table_match_module(target, iid_name, depname)) {
hook_table_revert_to_iid(target, iid, syms, nsyms);
}
}
}
}
static void hook_table_apply_to_iid(
HMODULE target,
const pe_iid_t *iid,
@ -101,6 +156,33 @@ static void hook_table_apply_to_iid(
}
}
static void hook_table_revert_to_iid(
HMODULE target,
const pe_iid_t *iid,
const struct hook_symbol *syms,
size_t nsyms)
{
struct pe_iat_entry iate;
size_t i;
size_t j;
const struct hook_symbol *sym;
i = 0;
while (pe_iid_get_iat_entry(target, iid, i++, &iate) == S_OK) {
for (j = 0; j < nsyms; j++) {
sym = &syms[j];
if (hook_table_match_proc(&iate, sym)) {
// Only revert-able if the original pointer was stored previously
if (sym->link != NULL && *sym->link != NULL) {
pe_patch(iate.ppointer, sym->link, sizeof(*sym->link));
}
}
}
}
}
static bool hook_table_match_module(
HMODULE target, const char *iid_name, const char *depname)
{

View File

@ -232,7 +232,7 @@ iidxhook_util_d3d9_log_create_device_params(struct hook_d3d9_irp *irp)
"hDeviceWindow %p, Windowed %d, "
"EnableAutoDepthStencil "
"%d, AutoDepthStencilFormat %d, Flags %lX, "
"FullScreen_RefreshRateInHz %d",
"FullScreen_RefreshRateInHz %d, PresentationInterval %d",
irp->args.ctx_create_device.pp->BackBufferWidth,
irp->args.ctx_create_device.pp->BackBufferHeight,
irp->args.ctx_create_device.pp->BackBufferFormat,
@ -244,7 +244,13 @@ iidxhook_util_d3d9_log_create_device_params(struct hook_d3d9_irp *irp)
irp->args.ctx_create_device.pp->EnableAutoDepthStencil,
irp->args.ctx_create_device.pp->AutoDepthStencilFormat,
irp->args.ctx_create_device.pp->Flags,
irp->args.ctx_create_device.pp->FullScreen_RefreshRateInHz);
irp->args.ctx_create_device.pp->FullScreen_RefreshRateInHz,
irp->args.ctx_create_device.pp->PresentationInterval);
if (irp->args.ctx_create_device.pp->PresentationInterval != D3DPRESENT_INTERVAL_ONE) {
log_warning("PresentationInterval is not 1, i.e. VSYNC is OFF (!): %d",
irp->args.ctx_create_device.pp->PresentationInterval);
}
}
static void

View File

@ -18,12 +18,10 @@
/* ------------------------------------------------------------------------- */
static unsigned long STDCALL my_inet_addr(const char *cp);
static int STDCALL
my_connect(SOCKET s, const struct sockaddr *addr, int addrlen);
static struct hostent FAR *STDCALL my_gethostbyname(const char *nameB);
static unsigned long(STDCALL *real_inet_addr)(const char *cp);
static int(STDCALL *real_connect)(
SOCKET s, const struct sockaddr *addr, int addrlen);
static struct hostent FAR *(STDCALL *real_gethostbyname)(const char *nameB);
@ -33,10 +31,6 @@ static const struct hook_symbol eamuse_hook_syms[] = {
/* WS2_32.DLL's SDK import lib generates ordinal imports, so these
ordinals are a frozen aspect of the Win32 ABI. */
{.name = "inet_addr",
.ordinal = 11,
.patch = my_inet_addr,
.link = (void **) &real_inet_addr},
{.name = "connect",
.ordinal = 4,
.patch = my_connect,
@ -54,26 +48,6 @@ static struct net_addr eamuse_server_addr_resolved;
/* ------------------------------------------------------------------------- */
static unsigned long STDCALL my_inet_addr(const char *cp)
{
char *tmp;
/* for a stock machine connected to the eamuse router,
the game wants to connect to the standard domain
services.konami.eamuse.fun
depending on the router you got, it will be services.hostname.my.router
so we catch that and turn it into any ip we want */
/* bugfix win10: don't just catch services.konami... because
win10 is doing some weird stuff and this call also contains
various IP addresses. Always return the server address */
tmp = net_addr_to_str(&eamuse_server_addr_resolved);
log_misc("my_inet_addr: '%s' -> %s", cp, tmp);
free(tmp);
return eamuse_server_addr_resolved.ipv4.addr;
}
static int STDCALL
my_connect(SOCKET s, const struct sockaddr *addr, int addrlen)
{
@ -102,14 +76,13 @@ my_connect(SOCKET s, const struct sockaddr *addr, int addrlen)
static struct hostent FAR *STDCALL my_gethostbyname(const char *name)
{
// IIDX 9-13 use the `services` domain (not `services.eamuse.konami.fun`).
if (strcmp(name, "services") != 0) {
return real_gethostbyname(name);
}
char *tmp;
/* for doc, checkout the other detour of inetaddr above
this call is used starting GOLD (not used on pre GOLD) */
/* bugfix win10: don't just catch services.konami... because
win10 is doing some weird stuff and this call also contains
various IP addresses. Always return the server address */
tmp = net_addr_to_str(&eamuse_server_addr_resolved);
log_misc("my_gethostbyname: '%s' to ip %s", name, tmp);
free(tmp);

View File

@ -5,7 +5,7 @@
/**
* Hook various calls resolving the service address to connect to
* the eamuse server for the old IIDX games (9th to Sirius)
* the eamuse server for the old IIDX games (9th to DistorteD)
*/
void eamuse_hook_init(void);

View File

@ -4,6 +4,9 @@ ldflags_iidxhook3 := \
-lws2_32 \
-liphlpapi \
deplibs_iidxhook3 := \
avs \
libs_iidxhook3 := \
iidxhook-util \
ezusb-emu \
@ -22,4 +25,5 @@ libs_iidxhook3 := \
ezusb \
src_iidxhook3 := \
avs-boot.c \
dllmain.c \

View File

@ -0,0 +1,178 @@
#define LOG_MODULE "avs-boot"
#include <stdint.h>
#include <string.h>
#include "hook/table.h"
#include "imports/avs.h"
#include "iidxhook3/avs-boot.h"
#include "util/log.h"
static void (*real_avs_boot)(
struct property_node *config,
void *std_heap,
size_t sz_std_heap,
void *avs_heap,
size_t sz_avs_heap,
avs_log_writer_t log_writer,
void *log_context);
static int (*real_ea3_boot_avs)(struct property_node *config);
static int (*real_ea3_boot)(struct property_node *config);
static void my_avs_boot(
struct property_node *config,
void *std_heap,
size_t sz_std_heap,
void *avs_heap,
size_t sz_avs_heap,
avs_log_writer_t log_writer,
void *log_context);
static int my_ea3_boot_avs(struct property_node *config);
static int my_ea3_boot(struct property_node *config);
static struct net_addr iidxhook3_avs_boot_eamuse_server_addr;
static const struct hook_symbol iidxhook3_avs_hook_syms[] = {
{.name = "avs_boot",
.patch = my_avs_boot,
.link = (void **) &real_avs_boot},
{.name = "ea3_boot",
.patch = my_ea3_boot_avs,
.link = (void **) &real_ea3_boot_avs},
};
static const struct hook_symbol iidxhook3_ea3_hook_syms[] = {
{.name = "ea3_boot",
.patch = my_ea3_boot,
.link = (void **) &real_ea3_boot},
};
static void avs_boot_replace_property_uint32(
struct property_node *node, const char *name, uint32_t val)
{
struct property_node *tmp;
tmp = property_search(NULL, node, name);
if (tmp) {
property_node_remove(tmp);
}
property_node_create(NULL, node, PSMAP_TYPE_U32, name, val);
}
static void avs_boot_replace_property_str(
struct property_node *node, const char *name, const char *val)
{
struct property_node *tmp;
tmp = property_search(NULL, node, name);
if (tmp) {
property_node_remove(tmp);
}
tmp = property_node_create(NULL, node, PROPERTY_TYPE_STR, name, val);
if (tmp) {
property_node_datasize(tmp);
} else {
log_fatal("Could not avs_boot_replace_property_str(%s, %s)", name, val);
}
}
static void my_avs_boot(
struct property_node *config,
void *std_heap,
size_t sz_std_heap,
void *avs_heap,
size_t sz_avs_heap,
avs_log_writer_t log_writer,
void *log_context)
{
log_info("Called my_avs_boot");
avs_boot_replace_property_uint32(config, "log/level", 4);
real_avs_boot(
config,
std_heap,
sz_std_heap,
avs_heap,
sz_avs_heap,
log_writer_debug,
NULL);
}
static void insert_eamuse_addr(struct property_node *config)
{
char *server_addr;
if (iidxhook3_avs_boot_eamuse_server_addr.type != NET_ADDR_TYPE_INVALID) {
log_misc("Injecting network server address");
server_addr = net_addr_to_str(&iidxhook3_avs_boot_eamuse_server_addr);
// Remove protocol to avoid errors during ea3_boot.
if (!strncmp(server_addr, "http://", strlen("http://"))) {
server_addr += strlen("http://");
} else if (!strncmp(server_addr, "https://", strlen("https://"))) {
server_addr += strlen("https://");
}
avs_boot_replace_property_str(config, "network/services", server_addr);
free(server_addr);
}
}
static int my_ea3_boot_avs(struct property_node *config)
{
log_info("Called my_ea3_boot_avs");
insert_eamuse_addr(config);
return real_ea3_boot_avs(config);
}
static int my_ea3_boot(struct property_node *config)
{
log_info("Called my_ea3_boot");
insert_eamuse_addr(config);
return real_ea3_boot(config);
}
void iidxhook3_avs_boot_init()
{
// IIDX 14 and 15 have the ea3_boot in libavs-win32.dll.
hook_table_apply(
NULL,
"libavs-win32.dll",
iidxhook3_avs_hook_syms,
lengthof(iidxhook3_avs_hook_syms));
hook_table_apply(
NULL,
"libavs-win32-ea3.dll",
iidxhook3_ea3_hook_syms,
lengthof(iidxhook3_ea3_hook_syms));
memset(&iidxhook3_avs_boot_eamuse_server_addr, 0, sizeof(struct net_addr));
log_info("Inserted avs log hooks");
}
void iidxhook3_avs_boot_set_eamuse_addr(const struct net_addr *server_addr)
{
char *str;
str = net_addr_to_str(server_addr);
log_info("Setting eamuse server: %s", str);
free(str);
memcpy(
&iidxhook3_avs_boot_eamuse_server_addr,
server_addr,
sizeof(struct net_addr));
}

View File

@ -0,0 +1,19 @@
#ifndef IIDXHOOK3_AVS_BOOT_H
#define IIDXHOOK3_AVS_BOOT_H
#include "util/net.h"
/**
* Initialize hooking of avs_boot and ea3_boot. This re-enables avs logging
* and injects a few important settings.
*/
void iidxhook3_avs_boot_init();
/**
* Set the target eamuse server address.
*
* @param server_addr Address to target eamuse server.
*/
void iidxhook3_avs_boot_set_eamuse_addr(const struct net_addr *server_addr);
#endif

View File

@ -27,6 +27,8 @@
#include "hooklib/rs232.h"
#include "hooklib/setupapi.h"
#include "iidxhook3/avs-boot.h"
#include "iidxhook-util/acio.h"
#include "iidxhook-util/chart-patch.h"
#include "iidxhook-util/clock.h"
@ -35,7 +37,6 @@
#include "iidxhook-util/config-misc.h"
#include "iidxhook-util/config-sec.h"
#include "iidxhook-util/d3d9.h"
#include "iidxhook-util/eamuse.h"
#include "iidxhook-util/settings.h"
#include "security/rp-sign-key.h"
@ -176,10 +177,8 @@ my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId)
ezusb_iidx_emu_node_security_plug_set_pcbid(&config_eamuse.pcbid);
ezusb_iidx_emu_node_security_plug_set_eamid(&config_eamuse.eamid);
/* eAmusement server IP */
eamuse_set_addr(&config_eamuse.server);
eamuse_check_connection();
iidxhook3_avs_boot_init();
iidxhook3_avs_boot_set_eamuse_addr(&config_eamuse.server);
/* Settings paths */
@ -259,7 +258,6 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
acp_hook_init();
adapter_hook_init();
eamuse_hook_init();
settings_hook_init();
}

View File

@ -106,7 +106,7 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
iidxhook_config_gfx_init(config);
iidxhook8_config_io_init(config);
camhook_config_cam_init(config, 2);
camhook_config_cam_init(config, 2, false);
if (!cconfig_hook_config_init(
config,
@ -119,7 +119,7 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
iidxhook_config_gfx_get(&config_gfx, config);
iidxhook8_config_io_get(&iidxhook8_config_io, config);
camhook_config_cam_get(&config_cam, config, 2);
camhook_config_cam_get(&config_cam, config, 2, false);
cconfig_finit(config);

View File

@ -29,4 +29,5 @@ libs_iidxhook9 := \
src_iidxhook9 := \
config-io.c \
fs-hook.c \
dllmain.c \

View File

@ -26,6 +26,7 @@
#include "bio2emu-iidx/bi2a.h"
#include "iidxhook9/config-io.h"
#include "iidxhook9/fs-hook.h"
#include "camhook/cam.h"
#include "camhook/config-cam.h"
@ -67,7 +68,7 @@ static bool load_configs()
config = cconfig_init();
iidxhook9_config_io_init(config);
camhook_config_cam_init(config, 2);
camhook_config_cam_init(config, 2, true);
d3d9exhook_config_gfx_init(config);
@ -83,7 +84,7 @@ static bool load_configs()
}
iidxhook9_config_io_get(&iidxhook9_config_io, config);
camhook_config_cam_get(&config_cam, config, 2);
camhook_config_cam_get(&config_cam, config, 2, true);
d3d9exhook_config_gfx_get(&config_gfx, config);
@ -159,6 +160,9 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
} else {
memfile_hook_add_fd("d:\\\\001rom.txt", ABSOLUTE_MATCH, "LDJ", 3);
}
// redirect F:\ drive to vfs (used for video recording)
iidxhook9_fs_hooks_init();
}
rs232_hook_init();
@ -184,6 +188,7 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
// camera hooks
if (!config_cam.disable_emu) {
camhook_set_version(CAMHOOK_VERSION_NEW);
camhook_init(&config_cam);
}

View File

@ -0,0 +1,50 @@
#define LOG_MODULE "fs-hook"
#include <stdint.h>
#include <string.h>
#include "hook/table.h"
#include "imports/avs.h"
#include "iidxhook9/fs-hook.h"
#include "util/log.h"
#include "util/str.h"
static void *(*real_avs_fs_mount)(const char *dest, const char *src, const char *fs_type, const char *options);
static void *my_avs_fs_mount(const char *dest, const char *src, const char *fs_type, const char *options);
static const struct hook_symbol avs_fs_hook_syms[] = {
{.name = "XCgsqzn000004b", // avs_fs_mount
.ordinal = 76,
.patch = my_avs_fs_mount,
.link = (void **) &real_avs_fs_mount},
};
static void *my_avs_fs_mount(const char *dest, const char *src, const char *fs_type, const char *options)
{
// quick check for "F:\"
if (src[0] == 'F' && src[1] == ':' && src[2] == '\0') {
const char* dev_folder_drive = "dev/vfs/drive_f/";
log_misc("Redirecting %s to %s", src, dev_folder_drive);
CreateDirectoryA("dev/vfs/", NULL);
CreateDirectoryA("dev/vfs/drive_f/", NULL);
return real_avs_fs_mount(dest, dev_folder_drive, fs_type, options);
}
return real_avs_fs_mount(dest, src, fs_type, options);
}
void iidxhook9_fs_hooks_init()
{
hook_table_apply(
NULL,
"avs2-core.dll",
avs_fs_hook_syms,
lengthof(avs_fs_hook_syms));
log_info("Inserted avs fs hooks");
}

View File

@ -0,0 +1,6 @@
#ifndef IIDXHOOK9_FS_HOOKS_H
#define IIDXHOOK9_FS_HOOKS_H
void iidxhook9_fs_hooks_init();
#endif

View File

@ -0,0 +1,9 @@
dlls += iidxio-async
ldflags_iidxio-async := \
libs_iidxio-async := \
util \
src_iidxio-async := \
iidxio.c \

View File

@ -0,0 +1,18 @@
LIBRARY iidxio
EXPORTS
iidx_io_ep1_send
iidx_io_ep1_set_deck_lights
iidx_io_ep1_set_panel_lights
iidx_io_ep1_set_top_lamps
iidx_io_ep1_set_top_neons
iidx_io_ep2_get_keys
iidx_io_ep2_get_panel
iidx_io_ep2_get_sys
iidx_io_ep2_get_slider
iidx_io_ep2_get_turntable
iidx_io_ep2_recv
iidx_io_ep3_write_16seg
iidx_io_fini
iidx_io_init
iidx_io_set_loggers

View File

@ -0,0 +1,407 @@
#define LOG_MODULE "iidxio-async"
#include <windows.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include "bemanitools/iidxio.h"
#include "util/log.h"
#include "util/thread.h"
#include "util/time.h"
typedef void (*iidx_io_set_loggers_t)(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal);
typedef bool (*iidx_io_init_t)(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy);
typedef void (*iidx_io_fini_t)(void);
typedef void (*iidx_io_ep1_set_deck_lights_t)(uint16_t deck_lights);
typedef void (*iidx_io_ep1_set_panel_lights_t)(uint8_t panel_lights);
typedef void (*iidx_io_ep1_set_top_lamps_t)(uint8_t top_lamps);
typedef void (*iidx_io_ep1_set_top_neons_t)(bool top_neons);
typedef bool (*iidx_io_ep1_send_t)(void);
typedef bool (*iidx_io_ep2_recv_t)(void);
typedef uint8_t (*iidx_io_ep2_get_turntable_t)(uint8_t player_no);
typedef uint8_t (*iidx_io_ep2_get_slider_t)(uint8_t slider_no);
typedef uint8_t (*iidx_io_ep2_get_sys_t)(void);
typedef uint8_t (*iidx_io_ep2_get_panel_t)(void);
typedef uint16_t (*iidx_io_ep2_get_keys_t)(void);
typedef bool (*iidx_io_ep3_write_16seg_t)(const char *text);
static HMODULE _child_iidx_io_module;
static iidx_io_set_loggers_t _child_iidx_io_set_loggers;
static iidx_io_init_t _child_iidx_io_init;
static iidx_io_fini_t _child_iidx_io_fini;
static iidx_io_ep1_set_deck_lights_t _child_iidx_io_ep1_set_deck_lights;
static iidx_io_ep1_set_panel_lights_t _child_iidx_io_ep1_set_panel_lights;
static iidx_io_ep1_set_top_lamps_t _child_iidx_io_ep1_set_top_lamps;
static iidx_io_ep1_set_top_neons_t _child_iidx_io_ep1_set_top_neons;
static iidx_io_ep1_send_t _child_iidx_io_ep1_send;
static iidx_io_ep2_recv_t _child_iidx_io_ep2_recv;
static iidx_io_ep2_get_turntable_t _child_iidx_io_ep2_get_turntable;
static iidx_io_ep2_get_slider_t _child_iidx_io_ep2_get_slider;
static iidx_io_ep2_get_sys_t _child_iidx_io_ep2_get_sys;
static iidx_io_ep2_get_panel_t _child_iidx_io_ep2_get_panel;
static iidx_io_ep2_get_keys_t _child_iidx_io_ep2_get_keys;
static iidx_io_ep3_write_16seg_t _child_iidx_io_ep3_write_16seg;
static log_formatter_t _log_formatter_misc;
static log_formatter_t _log_formatter_info;
static log_formatter_t _log_formatter_warning;
static log_formatter_t _log_formatter_fatal;
static _Atomic(bool) _io_thread_proc_loop;
static _Atomic(bool) _io_thread_proc_running;
static _Atomic(uint16_t) _child_iidx_io_deck_lights;
static _Atomic(uint8_t) _child_iidx_io_panel_lights;
static _Atomic(uint8_t) _child_iidx_io_top_lamps;
static _Atomic(bool) _child_iidx_io_top_neons;
static _Atomic(uint8_t) _child_iidx_io_turntable_p1;
static _Atomic(uint8_t) _child_iidx_io_turntable_p2;
static _Atomic(uint8_t) _child_iidx_io_slider_1;
static _Atomic(uint8_t) _child_iidx_io_slider_2;
static _Atomic(uint8_t) _child_iidx_io_slider_3;
static _Atomic(uint8_t) _child_iidx_io_slider_4;
static _Atomic(uint8_t) _child_iidx_io_slider_5;
static _Atomic(uint8_t) _child_iidx_io_sys;
static _Atomic(uint8_t) _child_iidx_io_panel;
static _Atomic(uint16_t) _child_iidx_io_keys;
static HANDLE _child_iidx_io_16seg_mutex;
static char _child_iidx_16seg[9];
static bool _child_iidx_io_16seg_dirty;
static int _io_thread_proc(void *ctx)
{
uint64_t time_start;
uint64_t time_end;
uint64_t loop_counter;
uint64_t total_time;
char text_16seg[9];
bool result;
atomic_store_explicit(&_io_thread_proc_running, true, memory_order_seq_cst);
log_info("IO thread running");
time_start = time_get_counter();
loop_counter = 0;
while (atomic_load_explicit(&_io_thread_proc_loop, memory_order_seq_cst)) {
result = _child_iidx_io_ep2_recv();
if (!result) {
log_warning("_child_iidx_io_ep2_recv returned false");
atomic_store_explicit(
&_io_thread_proc_running, false, memory_order_seq_cst);
log_info("IO thread shut down");
return 0;
}
atomic_store_explicit(&_child_iidx_io_turntable_p1, _child_iidx_io_ep2_get_turntable(0), memory_order_relaxed);
atomic_store_explicit(&_child_iidx_io_turntable_p2, _child_iidx_io_ep2_get_turntable(1), memory_order_relaxed);
atomic_store_explicit(&_child_iidx_io_slider_1, _child_iidx_io_ep2_get_slider(0), memory_order_relaxed);
atomic_store_explicit(&_child_iidx_io_slider_2, _child_iidx_io_ep2_get_slider(1), memory_order_relaxed);
atomic_store_explicit(&_child_iidx_io_slider_3, _child_iidx_io_ep2_get_slider(2), memory_order_relaxed);
atomic_store_explicit(&_child_iidx_io_slider_4, _child_iidx_io_ep2_get_slider(3), memory_order_relaxed);
atomic_store_explicit(&_child_iidx_io_slider_5, _child_iidx_io_ep2_get_slider(4), memory_order_relaxed);
atomic_store_explicit(&_child_iidx_io_sys, _child_iidx_io_ep2_get_sys(), memory_order_relaxed);
atomic_store_explicit(&_child_iidx_io_panel, _child_iidx_io_ep2_get_panel(), memory_order_relaxed);
atomic_store_explicit(&_child_iidx_io_keys, _child_iidx_io_ep2_get_keys(), memory_order_relaxed);
_child_iidx_io_ep1_set_deck_lights(atomic_load_explicit(&_child_iidx_io_deck_lights, memory_order_relaxed));
_child_iidx_io_ep1_set_panel_lights(atomic_load_explicit(&_child_iidx_io_panel_lights, memory_order_relaxed));
_child_iidx_io_ep1_set_top_lamps(atomic_load_explicit(&_child_iidx_io_top_lamps, memory_order_relaxed));
_child_iidx_io_ep1_set_top_neons(atomic_load_explicit(&_child_iidx_io_top_neons, memory_order_relaxed));
result = _child_iidx_io_ep1_send();
if (!result) {
log_warning("_child_iidx_io_ep1_send returned false");
atomic_store_explicit(
&_io_thread_proc_running, false, memory_order_seq_cst);
log_info("IO thread shut down");
return 0;
}
if (_child_iidx_io_16seg_dirty) {
WaitForSingleObject(_child_iidx_io_16seg_mutex, INFINITE);
memcpy(text_16seg, _child_iidx_16seg, sizeof(text_16seg));
_child_iidx_io_16seg_dirty = false;
ReleaseMutex(_child_iidx_io_16seg_mutex);
result = _child_iidx_io_ep3_write_16seg(text_16seg);
if (!result) {
log_warning("_child_iidx_io_ep3_write_16seg returned false");
atomic_store_explicit(
&_io_thread_proc_running, false, memory_order_seq_cst);
log_info("IO thread shut down");
return 0;
}
}
// Don't hog the CPU
SwitchToThread();
loop_counter++;
}
time_end = time_get_counter();
total_time = time_get_elapsed_us(time_end - time_start);
log_info(
"IO thread performance: total iterations %lld, avg. loop cycle time %f "
"us",
loop_counter,
((double) total_time) / loop_counter);
atomic_store_explicit(
&_io_thread_proc_running, false, memory_order_seq_cst);
log_info("IO thread shut down");
return 0;
}
static void *_load_function(HMODULE module, const char *name)
{
void *ptr;
ptr = GetProcAddress(module, name);
if (ptr == NULL) {
log_fatal("Could not find function %s in iidxio child library", name);
}
return ptr;
}
void iidx_io_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal)
{
_log_formatter_misc = misc;
_log_formatter_info = info;
_log_formatter_warning = warning;
_log_formatter_fatal = fatal;
log_to_external(misc, info, warning, fatal);
}
bool iidx_io_init(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy)
{
log_info("Loading iidxio-async-child.dll as child iidxio library...");
_child_iidx_io_module = LoadLibraryA("iidxio-async-child.dll");
if (_child_iidx_io_module == NULL) {
log_warning("Loading iidxio-async-child.dll failed");
return false;
}
_child_iidx_io_set_loggers =
_load_function(_child_iidx_io_module, "iidx_io_set_loggers");
_child_iidx_io_init = _load_function(_child_iidx_io_module, "iidx_io_init");
_child_iidx_io_fini = _load_function(_child_iidx_io_module, "iidx_io_fini");
_child_iidx_io_ep1_set_deck_lights =
_load_function(_child_iidx_io_module, "iidx_io_ep1_set_deck_lights");
_child_iidx_io_ep1_set_panel_lights =
_load_function(_child_iidx_io_module, "iidx_io_ep1_set_panel_lights");
_child_iidx_io_ep1_set_top_lamps =
_load_function(_child_iidx_io_module, "iidx_io_ep1_set_top_lamps");
_child_iidx_io_ep1_set_top_neons =
_load_function(_child_iidx_io_module, "iidx_io_ep1_set_top_neons");
_child_iidx_io_ep1_send =
_load_function(_child_iidx_io_module, "iidx_io_ep1_send");
_child_iidx_io_ep2_recv =
_load_function(_child_iidx_io_module, "iidx_io_ep2_recv");
_child_iidx_io_ep2_get_turntable =
_load_function(_child_iidx_io_module, "iidx_io_ep2_get_turntable");
_child_iidx_io_ep2_get_slider =
_load_function(_child_iidx_io_module, "iidx_io_ep2_get_slider");
_child_iidx_io_ep2_get_sys =
_load_function(_child_iidx_io_module, "iidx_io_ep2_get_sys");
_child_iidx_io_ep2_get_panel =
_load_function(_child_iidx_io_module, "iidx_io_ep2_get_panel");
_child_iidx_io_ep2_get_keys =
_load_function(_child_iidx_io_module, "iidx_io_ep2_get_keys");
_child_iidx_io_ep3_write_16seg =
_load_function(_child_iidx_io_module, "iidx_io_ep3_write_16seg");
_child_iidx_io_set_loggers(
_log_formatter_misc,
_log_formatter_info,
_log_formatter_warning,
_log_formatter_fatal);
_child_iidx_io_16seg_mutex = CreateMutex(NULL, FALSE, NULL);
log_info("Calling child iidx_io_init...");
if (!_child_iidx_io_init(thread_create, thread_join, thread_destroy)) {
log_warning("Child iidx_io_init failed");
FreeLibrary(_child_iidx_io_module);
CloseHandle(_child_iidx_io_16seg_mutex);
return false;
}
atomic_store_explicit(&_io_thread_proc_loop, true, memory_order_seq_cst);
if (!thread_create(_io_thread_proc, NULL, 16384, 0)) {
log_warning("Creating IO thread failed");
_child_iidx_io_fini();
FreeLibrary(_child_iidx_io_module);
CloseHandle(_child_iidx_io_16seg_mutex);
return false;
}
return true;
}
void iidx_io_fini(void)
{
atomic_store_explicit(&_io_thread_proc_loop, false, memory_order_seq_cst);
log_info("Shutting down IO thread and waiting for it to finish...");
while (
atomic_load_explicit(&_io_thread_proc_running, memory_order_seq_cst)) {
Sleep(1);
}
log_info("IO thread finished");
_child_iidx_io_fini();
FreeLibrary(_child_iidx_io_module);
CloseHandle(_child_iidx_io_16seg_mutex);
}
void iidx_io_ep1_set_deck_lights(uint16_t deck_lights)
{
atomic_store_explicit(
&_child_iidx_io_deck_lights, deck_lights, memory_order_relaxed);
}
void iidx_io_ep1_set_panel_lights(uint8_t panel_lights)
{
atomic_store_explicit(
&_child_iidx_io_panel_lights, panel_lights, memory_order_relaxed);
}
void iidx_io_ep1_set_top_lamps(uint8_t top_lamps)
{
atomic_store_explicit(
&_child_iidx_io_top_lamps, top_lamps, memory_order_relaxed);
}
void iidx_io_ep1_set_top_neons(bool top_neons)
{
atomic_store_explicit(
&_child_iidx_io_top_neons, top_neons, memory_order_relaxed);
}
bool iidx_io_ep1_send(void)
{
// Any sending and receiving is executed async in a separate thread
return true;
}
bool iidx_io_ep2_recv(void)
{
// Any sending and receiving is executed async in a separate thread
return true;
}
uint8_t iidx_io_ep2_get_turntable(uint8_t player_no)
{
switch (player_no)
{
case 0:
return atomic_load_explicit(&_child_iidx_io_turntable_p1, memory_order_relaxed);
case 1:
return atomic_load_explicit(&_child_iidx_io_turntable_p2, memory_order_relaxed);
default:
return 0;
}
}
uint8_t iidx_io_ep2_get_slider(uint8_t slider_no)
{
switch (slider_no)
{
case 0:
return atomic_load_explicit(&_child_iidx_io_slider_1, memory_order_relaxed);
case 1:
return atomic_load_explicit(&_child_iidx_io_slider_2, memory_order_relaxed);
case 2:
return atomic_load_explicit(&_child_iidx_io_slider_3, memory_order_relaxed);
case 3:
return atomic_load_explicit(&_child_iidx_io_slider_4, memory_order_relaxed);
case 4:
return atomic_load_explicit(&_child_iidx_io_slider_5, memory_order_relaxed);
default:
return 0;
}
}
uint8_t iidx_io_ep2_get_sys(void)
{
return atomic_load_explicit(&_child_iidx_io_sys, memory_order_relaxed);
}
uint8_t iidx_io_ep2_get_panel(void)
{
return atomic_load_explicit(&_child_iidx_io_panel, memory_order_relaxed);
}
uint16_t iidx_io_ep2_get_keys(void)
{
return atomic_load_explicit(&_child_iidx_io_keys, memory_order_relaxed);
}
bool iidx_io_ep3_write_16seg(const char *text)
{
// This section is only producer while the thread is the only consumer
// Utilize this to optimize the 16seg writing and only write if the text has actually changed
if (!strcmp(text, _child_iidx_16seg)) {
return true;
}
WaitForSingleObject(_child_iidx_io_16seg_mutex, INFINITE);
memcpy(_child_iidx_16seg, text, sizeof(_child_iidx_16seg));
_child_iidx_io_16seg_dirty = true;
ReleaseMutex(_child_iidx_io_16seg_mutex);
return true;
}

View File

@ -0,0 +1,10 @@
libs += imgui-bt
libs_imgui-bt := \
hook \
hooklib \
util \
imgui \
src_imgui-bt := \
imgui-d3d9-hook.c \

View File

@ -0,0 +1,10 @@
#ifndef IMGUI_BT_CIMGUI_H
#define IMGUI_BT_CIMGUI_H
// Comprehensive header file for including cimgui correctly for integration in this project
#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#include "imgui/cimgui.h"
#include "imgui/cimgui_impl_dx9.h"
#include "imgui/cimgui_impl_win32.h"
#endif

View File

@ -0,0 +1,12 @@
#ifndef IMGUI_BT_COMPONENT_H
#define IMGUI_BT_COMPONENT_H
#include "imgui-bt/cimgui.h"
typedef void (*imgui_bt_component_frame_update_t)(ImGuiContext *ctx);
typedef struct imgui_bt_component {
imgui_bt_component_frame_update_t frame_update;
} imgui_bt_component_t;
#endif

View File

@ -0,0 +1,143 @@
#define LOG_MODULE "imgui-d3d9-hook"
#include "hook/d3d9.h"
#include "hook/table.h"
#include "imgui-bt/cimgui.h"
#include "imgui-bt/component.h"
#include "util/defs.h"
#include "util/log.h"
#include "util/mem.h"
typedef LRESULT WINAPI (*RegisterClassA_t)(WNDCLASSA *lpwcx);
typedef LRESULT WINAPI (*WndProc_t)(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT WINAPI _imgui_d3d9_hook_RegisterClassA(WNDCLASSA *lpwcx);
static bool _imgui_d3d9_hook_initialized;
static ImGuiContext *_imgui_d3d9_hook_imgui_ctx;
static RegisterClassA_t _imgui_d3d9_hook_original_RegisterClassA;
static WndProc_t _imgui_d3d9_hook_original_wndproc;
static imgui_bt_component_t *_imgui_d3d9_hook_components;
static size_t _imgui_d3d9_hook_component_count;
static const struct hook_symbol _imgui_d3d9_hook_syms[] = {
{.name = "RegisterClassA",
.patch = _imgui_d3d9_hook_RegisterClassA,
.link = (void **) &_imgui_d3d9_hook_original_RegisterClassA},
};
CIMGUI_API LRESULT igImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT WINAPI _imgui_d3d9_hook_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
LRESULT result;
result = igImplWin32_WndProcHandler(hWnd, msg, wParam, lParam);
if (result) {
return result;
}
return _imgui_d3d9_hook_original_wndproc(hWnd, msg, wParam, lParam);
}
static LRESULT WINAPI _imgui_d3d9_hook_RegisterClassA(WNDCLASSA *lpwcx)
{
log_info("Swapping out WndProc handler for wrapper handler in RegisterClassA %s", lpwcx->lpszClassName);
_imgui_d3d9_hook_original_wndproc = lpwcx->lpfnWndProc;
lpwcx->lpfnWndProc = _imgui_d3d9_hook_WndProc;
return _imgui_d3d9_hook_original_RegisterClassA(lpwcx);
}
void imgui_d3d9_hook_init(const imgui_bt_component_t *components, size_t component_count)
{
ImGuiIO *io;
ImGuiStyle* style;
log_assert(components);
log_assert(component_count > 0);
_imgui_d3d9_hook_components = (imgui_bt_component_t *) xmalloc(component_count * sizeof(imgui_bt_component_t));
memcpy(_imgui_d3d9_hook_components, components, component_count * sizeof(imgui_bt_component_t));
_imgui_d3d9_hook_component_count = component_count;
_imgui_d3d9_hook_imgui_ctx = igCreateContext(NULL);
io = igGetIO();
io->ConfigFlags = ImGuiConfigFlags_NavEnableKeyboard
| ImGuiConfigFlags_DockingEnable
| ImGuiConfigFlags_ViewportsEnable;
io->MouseDrawCursor = true;
io->IniFilename = NULL;
io->FontAllowUserScaling = true;
hook_table_apply(NULL, "user32.dll", _imgui_d3d9_hook_syms, lengthof(_imgui_d3d9_hook_syms));
// Setup style
style = igGetStyle();
style->Colors[ImGuiCol_WindowBg] = (ImVec4){0.0f, 0.0f, 0.0f, 1.0f};
style->Colors[ImGuiCol_PlotLines] = (ImVec4){1.0f, 1.0f, 0.0f, 1.0f};
_imgui_d3d9_hook_initialized = true;
}
void imgui_d3d9_hook_fini()
{
hook_table_revert(NULL, "user32.dll", _imgui_d3d9_hook_syms, lengthof(_imgui_d3d9_hook_syms));
igImplDX9_Shutdown();
igImplWin32_Shutdown();
igDestroyContext(NULL);
_imgui_d3d9_hook_initialized = false;
}
HRESULT imgui_hook_d3d9_irp_handler(struct hook_d3d9_irp *irp)
{
HRESULT hr;
log_assert(irp);
if (!_imgui_d3d9_hook_initialized) {
return hook_d3d9_irp_invoke_next(irp);
}
switch (irp->op) {
case HOOK_D3D9_IRP_OP_CTX_CREATE_DEVICE:
hr = hook_d3d9_irp_invoke_next(irp);
if (hr == S_OK) {
igImplWin32_Init(irp->args.ctx_create_device.hwnd);
igImplDX9_Init(*irp->args.ctx_create_device.pdev);
}
return hr;
case HOOK_D3D9_IRP_OP_DEV_BEGIN_SCENE:
igImplDX9_NewFrame();
igImplWin32_NewFrame();
igNewFrame();
for (size_t i = 0; i < _imgui_d3d9_hook_component_count; i++) {
_imgui_d3d9_hook_components[i].frame_update(_imgui_d3d9_hook_imgui_ctx);
}
return hook_d3d9_irp_invoke_next(irp);
case HOOK_D3D9_IRP_OP_DEV_END_SCENE:
igRender();
igImplDX9_RenderDrawData(igGetDrawData());
return hook_d3d9_irp_invoke_next(irp);
default:
return hook_d3d9_irp_invoke_next(irp);
}
log_fatal("Illegal state");
}

View File

@ -0,0 +1,13 @@
#ifndef IMGUI_D3D9_HOOK_H
#define IMGUI_D3D9_HOOK_H
#include "hook/d3d9.h"
#include "imgui-bt/component.h"
void imgui_d3d9_hook_init(const imgui_bt_component_t *components, size_t component_count);
void imgui_d3d9_hook_fini();
HRESULT imgui_hook_d3d9_irp_handler(struct hook_d3d9_irp *irp);
#endif

View File

@ -0,0 +1,10 @@
libs += imgui-debug
libs_imgui-debug := \
imgui-bt \
imgui \
util \
src_imgui-debug := \
frame-perf-graph.c \
time-history.c \

View File

@ -0,0 +1,258 @@
#include <math.h>
#include "imgui-bt/cimgui.h"
#include "imgui-debug/frame-perf-graph.h"
#include "imgui-debug/time-history.h"
#include "util/log.h"
typedef struct imgui_debug_frame_perf_graph {
float target_time_ms;
float y_axis_min_time_ms;
float y_axis_max_time_ms;
} imgui_debug_frame_perf_graph_t;
static const ImVec2 WINDOW_MIN_SIZE = {320, 240};
static imgui_debug_time_history_t _imgui_debug_frame_perf_graph_history;
static imgui_debug_frame_perf_graph_t _imgui_debug_frame_perf_graph;
static void _imgui_debug_frame_perf_graph_draw(
imgui_debug_frame_perf_graph_t *graph,
const imgui_debug_time_history_t *history)
{
float current_value;
ImVec2 window_size;
static bool show_labels = true;
static bool show_target_line = true;
static bool show_avg_line = true;
log_assert(history);
current_value = imgui_debug_time_history_recent_value_get(history);
igSetNextWindowSize(WINDOW_MIN_SIZE, ImGuiCond_FirstUseEver);
igSetNextWindowSizeConstraints(WINDOW_MIN_SIZE, igGetIO()->DisplaySize, NULL, NULL);
igBegin("Frame Time Graph", NULL, ImGuiWindowFlags_MenuBar);
// Add menu bar
if (igBeginMenuBar()) {
if (igBeginMenu("Settings", true)) {
igPushItemWidth(110);
float min_time_slider = graph->y_axis_min_time_ms;
float max_time_slider = graph->y_axis_max_time_ms;
float target_time_input = graph->target_time_ms;
if (igDragFloat("y-axis min time (ms)", &min_time_slider, 0.1f, 0.1f, max_time_slider - 0.1f, "%.1f", ImGuiSliderFlags_None)) {
graph->y_axis_min_time_ms = min_time_slider;
}
if (igDragFloat("y-axis max time (ms)", &max_time_slider, 0.1f, min_time_slider + 0.1f, 100.0f, "%.1f", ImGuiSliderFlags_None)) {
graph->y_axis_max_time_ms = max_time_slider;
}
if (igInputFloat("Target time reference (ms)", &target_time_input, 0.0f, 0.0f, "%.3f", ImGuiInputTextFlags_EnterReturnsTrue)) {
if (target_time_input >= 0.1f && target_time_input <= 100.0f) {
graph->target_time_ms = target_time_input;
} else {
target_time_input = graph->target_time_ms;
}
}
igCheckbox("Show reference line labels", &show_labels);
igCheckbox("Show target reference line", &show_target_line);
igCheckbox("Show average reference line", &show_avg_line);
if (igButton("Focus on average", (ImVec2){0, 0})) {
// Convert +/- 10 fps around average to milliseconds
float avg_fps = 1000.0f / history->avg_time_ms;
graph->y_axis_min_time_ms = 1000.0f / (avg_fps + 10.0f);
graph->y_axis_max_time_ms = 1000.0f / fmaxf(avg_fps - 10.0f, 1.0f);
}
igSameLine(0, -1);
if (igButton("Focus on target", (ImVec2){0, 0})) {
// Convert +/- 10 fps around target to milliseconds
float target_fps = 1000.0f / graph->target_time_ms;
graph->y_axis_min_time_ms = 1000.0f / (target_fps + 10.0f);
graph->y_axis_max_time_ms = 1000.0f / fmaxf(target_fps - 10.0f, 1.0f);
}
igPopItemWidth();
igEndMenu();
}
igEndMenuBar();
}
igGetContentRegionAvail(&window_size);
igPushStyleColor_Vec4(ImGuiCol_Text, (ImVec4){1, 1, 0, 1});
igText("Now %.3f ms", current_value);
igPopStyleColor(1);
igSameLine(0, -1);
igPushStyleColor_Vec4(ImGuiCol_Text, (ImVec4){1, 0, 0, 1});
igText("Target %.3f ms", graph->target_time_ms);
igPopStyleColor(1);
igPushStyleColor_Vec4(ImGuiCol_Text, (ImVec4){0, 1, 0, 1});
igText("Avg %.3f ms", history->avg_time_ms);
igPopStyleColor(1);
igSameLine(0, -1);
igText(" Min %.3f ms Max %.3f ms", history->min_time_ms, history->max_time_ms);
// Setup plot area using actual window size, with extra space at top for "ms" label
ImVec2 plot_pos;
igGetCursorScreenPos(&plot_pos);
plot_pos.y += 15; // Add space at top for "ms" label
ImVec2 plot_size = {window_size.x - 50, window_size.y - 65}; // Adjusted for extra top space
// Plot frame times in ms
ImVec2 plot_pos_offset = {plot_pos.x + 50, plot_pos.y};
igSetCursorScreenPos(plot_pos_offset);
igPlotLines_FloatPtr("##framegraph",
history->time_values_ms,
history->size,
history->current_index,
"",
graph->y_axis_min_time_ms,
graph->y_axis_max_time_ms,
plot_size,
sizeof(float));
// Draw Y axis (ms)
ImDrawList* draw_list = igGetWindowDrawList();
char y_label[32];
ImDrawList_AddLine(draw_list,
(ImVec2){plot_pos.x + 50, plot_pos.y},
(ImVec2){plot_pos.x + 50, plot_pos.y + plot_size.y},
igColorConvertFloat4ToU32((ImVec4){1,1,1,1}), 1.0f);
// Draw "ms" label at top of y-axis
ImDrawList_AddText_Vec2(draw_list, (ImVec2){plot_pos.x + 5, plot_pos.y - 15},
igColorConvertFloat4ToU32((ImVec4){1,1,1,1}), "ms", NULL);
// Scale number of reference points based on plot height
int num_reference_points = (int)(plot_size.y / 25); // One point per ~40 pixels
if (num_reference_points < 4) num_reference_points = 4;
float time_min = graph->y_axis_min_time_ms;
float time_max = graph->y_axis_max_time_ms;
float time_step = (time_max - time_min) / (num_reference_points + 1);
// Draw min time value at top of y-axis and reference line
snprintf(y_label, sizeof(y_label), "%.2f", time_min);
ImDrawList_AddText_Vec2(draw_list, (ImVec2){plot_pos.x + 5, plot_pos.y + plot_size.y - 10},
igColorConvertFloat4ToU32((ImVec4){1,1,1,1}), y_label, NULL);
ImDrawList_AddLine(draw_list,
(ImVec2){plot_pos.x + 50, plot_pos.y + plot_size.y},
(ImVec2){plot_pos.x + plot_size.x + 50, plot_pos.y + plot_size.y},
igColorConvertFloat4ToU32((ImVec4){1,1,1,0.3f}), 1.0f);
// Draw reference points and lines on side of y-axis
for (int i = 1; i <= num_reference_points; i++) {
float value = time_max - (time_step * i);
float normalized_pos = (time_max - value) / (time_max - time_min);
float y_pos = plot_pos.y + (plot_size.y * normalized_pos);
snprintf(y_label, sizeof(y_label), "%.2f", value);
ImDrawList_AddText_Vec2(draw_list, (ImVec2){plot_pos.x + 5, y_pos - 5},
igColorConvertFloat4ToU32((ImVec4){1,1,1,1}), y_label, NULL);
ImDrawList_AddLine(draw_list,
(ImVec2){plot_pos.x + 50, y_pos},
(ImVec2){plot_pos.x + plot_size.x + 50, y_pos},
igColorConvertFloat4ToU32((ImVec4){1,1,1,0.2f}), 1.0f);
}
// Draw max time value at bottom of y-axis and reference line
snprintf(y_label, sizeof(y_label), "%.2f", time_max);
ImDrawList_AddText_Vec2(draw_list, (ImVec2){plot_pos.x + 5, plot_pos.y},
igColorConvertFloat4ToU32((ImVec4){1,1,1,1}), y_label, NULL);
ImDrawList_AddLine(draw_list,
(ImVec2){plot_pos.x + 50, plot_pos.y},
(ImVec2){plot_pos.x + plot_size.x + 50, plot_pos.y},
igColorConvertFloat4ToU32((ImVec4){1,1,1,0.3f}), 1.0f);
// Draw target frame time reference line if within plot area
if (show_target_line && graph->target_time_ms >= time_min && graph->target_time_ms <= time_max) {
float normalized_target = (time_max - graph->target_time_ms) / (time_max - time_min);
float y_pos_target = plot_pos.y + (plot_size.y * normalized_target);
ImDrawList_AddLine(draw_list,
(ImVec2){plot_pos.x + 50, y_pos_target},
(ImVec2){plot_pos.x + plot_size.x + 50, y_pos_target},
igColorConvertFloat4ToU32((ImVec4){1,0,0,1.0f}), 1.0f);
if (show_labels) {
snprintf(y_label, sizeof(y_label), "%.3f", graph->target_time_ms);
ImDrawList_AddText_Vec2(draw_list,
(ImVec2){plot_pos.x + 50 + plot_size.x/2 - 10, y_pos_target + 5},
igColorConvertFloat4ToU32((ImVec4){1,0,0,1}), y_label, NULL);
}
}
// Draw reference line for current average if within plot area
if (show_avg_line && history->avg_time_ms >= time_min && history->avg_time_ms <= time_max) {
float normalized_avg = (time_max - history->avg_time_ms) / (time_max - time_min);
float y_pos_avg = plot_pos.y + (plot_size.y * normalized_avg);
ImDrawList_AddLine(draw_list,
(ImVec2){plot_pos.x + 50, y_pos_avg},
(ImVec2){plot_pos.x + plot_size.x + 50, y_pos_avg},
igColorConvertFloat4ToU32((ImVec4){0,1,0,1.0f}), 1.0f);
if (show_labels) {
snprintf(y_label, sizeof(y_label), "%.3f", history->avg_time_ms);
ImDrawList_AddText_Vec2(draw_list,
(ImVec2){plot_pos.x + 50 + plot_size.x/2 - 10, y_pos_avg + 5},
igColorConvertFloat4ToU32((ImVec4){0,1,0,1}), y_label, NULL);
}
}
// Draw X axis (time in frames)
ImDrawList_AddLine(draw_list,
(ImVec2){plot_pos.x + 50, plot_pos.y + plot_size.y},
(ImVec2){plot_pos.x + plot_size.x + 50, plot_pos.y + plot_size.y},
igColorConvertFloat4ToU32((ImVec4){1,1,1,1}), 1.0f);
// Draw "frames" label centered on x-axis
ImDrawList_AddText_Vec2(draw_list, (ImVec2){plot_pos.x + 50 + (plot_size.x / 2) - 20, plot_pos.y + plot_size.y + 5},
igColorConvertFloat4ToU32((ImVec4){1,1,1,1}), "frames ago", NULL);
char x_label[32];
snprintf(x_label, sizeof(x_label), "%d", history->size);
ImDrawList_AddText_Vec2(draw_list, (ImVec2){plot_pos.x + 50, plot_pos.y + plot_size.y + 5},
igColorConvertFloat4ToU32((ImVec4){1,1,1,1}), x_label, NULL);
ImDrawList_AddText_Vec2(draw_list, (ImVec2){plot_pos.x + plot_size.x + 50, plot_pos.y + plot_size.y + 5},
igColorConvertFloat4ToU32((ImVec4){1,1,1,1}), "0", NULL);
igEnd();
}
static void _imgui_debug_frame_perf_graph_component_frame_update(ImGuiContext *ctx)
{
ImGuiIO *io;
log_assert(ctx);
igSetCurrentContext(ctx);
io = igGetIO();
imgui_debug_time_history_update(&_imgui_debug_frame_perf_graph_history, 1000.0f / io->Framerate);
_imgui_debug_frame_perf_graph_draw(&_imgui_debug_frame_perf_graph, &_imgui_debug_frame_perf_graph_history);
}
void imgui_debug_frame_perf_graph_init(
float target_fps,
imgui_bt_component_t *component)
{
log_assert(target_fps > 0.0f);
log_assert(component);
imgui_debug_time_history_init(ceilf(10 * target_fps), &_imgui_debug_frame_perf_graph_history);
_imgui_debug_frame_perf_graph.target_time_ms = 1000.0f / target_fps;
_imgui_debug_frame_perf_graph.y_axis_min_time_ms = 1000.0f / fmaxf(0.0f, target_fps - 20.0f);
_imgui_debug_frame_perf_graph.y_axis_max_time_ms = 1000.0f / fminf(target_fps + 20.0f, 1000.0f);
component->frame_update = _imgui_debug_frame_perf_graph_component_frame_update;
}

View File

@ -0,0 +1,10 @@
#ifndef IMGUI_DEBUG_FRAME_PERF_GRAPH_H
#define IMGUI_DEBUG_FRAME_PERF_GRAPH_H
#include "imgui-bt/component.h"
void imgui_debug_frame_perf_graph_init(
float target_fps,
imgui_bt_component_t *component);
#endif

View File

@ -0,0 +1,63 @@
#include <stdlib.h>
#include <string.h>
#include "time-history.h"
#include "util/log.h"
#include "util/mem.h"
void imgui_debug_time_history_init(uint32_t size, imgui_debug_time_history_t *history)
{
log_assert(size > 0);
log_assert(history);
memset(history, 0, sizeof(imgui_debug_time_history_t));
history->size = size;
history->time_values_ms = (float *) xmalloc(size * sizeof(float));
}
void imgui_debug_time_history_update(imgui_debug_time_history_t *history, float time_ms)
{
log_assert(history);
history->time_values_ms[history->current_index] = time_ms;
history->current_index = (history->current_index + 1) % history->size;
history->min_time_ms = history->time_values_ms[0];
history->max_time_ms = history->time_values_ms[0];
history->avg_time_ms = 0;
for (uint32_t i = 0; i < history->size; i++) {
if (history->time_values_ms[i] < history->min_time_ms) {
history->min_time_ms = history->time_values_ms[i];
}
if (history->time_values_ms[i] > history->max_time_ms) {
history->max_time_ms = history->time_values_ms[i];
}
history->avg_time_ms += history->time_values_ms[i];
}
history->avg_time_ms /= history->size;
}
float imgui_debug_time_history_recent_value_get(const imgui_debug_time_history_t *history)
{
log_assert(history);
if (history->current_index == 0) {
return history->time_values_ms[history->size - 1];
} else {
return history->time_values_ms[history->current_index - 1];
}
}
void imgui_debug_time_history_free(imgui_debug_time_history_t *history)
{
log_assert(history);
log_assert(history->time_values_ms);
free(history->time_values_ms);
}

View File

@ -0,0 +1,23 @@
#ifndef IMGUI_DEBUG_TIME_HISTORY_H
#define IMGUI_DEBUG_TIME_HISTORY_H
#include <stdint.h>
typedef struct imgui_debug_time_history {
uint32_t size;
float *time_values_ms;
uint32_t current_index;
float min_time_ms;
float max_time_ms;
float avg_time_ms;
} imgui_debug_time_history_t;
void imgui_debug_time_history_init(uint32_t size, imgui_debug_time_history_t *history);
void imgui_debug_time_history_update(imgui_debug_time_history_t *history, float time_ms);
float imgui_debug_time_history_recent_value_get(const imgui_debug_time_history_t *history);
void imgui_debug_time_history_free(imgui_debug_time_history_t *history);
#endif

15
src/main/imgui/Module.mk Normal file
View File

@ -0,0 +1,15 @@
libs += imgui
src_imgui := \
cppsrc_imgui := \
cimgui.cpp \
cimgui_impl_dx9.cpp \
cimgui_impl_win32.cpp \
imgui_demo.cpp \
imgui_draw.cpp \
imgui_impl_dx9.cpp \
imgui_impl_win32.cpp \
imgui_tables.cpp \
imgui_widgets.cpp \
imgui.cpp \

View File

@ -0,0 +1 @@
#undef NDEBUG

5917
src/main/imgui/cimgui.cpp Normal file

File diff suppressed because it is too large Load Diff

5062
src/main/imgui/cimgui.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
#include "imgui_impl_dx9.h"
#include "imgui_internal.h"
#include "cimgui.h"
CIMGUI_API bool igImplDX9_Init(IDirect3DDevice9* device)
{
return ImGui_ImplDX9_Init(device);
}
CIMGUI_API void igImplDX9_Shutdown()
{
ImGui_ImplDX9_Shutdown();
}
CIMGUI_API void igImplDX9_NewFrame()
{
ImGui_ImplDX9_NewFrame();
}
CIMGUI_API void igImplDX9_RenderDrawData(ImDrawData* draw_data)
{
ImGui_ImplDX9_RenderDrawData(draw_data);
}
CIMGUI_API bool igImplDX9_CreateDeviceObjects()
{
return ImGui_ImplDX9_CreateDeviceObjects();
}
CIMGUI_API void igImplDX9_InvalidateDeviceObjects()
{
ImGui_ImplDX9_InvalidateDeviceObjects();
}

View File

@ -0,0 +1,16 @@
#ifndef CIMGUI_IMPL_DX9_INCLUDED
#define CIMGUI_IMPL_DX9_INCLUDED
#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#include "cimgui.h"
typedef struct IDirect3DDevice9 IDirect3DDevice9;
CIMGUI_API bool igImplDX9_Init(IDirect3DDevice9* device);
CIMGUI_API void igImplDX9_Shutdown();
CIMGUI_API void igImplDX9_NewFrame();
CIMGUI_API void igImplDX9_RenderDrawData(ImDrawData* draw_data);
CIMGUI_API bool igImplDX9_CreateDeviceObjects();
CIMGUI_API void igImplDX9_InvalidateDeviceObjects();
#endif // CIMGUI_IMPL_DX9_INCLUDED

View File

@ -0,0 +1,52 @@
#include <windows.h>
#include "imgui_impl_win32.h"
#include "imgui_internal.h"
#include "cimgui.h"
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
CIMGUI_API bool igImplWin32_Init(void* hwnd)
{
return ImGui_ImplWin32_Init(hwnd);
}
CIMGUI_API bool igImplWin32_InitForOpenGL(void* hwnd)
{
return ImGui_ImplWin32_InitForOpenGL(hwnd);
}
CIMGUI_API void igImplWin32_Shutdown()
{
ImGui_ImplWin32_Shutdown();
}
CIMGUI_API void igImplWin32_NewFrame()
{
ImGui_ImplWin32_NewFrame();
}
CIMGUI_API LRESULT igImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
return ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam);
}
CIMGUI_API void igImplWin32_EnableDpiAwareness()
{
ImGui_ImplWin32_EnableDpiAwareness();
}
CIMGUI_API float igImplWin32_GetDpiScaleForHwnd(void* hwnd)
{
return ImGui_ImplWin32_GetDpiScaleForHwnd(hwnd);
}
CIMGUI_API float igImplWin32_GetDpiScaleForMonitor(void* monitor)
{
return ImGui_ImplWin32_GetDpiScaleForMonitor(monitor);
}
CIMGUI_API void igImplWin32_EnableAlphaCompositing(void* hwnd)
{
ImGui_ImplWin32_EnableAlphaCompositing(hwnd);
}

View File

@ -0,0 +1,21 @@
#ifndef CIMGUI_IMPL_WIN32_INCLUDED
#define CIMGUI_IMPL_WIN32_INCLUDED
#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#include "cimgui.h"
CIMGUI_API bool igImplWin32_Init(void* hwnd);
CIMGUI_API bool igImplWin32_InitForOpenGL(void* hwnd);
CIMGUI_API void igImplWin32_Shutdown();
CIMGUI_API void igImplWin32_NewFrame();
#if 0
CIMGUI_API LRESULT igImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
#endif
CIMGUI_API void igImplWin32_EnableDpiAwareness();
CIMGUI_API float igImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd
CIMGUI_API float igImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor
CIMGUI_API void igImplWin32_EnableAlphaCompositing(void* hwnd); // HWND hwnd
#endif // CIMGUI_IMPL_WIN32_INCLUDED

142
src/main/imgui/imconfig.h Normal file
View File

@ -0,0 +1,142 @@
//-----------------------------------------------------------------------------
// DEAR IMGUI COMPILE-TIME OPTIONS
// Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure.
// You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions.
//-----------------------------------------------------------------------------
// A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it)
// B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template.
//-----------------------------------------------------------------------------
// You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp
// files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures.
// Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts.
// Call IMGUI_CHECKVERSION() from your .cpp file to verify that the data structures your files are using are matching the ones imgui.cpp is using.
//-----------------------------------------------------------------------------
#pragma once
//---- Define assertion handler. Defaults to calling assert().
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts
//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
// Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
// - Windows DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()
// for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.
//#define IMGUI_API __declspec(dllexport) // MSVC Windows: DLL export
//#define IMGUI_API __declspec(dllimport) // MSVC Windows: DLL import
//#define IMGUI_API __attribute__((visibility("default"))) // GCC/Clang: override visibility when set is hidden
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to clean your code of obsolete function/names.
#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
//---- Disable all of Dear ImGui or don't implement standard windows/tools.
// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp.
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty.
//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowIDStackToolWindow() will be empty.
//---- Don't implement some functions to reduce linkage requirements.
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
//#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW)
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a)
//#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, IME).
//#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default).
//#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS // Don't implement default platform_io.Platform_OpenInShellFn() handler (Win32: ShellExecute(), require shell32.lib/.a, Mac/Linux: use system("")).
//#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf)
//#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself.
//#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies)
//#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function.
//#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
//#define IMGUI_DISABLE_DEFAULT_FONT // Disable default embedded font (ProggyClean.ttf), remove ~9.5 KB from output binary. AddFontDefault() will assert.
//#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available
//---- Enable Test Engine / Automation features.
//#define IMGUI_ENABLE_TEST_ENGINE // Enable imgui_test_engine hooks. Generally set automatically by include "imgui_te_config.h", see Test Engine for details.
//---- Include imgui_user.h at the end of imgui.h as a convenience
// May be convenient for some users to only explicitly include vanilla imgui.h and have extra stuff included.
//#define IMGUI_INCLUDE_IMGUI_USER_H
//#define IMGUI_USER_H_FILENAME "my_folder/my_imgui_user.h"
//---- Pack vertex colors as BGRA8 instead of RGBA8 (to avoid converting from one to another). Need dedicated backend support.
//#define IMGUI_USE_BGRA_PACKED_COLOR
//---- Use legacy CRC32-adler tables (used before 1.91.6), in order to preserve old .ini data that you cannot afford to invalidate.
//#define IMGUI_USE_LEGACY_CRC32_ADLER
//---- Use 32-bit for ImWchar (default is 16-bit) to support Unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...)
//#define IMGUI_USE_WCHAR32
//---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
// By default the embedded implementations are declared static and not available outside of Dear ImGui sources files.
//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
//#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if IMGUI_USE_STB_SPRINTF is defined.
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
//#define IMGUI_DISABLE_STB_SPRINTF_IMPLEMENTATION // only disabled if IMGUI_USE_STB_SPRINTF is defined.
//---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined)
// Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h.
//#define IMGUI_USE_STB_SPRINTF
//---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui)
// Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided).
// On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'.
//#define IMGUI_ENABLE_FREETYPE
//---- Use FreeType + plutosvg or lunasvg to render OpenType SVG fonts (SVGinOT)
// Only works in combination with IMGUI_ENABLE_FREETYPE.
// - lunasvg is currently easier to acquire/install, as e.g. it is part of vcpkg.
// - plutosvg will support more fonts and may load them faster. It currently requires to be built manually but it is fairly easy. See misc/freetype/README for instructions.
// - Both require headers to be available in the include path + program to be linked with the library code (not provided).
// - (note: lunasvg implementation is based on Freetype's rsvg-port.c which is licensed under CeCILL-C Free Software License Agreement)
//#define IMGUI_ENABLE_FREETYPE_PLUTOSVG
//#define IMGUI_ENABLE_FREETYPE_LUNASVG
//---- Use stb_truetype to build and rasterize the font atlas (default)
// The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend.
//#define IMGUI_ENABLE_STB_TRUETYPE
//---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
// This will be inlined as part of ImVec2 and ImVec4 class declarations.
/*
#define IM_VEC2_CLASS_EXTRA \
constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \
operator MyVec2() const { return MyVec2(x,y); }
#define IM_VEC4_CLASS_EXTRA \
constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \
operator MyVec4() const { return MyVec4(x,y,z,w); }
*/
//---- ...Or use Dear ImGui's own very basic math operators.
//#define IMGUI_DEFINE_MATH_OPERATORS
//---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices.
// Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices).
// Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer.
// Read about ImGuiBackendFlags_RendererHasVtxOffset for details.
//#define ImDrawIdx unsigned int
//---- Override ImDrawCallback signature (will need to modify renderer backends accordingly)
//struct ImDrawList;
//struct ImDrawCmd;
//typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
//#define ImDrawCallback MyImDrawCallback
//---- Debug Tools: Macro to break in Debugger (we provide a default implementation of this in the codebase)
// (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.)
//#define IM_DEBUG_BREAK IM_ASSERT(0)
//#define IM_DEBUG_BREAK __debugbreak()
//---- Debug Tools: Enable slower asserts
//#define IMGUI_DEBUG_PARANOID
//---- Tip: You can add extra functions within the ImGui:: namespace from anywhere (e.g. your own sources/header files)
/*
namespace ImGui
{
void MyFunction(const char* name, MyMatrix44* mtx);
}
*/

22779
src/main/imgui/imgui.cpp Normal file

File diff suppressed because it is too large Load Diff

3987
src/main/imgui/imgui.h Normal file

File diff suppressed because it is too large Load Diff

10738
src/main/imgui/imgui_demo.cpp Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More