Compare commits
21 Commits
fpu-accuracy
...
rt64
| Author | SHA1 | Date | |
|---|---|---|---|
| 9899df462b | |||
| 2ac0594179 | |||
| c050387ed1 | |||
| bf195a6001 | |||
| 100ea80254 | |||
| 8f1afd60af | |||
| 0246862149 | |||
| 9f4ea7ab67 | |||
| 8d4229e885 | |||
| 67ceae2a2e | |||
| d325019c31 | |||
| 27d8018003 | |||
| fa60e44e64 | |||
| e30f098721 | |||
| bcc59fe725 | |||
| 793ff9b8f2 | |||
| 01c34abcfa | |||
| bc323e7c18 | |||
| 159a57adb8 | |||
| 810cd610cd | |||
| 1c9452dfb7 |
@@ -4,7 +4,7 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
Linux:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -14,8 +14,7 @@ jobs:
|
||||
key: Linux
|
||||
- name: Install Packages
|
||||
run: |
|
||||
sudo add-apt-repository ppa:okirby/qt6-backports --yes
|
||||
sudo apt-get -y install cmake ninja-build libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl2-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev libqt6svg6-dev libvulkan-dev build-essential nasm git zip appstream
|
||||
sudo apt-get -y install cmake ninja-build libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl2-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev libqt6svg6-dev libvulkan-dev libgtk-3-dev build-essential nasm git zip appstream
|
||||
- name: Prepare Environment
|
||||
run: |
|
||||
echo "GIT_REVISION=$(git describe --tags --always)" >> $GITHUB_ENV
|
||||
|
||||
@@ -223,6 +223,9 @@ install(FILES ${MUPEN64PLUS_PLUGIN_GFX_PARALLEL}
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/GFX
|
||||
PERMISSIONS ${LIB_PERMISSIONS}
|
||||
)
|
||||
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_RT64}
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/GFX
|
||||
)
|
||||
|
||||
if (INSTALL_DESKTOP_FILE)
|
||||
install(FILES Package/com.github.Rosalie241.RMG.desktop
|
||||
|
||||
@@ -230,6 +230,19 @@ ExternalProject_Add(mupen64plus-video-parallel
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-video-parallel/mupen64plus-video-parallel.${SO_EXT}
|
||||
)
|
||||
|
||||
ExternalProject_Add(mupen64plus-video-rt64
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rt64
|
||||
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_IN_SOURCE False
|
||||
BUILD_ALWAYS True
|
||||
CMAKE_ARGS ${CMAKE_CONFIGURE_ARGS} -DRT64_BUILD_PLUGIN=ON
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/rt64
|
||||
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/rt64/rt64.${SO_EXT}
|
||||
)
|
||||
|
||||
if (DISCORD_RPC)
|
||||
ExternalProject_Add(discord-rpc
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc
|
||||
@@ -326,6 +339,9 @@ set(MUPEN64PLUS_PLUGIN_GFX_GLIDEN64_DATA ${GLIDENUI_TRANSLATIONS} ${GLIDEN64_CUS
|
||||
ExternalProject_Get_property(mupen64plus-video-parallel BUILD_BYPRODUCTS)
|
||||
set(MUPEN64PLUS_PLUGIN_GFX_PARALLEL ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
|
||||
ExternalProject_Get_property(mupen64plus-video-rt64 BUILD_BYPRODUCTS)
|
||||
set(MUPEN64PLUS_PLUGIN_GFX_RT64 ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
|
||||
if (DISCORD_RPC)
|
||||
ExternalProject_Get_property(discord-rpc BUILD_BYPRODUCTS)
|
||||
set(DISCORD_RPC_LIB ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
|
||||
@@ -169,6 +169,8 @@ EXPORT m64p_error CALL CoreDoCommand(m64p_command Command, int ParamInt, void *P
|
||||
{
|
||||
m64p_error rval;
|
||||
int keysym, keymod;
|
||||
int x, y;
|
||||
int left, right;
|
||||
|
||||
if (!l_CoreInit)
|
||||
return M64ERR_NOT_INIT;
|
||||
@@ -315,6 +317,20 @@ EXPORT m64p_error CALL CoreDoCommand(m64p_command Command, int ParamInt, void *P
|
||||
keymod = (ParamInt >> 16) & 0xffff;
|
||||
event_sdl_keyup(keysym, keymod);
|
||||
return M64ERR_SUCCESS;
|
||||
case M64CMD_SET_MOUSE_MOVE:
|
||||
if (!g_EmulatorRunning)
|
||||
return M64ERR_INVALID_STATE;
|
||||
x = ParamInt & 0xffff;
|
||||
y = (ParamInt >> 16) & 0xffff;
|
||||
event_mouse_move(x, y);
|
||||
return M64ERR_SUCCESS;
|
||||
case M64CMD_SET_MOUSE_BUTTON:
|
||||
if (!g_EmulatorRunning)
|
||||
return M64ERR_INVALID_STATE;
|
||||
left = ParamInt & 0xffff;
|
||||
right = (ParamInt >> 16) & 0xffff;
|
||||
event_mouse_button(left, right);
|
||||
return M64ERR_SUCCESS;
|
||||
case M64CMD_SET_FRAME_CALLBACK:
|
||||
*(void**)&g_FrameCallback = ParamPtr;
|
||||
return M64ERR_SUCCESS;
|
||||
|
||||
@@ -199,6 +199,8 @@ typedef void (*ptr_ViWidthChanged)(void);
|
||||
typedef void (*ptr_ReadScreen2)(void *dest, int *width, int *height, int front);
|
||||
typedef void (*ptr_SetRenderingCallback)(void (*callback)(int));
|
||||
typedef void (*ptr_ResizeVideoOutput)(int width, int height);
|
||||
typedef void (*ptr_MouseMove)(int x, int y);
|
||||
typedef void (*ptr_MouseButton)(int left, int right);
|
||||
#if defined(M64P_PLUGIN_PROTOTYPES)
|
||||
EXPORT void CALL ChangeWindow(void);
|
||||
EXPORT int CALL InitiateGFX(GFX_INFO Gfx_Info);
|
||||
@@ -212,6 +214,8 @@ EXPORT void CALL ViWidthChanged(void);
|
||||
EXPORT void CALL ReadScreen2(void *dest, int *width, int *height, int front);
|
||||
EXPORT void CALL SetRenderingCallback(void (*callback)(int));
|
||||
EXPORT void CALL ResizeVideoOutput(int width, int height);
|
||||
EXPORT void CALL MouseMove(int x, int y);
|
||||
EXPORT void CALL MouseButton(int left, int right);
|
||||
#endif
|
||||
|
||||
/* frame buffer plugin spec extension */
|
||||
|
||||
@@ -171,7 +171,9 @@ typedef enum {
|
||||
M64CMD_PIF_OPEN,
|
||||
M64CMD_ROM_SET_SETTINGS,
|
||||
M64CMD_DISK_OPEN,
|
||||
M64CMD_DISK_CLOSE
|
||||
M64CMD_DISK_CLOSE,
|
||||
M64CMD_SET_MOUSE_MOVE,
|
||||
M64CMD_SET_MOUSE_BUTTON,
|
||||
} m64p_command;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -676,8 +676,9 @@ void event_sdl_keydown(int keysym, int keymod)
|
||||
else
|
||||
#endif /* NO_KEYBINDINGS */
|
||||
{
|
||||
/* pass all other keypresses to the input plugin */
|
||||
/* pass all other keypresses to the input and graphics plugin */
|
||||
input.keyDown(keymod, keysym);
|
||||
gfx.keyDown(keymod, keysym);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -701,6 +702,23 @@ void event_sdl_keyup(int keysym, int keymod)
|
||||
#endif /* NO_KEYBINDINGS */
|
||||
{
|
||||
input.keyUp(keymod, keysym);
|
||||
gfx.keyUp(keymod, keysym);
|
||||
}
|
||||
}
|
||||
|
||||
void event_mouse_move(int x, int y)
|
||||
{
|
||||
if (gfx.mouseMove != NULL)
|
||||
{
|
||||
gfx.mouseMove(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void event_mouse_button(int left, int right)
|
||||
{
|
||||
if (gfx.mouseButton != NULL)
|
||||
{
|
||||
gfx.mouseButton(left, right);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ extern int event_set_core_defaults(void);
|
||||
extern void event_initialize(void);
|
||||
extern void event_sdl_keydown(int keysym, int keymod);
|
||||
extern void event_sdl_keyup(int keysym, int keymod);
|
||||
extern void event_mouse_move(int x, int y);
|
||||
extern void event_mouse_button(int left, int right);
|
||||
extern int event_gameshark_active(void);
|
||||
extern void event_set_gameshark(int active);
|
||||
|
||||
|
||||
@@ -62,6 +62,10 @@ static const gfx_plugin_functions dummy_gfx = {
|
||||
dummyvideo_ProcessRDPList,
|
||||
dummyvideo_RomClosed,
|
||||
dummyvideo_RomOpen,
|
||||
dummyinput_SDL_KeyDown,
|
||||
dummyinput_SDL_KeyUp,
|
||||
NULL,
|
||||
NULL,
|
||||
dummyvideo_ShowCFB,
|
||||
dummyvideo_UpdateScreen,
|
||||
dummyvideo_ViStatusChanged,
|
||||
@@ -191,6 +195,20 @@ static m64p_error plugin_connect_gfx(m64p_dynlib_handle plugin_handle)
|
||||
return M64ERR_INPUT_INVALID;
|
||||
}
|
||||
|
||||
if (!GET_FUNC(ptr_SDL_KeyDown, gfx.keyDown, "SDL_KeyDown") ||
|
||||
!GET_FUNC(ptr_SDL_KeyUp, gfx.keyUp, "SDL_KeyUp"))
|
||||
{
|
||||
gfx.keyDown = dummyinput_SDL_KeyDown;
|
||||
gfx.keyUp = dummyinput_SDL_KeyUp;
|
||||
DebugMessage(M64MSG_WARNING, "abc");
|
||||
}
|
||||
|
||||
if (!GET_FUNC(ptr_MouseMove, gfx.mouseMove, "MouseMove") ||
|
||||
!GET_FUNC(ptr_MouseButton, gfx.mouseButton, "MouseButton"))
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "gfx plugin does not contain n64 mouse support.");
|
||||
}
|
||||
|
||||
/* set function pointers for optional functions */
|
||||
gfx.resizeVideoOutput = (ptr_ResizeVideoOutput)osal_dynlib_getproc(plugin_handle, "ResizeVideoOutput");
|
||||
|
||||
|
||||
@@ -51,6 +51,10 @@ typedef struct _gfx_plugin_functions
|
||||
ptr_ProcessRDPList processRDPList;
|
||||
ptr_RomClosed romClosed;
|
||||
ptr_RomOpen romOpen;
|
||||
ptr_SDL_KeyDown keyDown;
|
||||
ptr_SDL_KeyUp keyUp;
|
||||
ptr_MouseMove mouseMove;
|
||||
ptr_MouseButton mouseButton;
|
||||
ptr_ShowCFB showCFB;
|
||||
ptr_UpdateScreen updateScreen;
|
||||
ptr_ViStatusChanged viStatusChanged;
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
name: validate
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
type: [ Debug, Release ]
|
||||
os: [ ubuntu-latest, windows-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-rt64-ccache-${{ matrix.type }}
|
||||
- name: Install Windows Dependencies
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
choco install ninja
|
||||
Remove-Item -Path "C:\ProgramData\Chocolatey\bin\ccache.exe" -Force -ErrorAction SilentlyContinue
|
||||
- name: Install Linux Dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ninja-build libsdl2-dev libgtk-3-dev
|
||||
|
||||
# Install SDL2
|
||||
echo ::group::install SDL2
|
||||
|
||||
# Enable ccache
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
|
||||
wget https://www.libsdl.org/release/SDL2-2.26.1.tar.gz
|
||||
tar -xzf SDL2-2.26.1.tar.gz
|
||||
cd SDL2-2.26.1
|
||||
./configure
|
||||
make -j 10
|
||||
sudo make install
|
||||
sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/
|
||||
echo ::endgroup::
|
||||
- name: Configure Developer Command Prompt
|
||||
if: runner.os == 'Windows'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: Build RT64 (Unix)
|
||||
if: runner.os != 'Windows'
|
||||
run: |-
|
||||
# enable ccache
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build
|
||||
cmake --build cmake-build --config ${{ matrix.type }} --target rt64 -j $(nproc)
|
||||
- name: Build RT64 (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: |-
|
||||
# enable ccache
|
||||
set $env:PATH="$env:USERPROFILE/.cargo/bin;$env:PATH"
|
||||
$cpuCores = (Get-CimInstance -ClassName Win32_Processor).NumberOfLogicalProcessors
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build
|
||||
cmake --build cmake-build --config ${{ matrix.type }} --target rt64 -j $cpuCores
|
||||
@@ -0,0 +1,25 @@
|
||||
*.vs
|
||||
*.db
|
||||
*.log
|
||||
*.dll
|
||||
*.exe
|
||||
*.lib
|
||||
*.exp
|
||||
*.ipdb
|
||||
*.iobj
|
||||
*.tlog
|
||||
*.recipe
|
||||
*.FileListAbsolute.txt
|
||||
*.idb
|
||||
*.hlsl.h
|
||||
*.dxil.h
|
||||
*.spirv.h
|
||||
*.bat
|
||||
*.rw
|
||||
*.rw.h
|
||||
*.obj
|
||||
*.pdb
|
||||
build/
|
||||
.vscode/
|
||||
.idea
|
||||
cmake-build-debug*
|
||||
@@ -0,0 +1,48 @@
|
||||
[submodule "src/contrib/DLSS"]
|
||||
path = src/contrib/DLSS
|
||||
url = https://github.com/NVIDIA/DLSS
|
||||
[submodule "src/contrib/implot"]
|
||||
path = src/contrib/implot
|
||||
url = https://github.com/epezent/implot
|
||||
[submodule "src/contrib/hlslpp"]
|
||||
path = src/contrib/hlslpp
|
||||
url = https://github.com/redorav/hlslpp
|
||||
[submodule "src/contrib/xess"]
|
||||
path = src/contrib/xess
|
||||
url = https://github.com/intel/xess
|
||||
[submodule "src/contrib/mupen64plus-win32-deps"]
|
||||
path = src/contrib/mupen64plus-win32-deps
|
||||
url = https://github.com/mupen64plus/mupen64plus-win32-deps
|
||||
[submodule "src/contrib/mupen64plus-core"]
|
||||
path = src/contrib/mupen64plus-core
|
||||
url = https://github.com/mupen64plus/mupen64plus-core
|
||||
[submodule "src/contrib/xxHash"]
|
||||
path = src/contrib/xxHash
|
||||
url = https://github.com/Cyan4973/xxHash
|
||||
[submodule "src/contrib/volk"]
|
||||
path = src/contrib/volk
|
||||
url = https://github.com/zeux/volk
|
||||
[submodule "src/contrib/Vulkan-Headers"]
|
||||
path = src/contrib/Vulkan-Headers
|
||||
url = https://github.com/KhronosGroup/Vulkan-Headers
|
||||
[submodule "src/contrib/VulkanMemoryAllocator"]
|
||||
path = src/contrib/VulkanMemoryAllocator
|
||||
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
|
||||
[submodule "src/contrib/imgui"]
|
||||
path = src/contrib/imgui
|
||||
url = https://github.com/ocornut/imgui
|
||||
[submodule "src/contrib/im3d"]
|
||||
path = src/contrib/im3d
|
||||
url = https://github.com/john-chapman/im3d
|
||||
[submodule "src/contrib/D3D12MemoryAllocator"]
|
||||
path = src/contrib/D3D12MemoryAllocator
|
||||
url = https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator
|
||||
[submodule "src/contrib/dxc"]
|
||||
path = src/contrib/dxc
|
||||
url = https://github.com/rt64/dxc-bin
|
||||
[submodule "src/contrib/stb"]
|
||||
path = src/contrib/stb
|
||||
url = https://github.com/nothings/stb
|
||||
[submodule "src/contrib/nativefiledialog-extended"]
|
||||
path = src/contrib/nativefiledialog-extended
|
||||
url = https://github.com/btzy/nativefiledialog-extended
|
||||
@@ -0,0 +1,12 @@
|
||||
; DO NOT EDIT (unless you know what you are doing)
|
||||
;
|
||||
; This subdirectory is a git "subrepo", and this file is maintained by the
|
||||
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
|
||||
;
|
||||
[subrepo]
|
||||
remote = git@github.com:rt64/rt64.git
|
||||
branch = main
|
||||
commit = 1adcbea31a04f2403da729eb5dfed3950dd7ec52
|
||||
parent = e75381242a6e5020e6cf3f8c2ab0185e952b5a56
|
||||
method = merge
|
||||
cmdver = 0.4.6
|
||||
@@ -0,0 +1,450 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(rt64)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
option(RT64_BUILD_PLUGIN "Build plugin version of RT64" OFF)
|
||||
|
||||
option(RT64_BUILD_EXAMPLES "Build examples for RT64" OFF)
|
||||
if (${RT64_BUILD_EXAMPLES})
|
||||
set(RT64_STATIC ON)
|
||||
endif()
|
||||
|
||||
function(preprocess INFILE OUTFILE OPTIONS)
|
||||
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
add_custom_command(OUTPUT ${OUTFILE}
|
||||
COMMAND clang -x c -E -P ${INFILE} -o ${OUTFILE} ${OPTIONS}
|
||||
DEPENDS ${INFILE})
|
||||
else()
|
||||
add_custom_command(OUTPUT ${OUTFILE}
|
||||
COMMAND ${CMAKE_CXX_COMPILER} /Zs /EP ${INFILE} ${OPTIONS} > ${OUTFILE}
|
||||
DEPENDS ${INFILE})
|
||||
endif()
|
||||
else()
|
||||
add_custom_command(OUTPUT ${OUTFILE}
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -x c -E -P ${INFILE} -o ${OUTFILE} ${OPTIONS}
|
||||
DEPENDS ${INFILE})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if (WIN32)
|
||||
set (DXC "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/x64/dxc.exe")
|
||||
add_compile_definitions(NOMINMAX)
|
||||
|
||||
# Dependencies that must be next to the DLL.
|
||||
configure_file("${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/x64/dxcompiler.dll" "dxcompiler.dll" COPYONLY)
|
||||
configure_file("${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/x64/dxil.dll" "dxil.dll" COPYONLY)
|
||||
else()
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
if (APPLE)
|
||||
set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/x64/dxc")
|
||||
else()
|
||||
set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/x64/dxc")
|
||||
endif()
|
||||
else()
|
||||
if (APPLE)
|
||||
set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/arm64/dxc-macos")
|
||||
else()
|
||||
set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/arm64/dxc-linux")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "DXC: ${DXC}")
|
||||
endif()
|
||||
|
||||
# Build the file_to_c utility for converting binary files into a .c and .h file pair
|
||||
add_executable(file_to_c src/tools/file_to_c.cpp)
|
||||
|
||||
add_subdirectory(src/contrib/nativefiledialog-extended)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
add_compile_options(-Wno-nullability-completeness)
|
||||
endif()
|
||||
|
||||
set(ANDROID_PLATFORM android-24)
|
||||
set(ANDROID_ABI arm64-v8a)
|
||||
|
||||
# For DXC
|
||||
set (DXC_COMMON_OPTS "-I${PROJECT_SOURCE_DIR}/src")
|
||||
set (DXC_DXIL_OPTS "-Wno-ignored-attributes")
|
||||
set (DXC_SPV_OPTS "-spirv" "-fspv-target-env=vulkan1.0" "-fvk-use-dx-layout")
|
||||
set (DXC_PS_OPTS "${DXC_COMMON_OPTS}" "-E" "PSMain" "-T ps_6_0")
|
||||
set (DXC_VS_OPTS "${DXC_COMMON_OPTS}" "-E" "VSMain" "-T vs_6_0" "-fvk-invert-y")
|
||||
set (DXC_CS_OPTS "${DXC_COMMON_OPTS}" "-E" "CSMain" "-T cs_6_0")
|
||||
set (DXC_GS_OPTS "${DXC_COMMON_OPTS}" "-E" "GSMain" "-T gs_6_0")
|
||||
set (DXC_RT_OPTS "${DXC_COMMON_OPTS}" "-D" "RT_SHADER" "-T" "lib_6_3" "-fspv-target-env=vulkan1.1spirv1.4" "-fspv-extension=SPV_KHR_ray_tracing" "-fspv-extension=SPV_EXT_descriptor_indexing")
|
||||
|
||||
function(build_shader_spirv_impl TARGETOBJ FILENAME TARGET_NAME OUTNAME)
|
||||
add_custom_command(OUTPUT ${OUTNAME}.spv
|
||||
COMMAND ${DXC} ${DXC_SPV_OPTS} ${ARGN} ${FILENAME} /Fo ${OUTNAME}.spv
|
||||
DEPENDS ${FILENAME})
|
||||
add_custom_command(OUTPUT ${OUTNAME}.spirv.c
|
||||
COMMAND file_to_c ${OUTNAME}.spv ${TARGET_NAME}BlobSPIRV ${OUTNAME}.spirv.c ${OUTNAME}.spirv.h
|
||||
DEPENDS ${OUTNAME}.spv file_to_c
|
||||
BYPRODUCTS ${OUTNAME}.spirv.h)
|
||||
target_sources(${TARGETOBJ} PRIVATE ${OUTNAME}.spirv.c)
|
||||
endfunction()
|
||||
|
||||
function(build_shader_dxil_impl TARGETOBJ FILENAME TARGET_NAME OUTNAME)
|
||||
add_custom_command(OUTPUT ${OUTNAME}.dxil
|
||||
COMMAND ${DXC} ${DXC_DXIL_OPTS} ${ARGN} ${FILENAME} /Fo ${OUTNAME}.dxil
|
||||
DEPENDS ${FILENAME})
|
||||
add_custom_command(OUTPUT ${OUTNAME}.dxil.c
|
||||
COMMAND file_to_c ${OUTNAME}.dxil ${TARGET_NAME}BlobDXIL ${OUTNAME}.dxil.c ${OUTNAME}.dxil.h
|
||||
DEPENDS ${OUTNAME}.dxil file_to_c
|
||||
BYPRODUCTS ${OUTNAME}.dxil.h)
|
||||
target_sources(${TARGETOBJ} PRIVATE ${OUTNAME}.dxil.c)
|
||||
endfunction()
|
||||
|
||||
function(build_shader TARGETOBJ SHADERNAME OPTIONS)
|
||||
set(FILENAME "${PROJECT_SOURCE_DIR}/${SHADERNAME}")
|
||||
if (${ARGC} GREATER 3)
|
||||
set(OUTNAME "${CMAKE_BINARY_DIR}/${ARGV3}")
|
||||
else()
|
||||
set(OUTNAME "${CMAKE_BINARY_DIR}/${SHADERNAME}")
|
||||
endif()
|
||||
# Get any optional compiler args passed to this function
|
||||
if (${ARGC} GREATER 4)
|
||||
set(EXTRA_ARGS "${ARGN}")
|
||||
list(REMOVE_AT EXTRA_ARGS 0)
|
||||
endif()
|
||||
cmake_path(GET OUTNAME STEM TARGET_NAME)
|
||||
cmake_path(GET OUTNAME PARENT_PATH OUTPUT_DIR)
|
||||
file(MAKE_DIRECTORY ${OUTPUT_DIR})
|
||||
# Compile DXIL shader binaries if building on Windows
|
||||
if (WIN32)
|
||||
build_shader_dxil_impl(${TARGETOBJ} ${FILENAME} ${TARGET_NAME} ${OUTNAME} ${OPTIONS} ${EXTRA_ARGS})
|
||||
endif()
|
||||
build_shader_spirv_impl(${TARGETOBJ} ${FILENAME} ${TARGET_NAME} ${OUTNAME} ${OPTIONS} ${EXTRA_ARGS})
|
||||
endfunction()
|
||||
|
||||
function(build_shader_spirv TARGETOBJ SHADERNAME OPTIONS)
|
||||
set(FILENAME "${PROJECT_SOURCE_DIR}/${SHADERNAME}")
|
||||
if (${ARGC} GREATER 3)
|
||||
set(OUTNAME "${CMAKE_BINARY_DIR}/${ARGV3}")
|
||||
else()
|
||||
set(OUTNAME "${CMAKE_BINARY_DIR}/${SHADERNAME}")
|
||||
endif()
|
||||
# Get any optional compiler args passed to this function
|
||||
if (${ARGC} GREATER 4)
|
||||
set(EXTRA_ARGS "${ARGN}")
|
||||
list(REMOVE_AT EXTRA_ARGS 0)
|
||||
endif()
|
||||
cmake_path(GET OUTNAME STEM TARGET_NAME)
|
||||
cmake_path(GET OUTNAME PARENT_PATH OUTPUT_DIR)
|
||||
file(MAKE_DIRECTORY ${OUTPUT_DIR})
|
||||
build_shader_spirv_impl(${TARGETOBJ} ${FILENAME} ${TARGET_NAME} ${OUTNAME} ${OPTIONS} ${EXTRA_ARGS})
|
||||
endfunction()
|
||||
|
||||
function(preprocess_shader TARGETOBJ SHADERNAME)
|
||||
set(FILENAME "${PROJECT_SOURCE_DIR}/${SHADERNAME}")
|
||||
set(OUTNAME "${CMAKE_BINARY_DIR}/${SHADERNAME}")
|
||||
cmake_path(GET SHADERNAME STEM TARGET_NAME)
|
||||
cmake_path(GET OUTNAME PARENT_PATH OUTPUT_DIR)
|
||||
preprocess(${FILENAME} ${OUTNAME}.rw ${DXC_COMMON_OPTS})
|
||||
add_custom_command(OUTPUT ${OUTNAME}.rw.c
|
||||
COMMAND file_to_c ${OUTNAME}.rw ${TARGET_NAME}Text ${OUTNAME}.rw.c ${OUTNAME}.rw.h
|
||||
DEPENDS ${OUTNAME}.rw file_to_c
|
||||
BYPRODUCTS ${OUTNAME}.rw.h)
|
||||
file(MAKE_DIRECTORY ${OUTPUT_DIR})
|
||||
target_sources(${TARGETOBJ} PRIVATE ${OUTNAME}.rw.c)
|
||||
endfunction()
|
||||
|
||||
function(build_pixel_shader TARGETOBJ SHADERNAME)
|
||||
build_shader(${TARGETOBJ} ${SHADERNAME} "${DXC_PS_OPTS}" ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(build_vertex_shader TARGETOBJ SHADERNAME)
|
||||
build_shader(${TARGETOBJ} ${SHADERNAME} "${DXC_VS_OPTS}" ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(build_pixel_shader_spirv TARGETOBJ SHADERNAME)
|
||||
build_shader_spirv(${TARGETOBJ} ${SHADERNAME} "${DXC_PS_OPTS}" ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(build_vertex_shader_spirv TARGETOBJ SHADERNAME)
|
||||
build_shader_spirv(${TARGETOBJ} ${SHADERNAME} "${DXC_VS_OPTS}" ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(build_compute_shader TARGETOBJ SHADERNAME)
|
||||
build_shader(${TARGETOBJ} ${SHADERNAME} "${DXC_CS_OPTS}" ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(build_geo_shader TARGETOBJ SHADERNAME)
|
||||
build_shader(${TARGETOBJ} ${SHADERNAME} "${DXC_GS_OPTS}" ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(build_ray_shader TARGETOBJ SHADERNAME)
|
||||
build_shader(${TARGETOBJ} ${SHADERNAME} "${DXC_RT_OPTS}" ${ARGN})
|
||||
endfunction()
|
||||
|
||||
# Point cmake at src/contrib/mupen64plus-win32-deps/SDL2-2.26.3 for SDL2 on windows, look for an installed package on other systems
|
||||
if (WIN32)
|
||||
set(SDL2_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/contrib/mupen64plus-win32-deps/SDL2-2.26.3/include")
|
||||
set(SDL2_LIBRARIES "SDL2" "SDL2main")
|
||||
link_directories("${PROJECT_SOURCE_DIR}/src/contrib/mupen64plus-win32-deps/SDL2-2.26.3/lib/x64")
|
||||
else()
|
||||
find_package(SDL2 REQUIRED)
|
||||
endif()
|
||||
|
||||
message(STATUS "${SDL2_INCLUDE_DIRS} ${SDL2_LIBRARIES}")
|
||||
|
||||
add_compile_definitions(
|
||||
HLSL_CPU
|
||||
FFX_GCC
|
||||
IMGUI_IMPL_VULKAN_NO_PROTOTYPES
|
||||
)
|
||||
|
||||
set (SOURCES
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_common.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_dynamic_libraries.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_elapsed_timer.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_emulator_configuration.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_enhancement_configuration.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_math.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_profiling_timer.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_thread.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_timer.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_user_configuration.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_user_paths.cpp"
|
||||
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi_f3d.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi_f3dex.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi_f3dex2.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi_f3dgolden.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi_f3dpd.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi_f3dwave.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi_f3dzex2.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi_l3dex2.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi_rdp.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi_s2dex.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi_s2dex2.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gbi/rt64_gbi_extended.cpp"
|
||||
|
||||
"${PROJECT_SOURCE_DIR}/src/gui/rt64_camera_controller.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gui/rt64_debugger_inspector.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gui/rt64_file_dialog.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/gui/rt64_inspector.cpp"
|
||||
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_application.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_application_window.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_color_converter.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_command_warning.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_draw_call.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_framebuffer.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_framebuffer_changes.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_framebuffer_manager.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_framebuffer_pair.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_framebuffer_storage.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_game_frame.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_interpreter.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_light_manager.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_present_queue.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_projection.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_rdp.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_rdp_tmem.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_rigid_body.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_rsp.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_state.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_vi.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_workload.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/hle/rt64_workload_queue.cpp"
|
||||
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_buffer_uploader.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_framebuffer_renderer.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_geometry_mode.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_native_target.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_optimus.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_projection_processor.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_raster_shader.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_raster_shader_cache.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_render_target.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_render_target_manager.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_render_worker.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_rsp_processor.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_shader_common.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_shader_compiler.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_shader_library.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_texture_cache.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_tile_processor.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_transform_processor.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_upscaler.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_vertex_processor.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/render/rt64_vi_renderer.cpp"
|
||||
|
||||
"${PROJECT_SOURCE_DIR}/src/preset/rt64_preset.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/preset/rt64_preset_draw_call.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/preset/rt64_preset_light.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/preset/rt64_preset_material.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/preset/rt64_preset_scene.cpp"
|
||||
|
||||
"${PROJECT_SOURCE_DIR}/src/shared/rt64_hlsl_json.cpp"
|
||||
|
||||
"${PROJECT_SOURCE_DIR}/src/rhi/rt64_render_hooks.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/vulkan/rt64_vulkan.cpp"
|
||||
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/imgui/imgui.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/imgui/imgui_demo.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/imgui/imgui_draw.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/imgui/imgui_tables.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/imgui/imgui_widgets.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/imgui/backends/imgui_impl_vulkan.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/im3d/im3d.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/implot/implot.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/implot/implot_demo.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/implot/implot_items.cpp"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
"${SDL2_INCLUDE_DIRS}"
|
||||
"${PROJECT_SOURCE_DIR}/src"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/D3D12MemoryAllocator/include"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/D3D12MemoryAllocator/src"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/imgui"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/hlslpp/include"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/Vulkan-Headers/include"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/VulkanMemoryAllocator/include"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/mupen64plus-core/src/api"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/nativefiledialog-extended/src/include"
|
||||
)
|
||||
|
||||
if (NOT RT64_BUILD_PLUGIN AND WIN32)
|
||||
# DXC only needs to be included during runtime for Windows.
|
||||
include_directories("${PROJECT_SOURCE_DIR}/src/contrib/dxc/inc")
|
||||
endif()
|
||||
|
||||
option(RT64_STATIC "Build RT64 as a static library" OFF)
|
||||
if (${RT64_STATIC})
|
||||
add_library(rt64 STATIC ${SOURCES})
|
||||
else()
|
||||
add_library(rt64 SHARED ${SOURCES})
|
||||
endif()
|
||||
|
||||
set_target_properties(rt64 PROPERTIES OUTPUT_NAME "rt64")
|
||||
set_target_properties(rt64 PROPERTIES PREFIX "")
|
||||
|
||||
# Add common libraries.
|
||||
target_link_libraries(rt64 nfd)
|
||||
|
||||
# Add any Windows-specific source files and libraries
|
||||
if (NOT RT64_BUILD_PLUGIN AND WIN32)
|
||||
target_sources(rt64 PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/src/d3d12/rt64_d3d12.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/imgui/backends/imgui_impl_dx12.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/imgui/backends/imgui_impl_win32.cpp"
|
||||
)
|
||||
target_link_libraries(rt64
|
||||
delayimp.lib
|
||||
D3D12
|
||||
DXGI
|
||||
Shcore.lib
|
||||
${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/x64/dxcompiler.lib)
|
||||
endif()
|
||||
|
||||
if (RT64_BUILD_PLUGIN)
|
||||
target_compile_definitions(rt64 PRIVATE RT64_BUILD_PLUGIN)
|
||||
target_sources(rt64 PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/src/api/rt64_api_common.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/api/rt64_api_plugin.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/imgui/backends/imgui_impl_sdl2.cpp"
|
||||
)
|
||||
if (WIN32)
|
||||
target_sources(rt64 PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/src/contrib/imgui/backends/imgui_impl_win32.cpp"
|
||||
)
|
||||
target_link_libraries(rt64
|
||||
delayimp.lib
|
||||
Shcore.lib
|
||||
Dwmapi.lib
|
||||
)
|
||||
endif()
|
||||
endif(RT64_BUILD_PLUGIN)
|
||||
|
||||
target_link_directories(rt64 PRIVATE ${PROJECT_SOURCE_DIR}/src/contrib/dxc)
|
||||
|
||||
if (NOT ANDROID)
|
||||
target_link_libraries(rt64 ${SDL2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if (NOT RT64_BUILD_PLUGIN AND CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
find_package(X11 REQUIRED)
|
||||
target_include_directories(rt64 PUBLIC ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH})
|
||||
target_link_libraries(rt64 ${X11_LIBRARIES} ${X11_Xrandr_LIB})
|
||||
endif()
|
||||
|
||||
preprocess_shader(rt64 "src/shaders/RasterPS.hlsl")
|
||||
preprocess_shader(rt64 "src/shaders/RasterVS.hlsl")
|
||||
|
||||
build_pixel_shader( rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSDynamic.hlsl" "-D DYNAMIC_RENDER_PARAMS")
|
||||
build_pixel_shader( rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSDynamicMS.hlsl" "-D DYNAMIC_RENDER_PARAMS" "-D MULTISAMPLING")
|
||||
build_pixel_shader_spirv(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstant.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS")
|
||||
build_pixel_shader_spirv(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantFlat.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D VERTEX_FLAT_COLOR")
|
||||
build_pixel_shader_spirv(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantDepth.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D OUTPUT_DEPTH")
|
||||
build_pixel_shader_spirv(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantDepthMS.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D OUTPUT_DEPTH" "-D MULTISAMPLING")
|
||||
build_pixel_shader_spirv(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantFlatDepth.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D VERTEX_FLAT_COLOR" "-D OUTPUT_DEPTH")
|
||||
build_pixel_shader_spirv(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantFlatDepthMS.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D VERTEX_FLAT_COLOR" "-D OUTPUT_DEPTH" "-D MULTISAMPLING")
|
||||
build_vertex_shader( rt64 "src/shaders/RasterVS.hlsl" "src/shaders/RasterVSDynamic.hlsl" "-D DYNAMIC_RENDER_PARAMS")
|
||||
build_vertex_shader_spirv( rt64 "src/shaders/RasterVS.hlsl" "src/shaders/RasterVSSpecConstant.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS")
|
||||
build_vertex_shader_spirv( rt64 "src/shaders/RasterVS.hlsl" "src/shaders/RasterVSSpecConstantFlat.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D VERTEX_FLAT_COLOR")
|
||||
build_compute_shader(rt64 "src/shaders/FbChangesClearCS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/FbChangesDrawColorPS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/FbChangesDrawDepthPS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/FbReadAnyChangesCS.hlsl" "src/shaders/FbReadAnyChangesCS.hlsl" "-O0")
|
||||
build_compute_shader(rt64 "src/shaders/FbReinterpretCS.hlsl" "src/shaders/FbReinterpretCS.hlsl" "-O0")
|
||||
build_compute_shader(rt64 "src/shaders/FbReadAnyFullCS.hlsl" "src/shaders/FbReadAnyFullCS.hlsl" "-O0")
|
||||
build_compute_shader(rt64 "src/shaders/FbWriteColorCS.hlsl" "src/shaders/FbWriteColorCS.hlsl" "-O0")
|
||||
build_compute_shader(rt64 "src/shaders/FbWriteDepthCS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/FbWriteDepthCS.hlsl" "src/shaders/FbWriteDepthCSMS.hlsl" "-D MULTISAMPLING")
|
||||
build_compute_shader(rt64 "src/shaders/GaussianFilterRGB3x3CS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/BoxFilterCS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/BicubicScalingCS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/HistogramAverageCS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/HistogramClearCS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/HistogramSetCS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/IdleCS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/LuminanceHistogramCS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/PostBlendDitherNoisePS.hlsl" "src/shaders/PostBlendDitherNoiseAddPS.hlsl" "-D ADD_MODE")
|
||||
build_pixel_shader( rt64 "src/shaders/PostBlendDitherNoisePS.hlsl" "src/shaders/PostBlendDitherNoiseSubPS.hlsl" "-D SUB_MODE")
|
||||
build_compute_shader(rt64 "src/shaders/RSPModifyCS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/RSPProcessCS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/RSPWorldCS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/RSPSmoothNormalCS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/RSPVertexTestZCS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/RSPVertexTestZCS.hlsl" "src/shaders/RSPVertexTestZCSMS.hlsl" "-D MULTISAMPLING")
|
||||
build_pixel_shader( rt64 "src/shaders/RtCopyColorToDepthPS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/RtCopyColorToDepthPS.hlsl" "src/shaders/RtCopyColorToDepthPSMS.hlsl" "-D MULTISAMPLING")
|
||||
build_pixel_shader( rt64 "src/shaders/RtCopyDepthToColorPS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/RtCopyDepthToColorPS.hlsl" "src/shaders/RtCopyDepthToColorPSMS.hlsl" "-D MULTISAMPLING")
|
||||
build_pixel_shader( rt64 "src/shaders/TextureCopyPS.hlsl")
|
||||
build_compute_shader(rt64 "src/shaders/TextureDecodeCS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/VideoInterfacePS.hlsl" "src/shaders/VideoInterfacePSRegular.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/VideoInterfacePS.hlsl" "src/shaders/VideoInterfacePSPixel.hlsl" "-D PIXEL_ANTIALIASING")
|
||||
build_vertex_shader( rt64 "src/shaders/FullScreenVS.hlsl")
|
||||
build_vertex_shader( rt64 "src/shaders/Im3DVS.hlsl")
|
||||
build_geo_shader( rt64 "src/shaders/Im3DGSPoints.hlsl")
|
||||
build_geo_shader( rt64 "src/shaders/Im3DGSLines.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/ComposePS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/DebugPS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/Im3DPS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/PostProcessPS.hlsl")
|
||||
|
||||
target_include_directories(rt64 PRIVATE ${CMAKE_BINARY_DIR}/src)
|
||||
|
||||
if (RT64_BUILD_EXAMPLES)
|
||||
add_executable(rhi_test "examples/rt64_render_interface.cpp" "examples/rhi_test.cpp")
|
||||
target_link_libraries(rhi_test rt64)
|
||||
|
||||
build_pixel_shader( rhi_test "examples/shaders/RenderInterfaceTestPS.hlsl")
|
||||
build_vertex_shader( rhi_test "examples/shaders/RenderInterfaceTestVS.hlsl")
|
||||
build_compute_shader(rhi_test "examples/shaders/RenderInterfaceTestCS.hlsl")
|
||||
build_ray_shader( rhi_test "examples/shaders/RenderInterfaceTestRT.hlsl")
|
||||
build_pixel_shader( rhi_test "examples/shaders/RenderInterfaceTestPostPS.hlsl")
|
||||
build_vertex_shader( rhi_test "examples/shaders/RenderInterfaceTestPostVS.hlsl")
|
||||
|
||||
target_include_directories(rhi_test PRIVATE ${CMAKE_BINARY_DIR}/examples)
|
||||
endif()
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": ""
|
||||
},
|
||||
{
|
||||
"name": "Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 RT64 Contributors
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,103 @@
|
||||
# RT64
|
||||
RT64 is an N64 graphics renderer for playing games with enhancements in emulators and native ports.
|
||||
|
||||
# Work in Progress
|
||||
|
||||
### **Emulator Support (Plugin) and Ray Tracing (RT) are not available in this repository yet.**
|
||||
|
||||
This repository has been made public to provide a working implementation to native ports that wish to use RT64 as their renderer.
|
||||
|
||||
**Development of these features is still ongoing and will be added to this repository when they're ready.** Thank you for your patience!
|
||||
|
||||
# Features available
|
||||
* Modern N64 renderer built on the latest APIs (D3D12 and Vulkan).
|
||||
* Uses ubershaders to guarantee no stutters due to pipeline compilation.
|
||||
* Brand new architecture designed around offering novel enhancements.
|
||||
* High level of accuracy and no tolerance for game-specific workarounds to achieve correct rendering.
|
||||
* Input latency reduction options to either skip the game's native buffering or draw as early as possible.
|
||||
* Render with a higher resolution and downsample to a resolution closer to the original game.
|
||||
* Support for Widescreen with arbitrary aspect ratios, including Ultrawide support (limited game support).
|
||||
* Interpolate the game's visuals to 60 FPS or above (HFR) by generating new frames and modifying them in 3D space (limited game support).
|
||||
* Extended command set for better integration of widescreen, interpolation and path tracing features (for use with rom patches, rom hacks, and ports).
|
||||
* Supports Windows 10, Windows 11 and Linux.
|
||||
|
||||
# Features in development (in priority order)
|
||||
* HD texture packs.
|
||||
* Compatibility with texture packs that use the Rice texture format.
|
||||
* Brand new texture pack configuration format for higher levels of control.
|
||||
* Supports both DDS (with mipmaps) and PNG.
|
||||
* Asynchronous streaming.
|
||||
* Game script interpreter.
|
||||
* Support a runtime language for configuring the path traced renderer based on the contents of the game's memory.
|
||||
* Support patching the game's memory to provide various enhancements automatically integrated with the game script.
|
||||
* Fully path traced renderer (RT).
|
||||
* Calculate all lighting in real time and replace the contents of the drawn scene entirely with a path traced version.
|
||||
* Provide support for extra modifications for altering the material properties of the surfaces in the game.
|
||||
* Game support will be limited to a very small selection of games initially.
|
||||
* Emulator integration.
|
||||
* Game compatibility database and feature whitelist.
|
||||
* Configuration screen.
|
||||
* List of supported emulators to be determined.
|
||||
* Model replacements.
|
||||
* Details to be determined.
|
||||
|
||||
|
||||
# Building
|
||||
|
||||
* CMake 3.20 or above.
|
||||
* C++17 compiler.
|
||||
* Known to work with Microsoft Visual C++, Clang or GCC.
|
||||
* Windows 10 or 11 SDK (Windows only).
|
||||
* Make sure to clone submodules correctly when checking out the repository.
|
||||
* Use `git submodule update --init --recursive` if you cloned without using `--recursive`.
|
||||
|
||||
# Architecture
|
||||
|
||||
## Deferred frames
|
||||
Draw calls are never sent right away to the GPU but instead stored on an auxiliary structure that logs the history of an entire frame. A frame's contents can be examined in great detail with the in-game debugger included with RT64. The renderer requires this to be able to optimize the rendering process, perform enhancements, replace assets and even generate new frames entirely.
|
||||
|
||||
## Deferred RDP
|
||||
Any operation related to reading memory and using it as texture information during rendering is completely deferred until the game requires a full synchronization of the RDP. All requests are stored in a list of operations and flushed before it is time to render. This allows RT64 to perform extra optimizations and detect when it is necessary to synchronize the output of the RDP back to memory. It also opens up the ability to detect when direct copies can be made on GPU memory and even detect patterns that can be replaced with equivalent but faster operations.
|
||||
|
||||
## Deferred RSP (Compute)
|
||||
All vertex transformations by the RSP (e.g. position, lighting, texturing, etc.) are performed by a highly parallel compute shader in the GPU. This saves a lot of CPU processing time and allows for much higher vertex and polygon counts. Since all transformations are deferred to this step, it's very easy for RT64 to patch transformations of the objects in the scene and the camera and produce a new frame very quickly. This effectively removes CPU bottlenecks that are critical for reaching very high target framerates.
|
||||
|
||||
## Texture Decoder (Compute)
|
||||
RT64 does not decode textures on the CPU and instead opts for uploading TMEM (4 KB) directly to the GPU. If possible, a RGBA32 version of the texture will be decoded and cached using a compute shader. If the sampling parameters prove to be too troublesome for that (e.g. giant texture masks with no clamp due to bad configuration), then RT64 can sample TMEM directly just like the console with a small performance sacrifice.
|
||||
|
||||
RT64 features one of the most accurate TMEM loaders to date so far which has been directly reverse engineered by observing console behavior with the aid of homebrew test ROMs developed by [Wiseguy](https://github.com/Mr-Wiseguy). All the color conversion formulas for decoding have also been sourced from [Tharo](https://github.com/Thar0)'s excellent RDP research.
|
||||
|
||||
## Dual renderers
|
||||
RT64 takes advantage of the multi-threaded capabilities of modern APIs to run two renderers at the same time with highly different goals. One renderer draws at native resolution (e.g. 240p) and synchronizes back immediately with the game running at its original rate. The other renderer replays all the draw calls detected by the main renderer at higher resolution and even at a different rate when using interpolation. This design guarantees that the game will see the correct data in RAM, which is very important for games that read from these memory regions for gameplay reasons. If it's not required by the game, this native resolution renderer can be turned off completely to save performance.
|
||||
|
||||
## Framebuffer detection
|
||||
RT64 will keep track of any memory addresses used as framebuffers, their dimensions and their matching contents that live in GPU memory. If other operations in the frame load and sample a part of memory owned by a framebuffer, then a direct copy of one of its regions is performed and stored in memory.
|
||||
|
||||
The framebuffer copy mechanic is only used when the load and sample parameters line up correctly and the final result would look no different than if it was sampled from RAM (except for preserving the high precision of the image). As framebuffer detection works at the RDP level, that means all related performance and visual enhancements can apply even in LLE mode.
|
||||
|
||||
## Framebuffer upscaling
|
||||
When framebuffer operations are detected, the renderer is able to upscale these effects by increasing the resolution of all framebuffers and any associated region copies by a scaling factor. The resolution increase is only performed in the high resolution renderer. All texture coordinates are adjusted automatically to account for this change.
|
||||
|
||||
## Framebuffer reinterpretation
|
||||
Games will sometimes draw to a framebuffer using one format and then read it as another format to perform post-processing on the screen. RT64 supports this operation natively at high resolution using per-pixel reinterpretation inside a dedicated compute shader. While this requires adding specific paths encountered on a case-by-case basis (to preserve high precision), the framework can be easily extended to support as many cases as possible. This feature is essential for emulating some of the more infamous effects in higher resolutions such as greyscale filters.
|
||||
|
||||
## Draw call matching
|
||||
Once all information for a particular game frame has been recorded, RT64 will attempt to perform automatic matching of draw calls between frames based on their rendering parameters, the textures in use, their position, orientation, their tracked velocities and much more. Matching is essential to generating interpolated frames and providing motion vector information to the path traced renderer. Draw call matching is still a highly experimental area that is prone to errors and requires a lot of processing to get right. The algorithms behind this feature will be likely to change as more research is done to accommodate as many games as possible.
|
||||
|
||||
## Frame interpolation
|
||||
New frames are generated using the information from the previous draw call matching step. For any calls that match, new 3D transformations will be created via interpolation and uploaded to the GPU for the deferred RSP to do its work again. When possible, transformations are decomposed into their constituent components. Those components are interpolated separately and recomposed into the resultant transform to prevent interpolation artifacts caused by naive transformation interpolation. This interpolation can also be applied to texture scrolling coordinates and even per vertex if vertex velocities are computed. More parameters are planned to be supported in the future as long as they're part of the recorded frame data.
|
||||
|
||||
## Extended command set
|
||||
RT64 offers an extended command set that can be used by native ports, ROM patches, and ROM hacks to provide extra information that the renderer can use to enhance the final result. Using this feature is vital to providing accurate frame interpolation and widescreen enhancements for 2D elements. If you're interested in using this feature, check out the [included header in the repository](https://github.com/rt64/rt64/blob/main/include/rt64_extended_gbi.h). The main activation method is encoded into a NOOP command so it should be safe to run it in real hardware. RT64 will recognize this command and enable the extended command set feature, allowing for an extended repertoire of functions aimed at fixing some common grievances that show up at high framerates or wide aspect ratios.
|
||||
|
||||
For example, objects that rely on pixel depth checks to draw can instead use the `gEXVertexZTest()` command to specify any triangles drawn after the command should only be drawn if the vertex is not covered by something else. This means that effects such as light halos can be replaced with this command and it'll automatically work on widescreen ratios and no longer be delayed by one frame. Instead, RT64 will just flush the depth buffer at the correct step and run a small compute shader that will invalidate the draw call's triangles if the depth test doesn't pass. Though the original effect already works as-is thanks to the native renderer, the extended GBI method can be leveraged to make the experience feel even better.
|
||||
|
||||
## Future texture and asset replacement
|
||||
Texture replacements are easily performed at runtime by using two capabilities that RT64 already supports: bindless textures and texture coordinate scaling. The entire renderer uses only one contiguous array of texture resources and replacing one of these by an HD texture replacement is straightforward. By detecting the difference in sizes between the original texture and the replacement, the texture coordinates can be scaled easily with the same logic that is used for framebuffer tiles.
|
||||
|
||||
Asset replacement, while not currently implemented and more of a long term feature, will leverage the fact that only one contiguous vertex and index array is used by RT64. This allows for highly efficient rendering as it minimizes the amount of times vertex and index buffers must be bound, but it also means the RSP can process the vertices placed in this buffer during rendering time as if they came from the game itself. Therefore, the entire process of model replacement will just consist of allocating chunks of the buffer directly for replacements in a native format, assigning it the correct transforms used by the draw call and letting the RSP compute shader do its job. This will allow the renderer to draw models that have orders of magnitude higher triangle counts with very little additional cost to the CPU.
|
||||
|
||||
## Future path tracing
|
||||
RT64 will attempt to perform scene detection by merging as many draw calls as it can as long as they're inside of the same compatible perspective view point. Since all data remains untransformed, bottom-level acceleration structures (BLAS) can be built by using a compute shader to transform vertices to world space instead of screen space. Once these BLAS are built, a top-level acceleration structure (TLAS) is constructed with all the BLAS that were detected.
|
||||
|
||||
These structures are used directly for path tracing the scene and generating all lighting in real time. Lighting information is derived from various sources (the game itself, scripts, integrated light editor) and will be detailed more in the future as this feature is closer to a final state.
|
||||
@@ -0,0 +1,25 @@
|
||||
buildType:
|
||||
default: debug
|
||||
choices:
|
||||
debug:
|
||||
short: Debug
|
||||
long: Emit debug information
|
||||
buildType: Debug
|
||||
release:
|
||||
short: Release
|
||||
long: Optimize generated code
|
||||
buildType: Release
|
||||
platform:
|
||||
default: native
|
||||
choices:
|
||||
native:
|
||||
short: Native
|
||||
long: Build for the native platform
|
||||
android:
|
||||
short: Android
|
||||
long: Build for Android using the NDK
|
||||
env:
|
||||
CMAKE_TOOLCHAIN_FILE: /opt/android-sdk/ndk/26.0.10792818/build/cmake/android.toolchain.cmake
|
||||
settings:
|
||||
ANDROID_ABI: arm64-v8a
|
||||
ANDROID_PLATFORM: android-24
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "rhi/rt64_render_interface.h"
|
||||
|
||||
namespace RT64 {
|
||||
extern std::unique_ptr<RenderInterface> CreateD3D12Interface();
|
||||
extern std::unique_ptr<RenderInterface> CreateVulkanInterface();
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
std::unique_ptr<RT64::RenderInterface> renderInterface = RT64::CreateVulkanInterface();
|
||||
|
||||
#if defined(_WIN32)
|
||||
// Windows only: Can also use D3D12.
|
||||
const bool useVulkan = true;
|
||||
if (!useVulkan) {
|
||||
renderInterface = RT64::CreateD3D12Interface();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Execute a blocking test that creates a window and draws some geometry to test the render interface.
|
||||
RT64::RenderInterfaceTest(renderInterface.get());
|
||||
}
|
||||
@@ -0,0 +1,796 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rhi/rt64_render_interface.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#ifdef _WIN64
|
||||
#include "shaders/RenderInterfaceTestPS.hlsl.dxil.h"
|
||||
#include "shaders/RenderInterfaceTestRT.hlsl.dxil.h"
|
||||
#include "shaders/RenderInterfaceTestVS.hlsl.dxil.h"
|
||||
#include "shaders/RenderInterfaceTestCS.hlsl.dxil.h"
|
||||
#include "shaders/RenderInterfaceTestPostPS.hlsl.dxil.h"
|
||||
#include "shaders/RenderInterfaceTestPostVS.hlsl.dxil.h"
|
||||
#endif
|
||||
#include "shaders/RenderInterfaceTestPS.hlsl.spirv.h"
|
||||
#include "shaders/RenderInterfaceTestRT.hlsl.spirv.h"
|
||||
#include "shaders/RenderInterfaceTestVS.hlsl.spirv.h"
|
||||
#include "shaders/RenderInterfaceTestCS.hlsl.spirv.h"
|
||||
#include "shaders/RenderInterfaceTestPostPS.hlsl.spirv.h"
|
||||
#include "shaders/RenderInterfaceTestPostVS.hlsl.spirv.h"
|
||||
|
||||
#define ENABLE_SWAP_CHAIN 1
|
||||
#define ENABLE_CLEAR 1
|
||||
#define ENABLE_RASTER 1
|
||||
#define ENABLE_TEXTURE 0
|
||||
#define ENABLE_COMPUTE 0
|
||||
#define ENABLE_RT 0
|
||||
|
||||
namespace RT64 {
|
||||
struct RasterDescriptorSet : RenderDescriptorSetBase {
|
||||
uint32_t gSampler;
|
||||
uint32_t gTextures;
|
||||
|
||||
std::unique_ptr<RenderSampler> linearSampler;
|
||||
|
||||
RasterDescriptorSet(RenderDevice *device, uint32_t textureArraySize) {
|
||||
linearSampler = device->createSampler(RenderSamplerDesc());
|
||||
|
||||
const uint32_t TextureArrayUpperRange = 512;
|
||||
builder.begin();
|
||||
gSampler = builder.addImmutableSampler(1, linearSampler.get());
|
||||
gTextures = builder.addTexture(2, TextureArrayUpperRange);
|
||||
builder.end(true, textureArraySize);
|
||||
|
||||
create(device);
|
||||
}
|
||||
};
|
||||
|
||||
struct ComputeDescriptorFirstSet : RenderDescriptorSetBase {
|
||||
uint32_t gBlueNoiseTexture;
|
||||
uint32_t gSampler;
|
||||
uint32_t gTarget;
|
||||
|
||||
std::unique_ptr<RenderSampler> linearSampler;
|
||||
|
||||
ComputeDescriptorFirstSet(RenderDevice *device) {
|
||||
linearSampler = device->createSampler(RenderSamplerDesc());
|
||||
|
||||
builder.begin();
|
||||
gBlueNoiseTexture = builder.addTexture(1);
|
||||
gSampler = builder.addImmutableSampler(2, linearSampler.get());
|
||||
builder.end();
|
||||
|
||||
create(device);
|
||||
}
|
||||
};
|
||||
|
||||
struct ComputeDescriptorSecondSet : RenderDescriptorSetBase {
|
||||
uint32_t gTarget;
|
||||
|
||||
ComputeDescriptorSecondSet(RenderDevice *device) {
|
||||
builder.begin();
|
||||
gTarget = builder.addReadWriteTexture(16);
|
||||
builder.end();
|
||||
|
||||
create(device);
|
||||
}
|
||||
};
|
||||
|
||||
struct RaytracingDescriptorSet : RenderDescriptorSetBase {
|
||||
uint32_t gBVH;
|
||||
uint32_t gOutput;
|
||||
uint32_t gBufferParams;
|
||||
|
||||
RaytracingDescriptorSet(RenderDevice *device) {
|
||||
builder.begin();
|
||||
gBVH = builder.addAccelerationStructure(0);
|
||||
gOutput = builder.addReadWriteTexture(1);
|
||||
gBufferParams = builder.addStructuredBuffer(2);
|
||||
builder.end();
|
||||
|
||||
create(device);
|
||||
}
|
||||
};
|
||||
|
||||
struct TestMembers {
|
||||
static const uint32_t BufferCount = 2;
|
||||
static const uint32_t MSAACount = 4;
|
||||
static const RenderFormat ColorFormat = RenderFormat::R8G8B8A8_UNORM;
|
||||
static const RenderFormat DepthFormat = RenderFormat::D32_FLOAT;
|
||||
#ifdef __ANDROID__
|
||||
static const RenderFormat SwapchainFormat = RenderFormat::R8G8B8A8_UNORM;
|
||||
#else
|
||||
static const RenderFormat SwapchainFormat = RenderFormat::B8G8R8A8_UNORM;
|
||||
#endif
|
||||
const RenderInterface *renderInterface = nullptr;
|
||||
std::unique_ptr<RenderDevice> device;
|
||||
std::unique_ptr<RenderCommandQueue> commandQueue;
|
||||
std::unique_ptr<RenderCommandList> commandList;
|
||||
std::unique_ptr<RenderCommandFence> commandFence;
|
||||
std::unique_ptr<RenderSwapChain> swapChain;
|
||||
std::unique_ptr<RenderFramebuffer> framebuffer;
|
||||
std::vector<std::unique_ptr<RenderFramebuffer>> swapFramebuffers;
|
||||
std::unique_ptr<RenderSampler> linearSampler;
|
||||
std::unique_ptr<RenderSampler> postSampler;
|
||||
std::unique_ptr<RasterDescriptorSet> rasterSet;
|
||||
std::unique_ptr<ComputeDescriptorFirstSet> computeFirstSet;
|
||||
std::unique_ptr<ComputeDescriptorSecondSet> computeSecondSet;
|
||||
std::unique_ptr<RaytracingDescriptorSet> rtSet;
|
||||
std::unique_ptr<RenderDescriptorSet> postSet;
|
||||
std::unique_ptr<RenderPipelineLayout> rasterPipelineLayout;
|
||||
std::unique_ptr<RenderPipelineLayout> computePipelineLayout;
|
||||
std::unique_ptr<RenderPipelineLayout> rtPipelineLayout;
|
||||
std::unique_ptr<RenderPipelineLayout> postPipelineLayout;
|
||||
std::unique_ptr<RenderPipeline> rasterPipeline;
|
||||
std::unique_ptr<RenderPipeline> computePipeline;
|
||||
std::unique_ptr<RenderPipeline> rtPipeline;
|
||||
std::unique_ptr<RenderPipeline> postPipeline;
|
||||
std::unique_ptr<RenderTexture> colorTargetMS;
|
||||
std::unique_ptr<RenderTexture> colorTargetResolved;
|
||||
std::unique_ptr<RenderTexture> depthTarget;
|
||||
std::unique_ptr<RenderBuffer> uploadBuffer;
|
||||
std::unique_ptr<RenderTexture> blueNoiseTexture;
|
||||
std::unique_ptr<RenderBuffer> vertexBuffer;
|
||||
std::unique_ptr<RenderBuffer> indexBuffer;
|
||||
std::unique_ptr<RenderBuffer> rtParamsBuffer;
|
||||
std::unique_ptr<RenderBuffer> rtVertexBuffer;
|
||||
std::unique_ptr<RenderBuffer> rtScratchBuffer;
|
||||
std::unique_ptr<RenderBuffer> rtInstancesBuffer;
|
||||
std::unique_ptr<RenderBuffer> rtBottomLevelASBuffer;
|
||||
std::unique_ptr<RenderAccelerationStructure> rtBottomLevelAS;
|
||||
std::unique_ptr<RenderBuffer> rtTopLevelASBuffer;
|
||||
std::unique_ptr<RenderAccelerationStructure> rtTopLevelAS;
|
||||
std::unique_ptr<RenderBuffer> rtShaderBindingTableBuffer;
|
||||
RenderShaderBindingTableInfo rtShaderBindingTableInfo;
|
||||
RenderVertexBufferView vertexBufferView;
|
||||
RenderIndexBufferView indexBufferView;
|
||||
RenderInputSlot inputSlot;
|
||||
} Test;
|
||||
|
||||
struct RasterPushConstant {
|
||||
float colorAdd[4] = {};
|
||||
uint32_t textureIndex = 0;
|
||||
};
|
||||
|
||||
struct ComputePushConstant {
|
||||
float Multiply[4] = {};
|
||||
uint32_t Resolution[2] = {};
|
||||
};
|
||||
|
||||
void TestInitialize(RenderInterface *renderInterface, RenderWindow window) {
|
||||
Test.renderInterface = renderInterface;
|
||||
Test.device = renderInterface->createDevice();
|
||||
Test.commandQueue = Test.device->createCommandQueue(RenderCommandListType::DIRECT);
|
||||
Test.commandList = Test.device->createCommandList(RenderCommandListType::DIRECT);
|
||||
Test.commandFence = Test.device->createCommandFence();
|
||||
|
||||
# if ENABLE_SWAP_CHAIN
|
||||
Test.swapChain = Test.commandQueue->createSwapChain(window, Test.BufferCount, Test.SwapchainFormat);
|
||||
# endif
|
||||
|
||||
# if ENABLE_RASTER
|
||||
const uint32_t textureArraySize = 3;
|
||||
Test.rasterSet = std::make_unique<RasterDescriptorSet>(Test.device.get(), 3);
|
||||
|
||||
RenderPipelineLayoutBuilder layoutBuilder;
|
||||
layoutBuilder.begin(false, true);
|
||||
layoutBuilder.addPushConstant(0, 0, sizeof(RasterPushConstant), RenderShaderStageFlag::PIXEL);
|
||||
layoutBuilder.addDescriptorSet(Test.rasterSet->builder);
|
||||
layoutBuilder.end();
|
||||
|
||||
Test.rasterPipelineLayout = layoutBuilder.create(Test.device.get());
|
||||
|
||||
// Pick shader format depending on the render interface's requirements.
|
||||
const RenderInterfaceCapabilities &interfaceCapabilities = Test.renderInterface->getCapabilities();
|
||||
const RenderShaderFormat shaderFormat = interfaceCapabilities.shaderFormat;
|
||||
const void *PSBlob = nullptr;
|
||||
const void *VSBlob = nullptr;
|
||||
const void *CSBlob = nullptr;
|
||||
const void *RTBlob = nullptr;
|
||||
const void *PostPSBlob = nullptr;
|
||||
const void *PostVSBlob = nullptr;
|
||||
uint64_t PSBlobSize = 0;
|
||||
uint64_t VSBlobSize = 0;
|
||||
uint64_t CSBlobSize = 0;
|
||||
uint64_t RTBlobSize = 0;
|
||||
uint64_t PostPSBlobSize = 0;
|
||||
uint64_t PostVSBlobSize = 0;
|
||||
switch (shaderFormat) {
|
||||
#ifdef _WIN64
|
||||
case RenderShaderFormat::DXIL:
|
||||
PSBlob = RenderInterfaceTestPSBlobDXIL;
|
||||
PSBlobSize = sizeof(RenderInterfaceTestPSBlobDXIL);
|
||||
VSBlob = RenderInterfaceTestVSBlobDXIL;
|
||||
VSBlobSize = sizeof(RenderInterfaceTestVSBlobDXIL);
|
||||
CSBlob = RenderInterfaceTestCSBlobDXIL;
|
||||
CSBlobSize = sizeof(RenderInterfaceTestCSBlobDXIL);
|
||||
RTBlob = RenderInterfaceTestRTBlobDXIL;
|
||||
RTBlobSize = sizeof(RenderInterfaceTestRTBlobDXIL);
|
||||
PostPSBlob = RenderInterfaceTestPostPSBlobDXIL;
|
||||
PostPSBlobSize = sizeof(RenderInterfaceTestPostPSBlobDXIL);
|
||||
PostVSBlob = RenderInterfaceTestPostVSBlobDXIL;
|
||||
PostVSBlobSize = sizeof(RenderInterfaceTestPostVSBlobDXIL);
|
||||
break;
|
||||
#endif
|
||||
case RenderShaderFormat::SPIRV:
|
||||
PSBlob = RenderInterfaceTestPSBlobSPIRV;
|
||||
PSBlobSize = sizeof(RenderInterfaceTestPSBlobSPIRV);
|
||||
VSBlob = RenderInterfaceTestVSBlobSPIRV;
|
||||
VSBlobSize = sizeof(RenderInterfaceTestVSBlobSPIRV);
|
||||
CSBlob = RenderInterfaceTestCSBlobSPIRV;
|
||||
CSBlobSize = sizeof(RenderInterfaceTestCSBlobSPIRV);
|
||||
RTBlob = RenderInterfaceTestRTBlobSPIRV;
|
||||
RTBlobSize = sizeof(RenderInterfaceTestRTBlobSPIRV);
|
||||
PostPSBlob = RenderInterfaceTestPostPSBlobSPIRV;
|
||||
PostPSBlobSize = sizeof(RenderInterfaceTestPostPSBlobSPIRV);
|
||||
PostVSBlob = RenderInterfaceTestPostVSBlobSPIRV;
|
||||
PostVSBlobSize = sizeof(RenderInterfaceTestPostVSBlobSPIRV);
|
||||
break;
|
||||
default:
|
||||
assert(false && "Unknown shader format.");
|
||||
break;
|
||||
}
|
||||
|
||||
const uint32_t VertexCount = 3;
|
||||
const uint32_t FloatsPerVertex = 4;
|
||||
const float Vertices[VertexCount * FloatsPerVertex] = {
|
||||
-0.5f, -0.25f, 0.0f, 0.0f,
|
||||
0.5f, -0.25f, 1.0f, 0.0f,
|
||||
0.25f, 0.25f, 0.0f, 1.0f
|
||||
};
|
||||
|
||||
const uint32_t Indices[3] = {
|
||||
0, 1, 2
|
||||
};
|
||||
|
||||
Test.inputSlot = RenderInputSlot(0, sizeof(float) * FloatsPerVertex);
|
||||
|
||||
std::vector<RenderInputElement> inputElements;
|
||||
inputElements.emplace_back(RenderInputElement("POSITION", 0, 0, RenderFormat::R32G32_FLOAT, 0, 0));
|
||||
inputElements.emplace_back(RenderInputElement("TEXCOORD", 0, 1, RenderFormat::R32G32_FLOAT, 0, sizeof(float) * 2));
|
||||
|
||||
std::unique_ptr<RenderShader> pixelShader = Test.device->createShader(PSBlob, PSBlobSize, "PSMain", shaderFormat);
|
||||
std::unique_ptr<RenderShader> vertexShader = Test.device->createShader(VSBlob, VSBlobSize, "VSMain", shaderFormat);
|
||||
|
||||
RenderGraphicsPipelineDesc graphicsDesc;
|
||||
graphicsDesc.inputSlots = &Test.inputSlot;
|
||||
graphicsDesc.inputSlotsCount = 1;
|
||||
graphicsDesc.inputElements = inputElements.data();
|
||||
graphicsDesc.inputElementsCount = uint32_t(inputElements.size());
|
||||
graphicsDesc.pipelineLayout = Test.rasterPipelineLayout.get();
|
||||
graphicsDesc.pixelShader = pixelShader.get();
|
||||
graphicsDesc.vertexShader = vertexShader.get();
|
||||
graphicsDesc.renderTargetFormat[0] = Test.ColorFormat;
|
||||
graphicsDesc.renderTargetBlend[0] = RenderBlendDesc::Copy();
|
||||
graphicsDesc.depthTargetFormat = Test.DepthFormat;
|
||||
graphicsDesc.renderTargetCount = 1;
|
||||
graphicsDesc.multisampling.sampleCount = Test.MSAACount;
|
||||
Test.rasterPipeline = Test.device->createGraphicsPipeline(graphicsDesc);
|
||||
|
||||
Test.postSampler = Test.device->createSampler(RenderSamplerDesc());
|
||||
const RenderSampler *postSamplerPtr = Test.postSampler.get();
|
||||
|
||||
// Create the post processing pipeline
|
||||
std::vector<RenderDescriptorRange> postDescriptorRanges = {
|
||||
RenderDescriptorRange(RenderDescriptorRangeType::TEXTURE, 1, 1),
|
||||
RenderDescriptorRange(RenderDescriptorRangeType::SAMPLER, 2, 1, &postSamplerPtr)
|
||||
};
|
||||
|
||||
RenderDescriptorSetDesc postDescriptorSetDesc(postDescriptorRanges.data(), uint32_t(postDescriptorRanges.size()));
|
||||
Test.postSet = Test.device->createDescriptorSet(postDescriptorSetDesc);
|
||||
Test.postPipelineLayout = Test.device->createPipelineLayout(RenderPipelineLayoutDesc(nullptr, 0, &postDescriptorSetDesc, 1, false, true));
|
||||
|
||||
inputElements.clear();
|
||||
inputElements.emplace_back(RenderInputElement("POSITION", 0, 0, RenderFormat::R32G32_FLOAT, 0, 0));
|
||||
|
||||
std::unique_ptr<RenderShader> postPixelShader = Test.device->createShader(PostPSBlob, PostPSBlobSize, "PSMain", shaderFormat);
|
||||
std::unique_ptr<RenderShader> postVertexShader = Test.device->createShader(PostVSBlob, PostVSBlobSize, "VSMain", shaderFormat);
|
||||
|
||||
RenderGraphicsPipelineDesc postDesc;
|
||||
postDesc.inputSlots = nullptr;
|
||||
postDesc.inputSlotsCount = 0;
|
||||
postDesc.inputElements = nullptr;
|
||||
postDesc.inputElementsCount = 0;
|
||||
postDesc.pipelineLayout = Test.postPipelineLayout.get();
|
||||
postDesc.pixelShader = postPixelShader.get();
|
||||
postDesc.vertexShader = postVertexShader.get();
|
||||
postDesc.renderTargetFormat[0] = Test.SwapchainFormat;
|
||||
postDesc.renderTargetBlend[0] = RenderBlendDesc::Copy();
|
||||
postDesc.renderTargetCount = 1;
|
||||
Test.postPipeline = Test.device->createGraphicsPipeline(postDesc);
|
||||
|
||||
# if ENABLE_TEXTURE
|
||||
// Upload a texture.
|
||||
const uint32_t Width = 512;
|
||||
const uint32_t Height = 512;
|
||||
const uint32_t RowLength = Width;
|
||||
const RenderFormat Format = RenderFormat::R8G8B8A8_UNORM;
|
||||
const uint32_t BufferSize = RowLength * Height * RenderFormatSize(Format);
|
||||
Test.uploadBuffer = Test.device->createBuffer(RenderBufferDesc::UploadBuffer(BufferSize));
|
||||
Test.blueNoiseTexture = Test.device->createTexture(RenderTextureDesc::Texture2D(Width, Height, 1, Format));
|
||||
Test.rasterSet->setTexture(Test.rasterSet->gTextures + 2, Test.blueNoiseTexture.get(), RenderTextureLayout::SHADER_READ);
|
||||
|
||||
// Copy to upload buffer.
|
||||
void *bufferData = Test.uploadBuffer->map();
|
||||
memcpy(bufferData, LDR_64_64_64_RGB1_BGRA8, BufferSize);
|
||||
Test.uploadBuffer->unmap();
|
||||
|
||||
// Run command list to copy the upload buffer to the texture.
|
||||
Test.commandList->begin();
|
||||
Test.commandList->barriers(RenderBarrierStage::COPY,
|
||||
RenderBufferBarrier(Test.uploadBuffer.get(), RenderBufferAccess::READ),
|
||||
RenderTextureBarrier(Test.blueNoiseTexture.get(), RenderTextureLayout::COPY_DEST)
|
||||
);
|
||||
|
||||
Test.commandList->copyTextureRegion(
|
||||
RenderTextureCopyLocation::Subresource(Test.blueNoiseTexture.get()),
|
||||
RenderTextureCopyLocation::PlacedFootprint(Test.uploadBuffer.get(), Format, Width, Height, 1, RowLength));
|
||||
|
||||
Test.commandList->barriers(RenderBarrierStage::GRAPHICS_AND_COMPUTE, RenderTextureBarrier(Test.blueNoiseTexture.get(), RenderTextureLayout::SHADER_READ));
|
||||
Test.commandList->end();
|
||||
Test.commandQueue->executeCommandLists(Test.commandList.get(), Test.commandFence.get());
|
||||
Test.commandQueue->waitForCommandFence(Test.commandFence.get());
|
||||
# endif
|
||||
|
||||
Test.vertexBuffer = Test.device->createBuffer(RenderBufferDesc::VertexBuffer(sizeof(Vertices), RenderHeapType::UPLOAD));
|
||||
void *dstData = Test.vertexBuffer->map();
|
||||
memcpy(dstData, Vertices, sizeof(Vertices));
|
||||
Test.vertexBuffer->unmap();
|
||||
Test.vertexBufferView = RenderVertexBufferView(Test.vertexBuffer.get(), sizeof(Vertices));
|
||||
|
||||
Test.indexBuffer = Test.device->createBuffer(RenderBufferDesc::IndexBuffer(sizeof(Indices), RenderHeapType::UPLOAD));
|
||||
dstData = Test.indexBuffer->map();
|
||||
memcpy(dstData, Indices, sizeof(Indices));
|
||||
Test.indexBuffer->unmap();
|
||||
Test.indexBufferView = RenderIndexBufferView(Test.indexBuffer.get(), sizeof(Indices), RenderFormat::R32_UINT);
|
||||
# endif
|
||||
|
||||
# if ENABLE_COMPUTE
|
||||
Test.computeFirstSet = std::make_unique<ComputeDescriptorFirstSet>(Test.device.get());
|
||||
Test.computeSecondSet = std::make_unique<ComputeDescriptorSecondSet>(Test.device.get());
|
||||
Test.computeFirstSet->setTexture(Test.computeFirstSet->gBlueNoiseTexture, Test.blueNoiseTexture.get(), RenderTextureLayout::SHADER_READ);
|
||||
|
||||
layoutBuilder.begin();
|
||||
layoutBuilder.addPushConstant(0, 0, sizeof(ComputePushConstant), RenderShaderStageFlag::COMPUTE);
|
||||
layoutBuilder.addDescriptorSet(Test.computeFirstSet->builder);
|
||||
layoutBuilder.addDescriptorSet(Test.computeSecondSet->builder);
|
||||
layoutBuilder.end();
|
||||
|
||||
Test.computePipelineLayout = layoutBuilder.create(Test.device.get());
|
||||
|
||||
std::unique_ptr<RenderShader> computeShader = Test.device->createShader(CSBlob, CSBlobSize, "CSMain", shaderFormat);
|
||||
RenderComputePipelineDesc computeDesc;
|
||||
computeDesc.computeShader = computeShader.get();
|
||||
computeDesc.pipelineLayout = Test.computePipelineLayout.get();
|
||||
Test.computePipeline = Test.device->createComputePipeline(computeDesc);
|
||||
# endif
|
||||
|
||||
# if ENABLE_RT
|
||||
Test.rtSet = std::make_unique<RaytracingDescriptorSet>(Test.device.get());
|
||||
|
||||
layoutBuilder.begin(true);
|
||||
layoutBuilder.addDescriptorSet(Test.rtSet->builder);
|
||||
layoutBuilder.end();
|
||||
|
||||
Test.rtPipelineLayout = layoutBuilder.create(Test.device.get());
|
||||
|
||||
struct BufferParams {
|
||||
float rgbMultiplier[3];
|
||||
uint32_t pad[3];
|
||||
};
|
||||
|
||||
BufferParams paramsToUpload[2];
|
||||
paramsToUpload[0].rgbMultiplier[0] = 1.0f;
|
||||
paramsToUpload[0].rgbMultiplier[1] = 0.25f;
|
||||
paramsToUpload[0].rgbMultiplier[2] = 0.25f;
|
||||
paramsToUpload[1].rgbMultiplier[0] = 0.25f;
|
||||
paramsToUpload[1].rgbMultiplier[1] = 1.0f;
|
||||
paramsToUpload[1].rgbMultiplier[2] = 0.25f;
|
||||
|
||||
RenderBufferStructuredView paramsView(sizeof(BufferParams));
|
||||
Test.rtParamsBuffer = Test.device->createBuffer(RenderBufferDesc::UploadBuffer(sizeof(paramsToUpload), RenderBufferFlag::STORAGE));
|
||||
Test.rtSet->setBuffer(Test.rtSet->gBufferParams, Test.rtParamsBuffer.get(), sizeof(paramsToUpload), ¶msView);
|
||||
dstData = Test.rtParamsBuffer->map();
|
||||
memcpy(dstData, paramsToUpload, sizeof(paramsToUpload));
|
||||
Test.rtParamsBuffer->unmap();
|
||||
|
||||
RenderRaytracingPipelineLibrarySymbol rtLibrarySymbols[] = {
|
||||
RenderRaytracingPipelineLibrarySymbol("ColorRayGen", RenderRaytracingPipelineLibrarySymbolType::RAYGEN),
|
||||
RenderRaytracingPipelineLibrarySymbol("ColorClosestHit", RenderRaytracingPipelineLibrarySymbolType::CLOSEST_HIT),
|
||||
RenderRaytracingPipelineLibrarySymbol("ColorMiss", RenderRaytracingPipelineLibrarySymbolType::MISS)
|
||||
};
|
||||
|
||||
std::unique_ptr<RenderShader> rtShader = Test.device->createShader(RTBlob, RTBlobSize, nullptr, shaderFormat);
|
||||
RenderRaytracingPipelineLibrary rtLibrary(rtShader.get(), rtLibrarySymbols, uint32_t(std::size(rtLibrarySymbols)));
|
||||
RenderRaytracingPipelineHitGroup rtHitGroup("ColorHitGroup", "ColorClosestHit");
|
||||
RenderRaytracingPipelineDesc rtPsoDesc;
|
||||
rtPsoDesc.libraries = &rtLibrary;
|
||||
rtPsoDesc.librariesCount = 1;
|
||||
rtPsoDesc.hitGroups = &rtHitGroup;
|
||||
rtPsoDesc.hitGroupsCount = 1;
|
||||
rtPsoDesc.pipelineLayout = Test.rtPipelineLayout.get();
|
||||
rtPsoDesc.maxPayloadSize = sizeof(float) * 4;
|
||||
Test.rtPipeline = Test.device->createRaytracingPipeline(rtPsoDesc);
|
||||
|
||||
// Create RT BVH.
|
||||
const float BLASVertices[] = {
|
||||
0.25f, 0.25f, 1.0f,
|
||||
0.75f, 0.25f, 1.0f,
|
||||
0.5f, 0.75f, 1.0f
|
||||
};
|
||||
|
||||
dstData = Test.uploadBuffer->map();
|
||||
memcpy(dstData, BLASVertices, sizeof(BLASVertices));
|
||||
Test.uploadBuffer->unmap();
|
||||
|
||||
Test.rtVertexBuffer = Test.device->createBuffer(RenderBufferDesc::VertexBuffer(sizeof(BLASVertices), RenderHeapType::DEFAULT, RenderBufferFlag::ACCELERATION_STRUCTURE_INPUT));
|
||||
|
||||
RenderBottomLevelASMesh blasMesh;
|
||||
blasMesh.vertexBuffer = Test.rtVertexBuffer.get();
|
||||
blasMesh.vertexFormat = RenderFormat::R32G32B32_FLOAT;
|
||||
blasMesh.vertexCount = 3;
|
||||
blasMesh.vertexStride = sizeof(float) * 3;
|
||||
blasMesh.isOpaque = true;
|
||||
|
||||
RenderBottomLevelASBuildInfo blasBuildInfo;
|
||||
Test.device->setBottomLevelASBuildInfo(blasBuildInfo, &blasMesh, 1);
|
||||
|
||||
Test.rtBottomLevelASBuffer = Test.device->createBuffer(RenderBufferDesc::AccelerationStructureBuffer(blasBuildInfo.accelerationStructureSize));
|
||||
Test.rtBottomLevelAS = Test.device->createAccelerationStructure(RenderAccelerationStructureDesc(RenderAccelerationStructureType::BOTTOM_LEVEL, Test.rtBottomLevelASBuffer.get(), blasBuildInfo.accelerationStructureSize));
|
||||
|
||||
RenderTopLevelASInstance tlasInstance;
|
||||
tlasInstance.bottomLevelAS = Test.rtBottomLevelASBuffer.get();
|
||||
tlasInstance.instanceMask = 0xFF;
|
||||
tlasInstance.cullDisable = true;
|
||||
|
||||
RenderTopLevelASBuildInfo tlasBuildInfo;
|
||||
Test.device->setTopLevelASBuildInfo(tlasBuildInfo, &tlasInstance, 1);
|
||||
|
||||
Test.rtInstancesBuffer = Test.device->createBuffer(RenderBufferDesc::UploadBuffer(tlasBuildInfo.instancesBufferData.size(), RenderBufferFlag::ACCELERATION_STRUCTURE_INPUT));
|
||||
dstData = Test.rtInstancesBuffer->map();
|
||||
memcpy(dstData, tlasBuildInfo.instancesBufferData.data(), tlasBuildInfo.instancesBufferData.size());
|
||||
Test.rtInstancesBuffer->unmap();
|
||||
|
||||
Test.rtScratchBuffer = Test.device->createBuffer(RenderBufferDesc::DefaultBuffer(std::max(blasBuildInfo.scratchSize, tlasBuildInfo.scratchSize), RenderBufferFlag::ACCELERATION_STRUCTURE_SCRATCH));
|
||||
Test.rtTopLevelASBuffer = Test.device->createBuffer(RenderBufferDesc::AccelerationStructureBuffer(tlasBuildInfo.accelerationStructureSize));
|
||||
Test.rtTopLevelAS = Test.device->createAccelerationStructure(RenderAccelerationStructureDesc(RenderAccelerationStructureType::TOP_LEVEL, Test.rtTopLevelASBuffer.get(), tlasBuildInfo.accelerationStructureSize));
|
||||
Test.rtSet->setAccelerationStructure(Test.rtSet->gBVH, Test.rtTopLevelAS.get());
|
||||
|
||||
RenderShaderBindingGroups bindingGroups;
|
||||
RenderPipelineProgram rayGenProgram = Test.rtPipeline->getProgram("ColorRayGen");
|
||||
RenderPipelineProgram missProgram = Test.rtPipeline->getProgram("ColorMiss");
|
||||
RenderPipelineProgram hitGroupProgram = Test.rtPipeline->getProgram("ColorHitGroup");
|
||||
bindingGroups.rayGen = RenderShaderBindingGroup(&rayGenProgram, 1);
|
||||
bindingGroups.miss = RenderShaderBindingGroup(&missProgram, 1);
|
||||
bindingGroups.hitGroup = RenderShaderBindingGroup(&hitGroupProgram, 1);
|
||||
|
||||
RenderDescriptorSet *rtSetPtr = Test.rtSet->get();
|
||||
Test.device->setShaderBindingTableInfo(Test.rtShaderBindingTableInfo, bindingGroups, Test.rtPipeline.get(), &rtSetPtr, 1);
|
||||
|
||||
const std::vector<uint8_t> tableData = Test.rtShaderBindingTableInfo.tableBufferData;
|
||||
Test.rtShaderBindingTableBuffer = Test.device->createBuffer(RenderBufferDesc::UploadBuffer(tableData.size(), RenderBufferFlag::SHADER_BINDING_TABLE));
|
||||
dstData = Test.rtShaderBindingTableBuffer->map();
|
||||
memcpy(dstData, tableData.data(), tableData.size());
|
||||
Test.rtShaderBindingTableBuffer->unmap();
|
||||
|
||||
// Run command list to copy the vertex buffer and build the BLAS/TLAS.
|
||||
Test.commandList->begin();
|
||||
Test.commandList->barriers(RenderBarrierStage::COPY, RenderBufferBarrier(Test.rtVertexBuffer.get(), RenderBufferAccess::WRITE));
|
||||
Test.commandList->copyBufferRegion(Test.rtVertexBuffer.get(), Test.uploadBuffer.get(), sizeof(BLASVertices));
|
||||
Test.commandList->barriers(RenderBarrierStage::COMPUTE, RenderBufferBarrier(Test.rtVertexBuffer.get(), RenderBufferAccess::READ));
|
||||
Test.commandList->buildBottomLevelAS(Test.rtBottomLevelAS.get(), Test.rtScratchBuffer.get(), blasBuildInfo);
|
||||
Test.commandList->barriers(RenderBarrierStage::NONE, RenderBufferBarrier(Test.rtBottomLevelASBuffer.get(), RenderBufferAccess::READ));
|
||||
Test.commandList->buildTopLevelAS(Test.rtTopLevelAS.get(), Test.rtScratchBuffer.get(), Test.rtInstancesBuffer.get(), tlasBuildInfo);
|
||||
Test.commandList->end();
|
||||
Test.commandQueue->executeCommandLists(Test.commandList.get(), Test.commandFence.get());
|
||||
Test.commandQueue->waitForCommandFence(Test.commandFence.get());
|
||||
# endif
|
||||
}
|
||||
|
||||
void TestResize() {
|
||||
// Resize can be called during window creation by Windows.
|
||||
if (Test.swapChain == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
# if ENABLE_SWAP_CHAIN
|
||||
Test.swapFramebuffers.clear();
|
||||
Test.swapChain->resize();
|
||||
Test.swapFramebuffers.resize(Test.swapChain->getTextureCount());
|
||||
for (uint32_t i = 0; i < Test.swapChain->getTextureCount(); i++) {
|
||||
const RenderTexture *curTex = Test.swapChain->getTexture(i);
|
||||
Test.swapFramebuffers[i] = Test.device->createFramebuffer(RenderFramebufferDesc{&curTex, 1});
|
||||
}
|
||||
# endif
|
||||
# if ENABLE_CLEAR
|
||||
Test.colorTargetMS = Test.device->createTexture(RenderTextureDesc::ColorTarget(Test.swapChain->getWidth(), Test.swapChain->getHeight(), Test.ColorFormat, RenderMultisampling(Test.MSAACount), nullptr));
|
||||
Test.colorTargetResolved = Test.device->createTexture(RenderTextureDesc::ColorTarget(Test.swapChain->getWidth(), Test.swapChain->getHeight(), Test.ColorFormat, 1, nullptr, RenderTextureFlag::STORAGE | RenderTextureFlag::UNORDERED_ACCESS));
|
||||
Test.depthTarget = Test.device->createTexture(RenderTextureDesc::DepthTarget(Test.swapChain->getWidth(), Test.swapChain->getHeight(), Test.DepthFormat, RenderMultisampling(Test.MSAACount)));
|
||||
|
||||
const RenderTexture *colorTargetPtr = Test.colorTargetMS.get();
|
||||
Test.framebuffer = Test.device->createFramebuffer(RenderFramebufferDesc(&colorTargetPtr, 1, Test.depthTarget.get()));
|
||||
# endif
|
||||
# if ENABLE_COMPUTE
|
||||
Test.computeSecondSet->setTexture(Test.computeSecondSet->gTarget, Test.colorTarget.get(), RenderTextureLayout::GENERAL);
|
||||
# endif
|
||||
# if ENABLE_RT
|
||||
Test.rtSet->setTexture(Test.rtSet->gOutput, Test.colorTarget.get(), RenderTextureLayout::GENERAL);
|
||||
# endif
|
||||
}
|
||||
|
||||
void TestDraw() {
|
||||
// Begin.
|
||||
Test.commandList->begin();
|
||||
# if ENABLE_CLEAR
|
||||
const uint32_t SyncInterval = 1;
|
||||
const uint32_t width = Test.swapChain->getWidth();
|
||||
const uint32_t height = Test.swapChain->getHeight();
|
||||
const RenderViewport viewport(0.0f, 0.0f, float(width), float(height));
|
||||
const RenderRect scissor(0, 0, width, height);
|
||||
|
||||
// Clear.
|
||||
Test.commandList->setViewports(viewport);
|
||||
Test.commandList->setScissors(scissor);
|
||||
Test.commandList->barriers(RenderBarrierStage::GRAPHICS, RenderTextureBarrier(Test.colorTargetMS.get(), RenderTextureLayout::COLOR_WRITE));
|
||||
Test.commandList->barriers(RenderBarrierStage::GRAPHICS, RenderTextureBarrier(Test.depthTarget.get(), RenderTextureLayout::DEPTH_WRITE));
|
||||
Test.commandList->setFramebuffer(Test.framebuffer.get());
|
||||
Test.commandList->clearColor(0, RenderColor(0.0f, 0.0f, 0.5f));
|
||||
Test.commandList->clearDepth();
|
||||
# endif
|
||||
# if ENABLE_RASTER
|
||||
// Raster.
|
||||
RasterPushConstant pushConstant;
|
||||
pushConstant.colorAdd[0] = 0.5f;
|
||||
pushConstant.colorAdd[1] = 0.25f;
|
||||
pushConstant.colorAdd[2] = 0.0f;
|
||||
pushConstant.colorAdd[3] = 0.0f;
|
||||
pushConstant.textureIndex = 2;
|
||||
Test.commandList->setPipeline(Test.rasterPipeline.get());
|
||||
Test.commandList->setGraphicsPipelineLayout(Test.rasterPipelineLayout.get());
|
||||
Test.commandList->setGraphicsPushConstants(0, &pushConstant);
|
||||
# if ENABLE_TEXTURE
|
||||
Test.commandList->setGraphicsDescriptorSet(Test.rasterSet->get(), 0);
|
||||
# endif
|
||||
Test.commandList->setVertexBuffers(0, &Test.vertexBufferView, 1, &Test.inputSlot);
|
||||
Test.commandList->setIndexBuffer(&Test.indexBufferView);
|
||||
Test.commandList->drawInstanced(3, 1, 0, 0);
|
||||
Test.commandList->barriers(RenderBarrierStage::COPY, RenderTextureBarrier(Test.depthTarget.get(), RenderTextureLayout::DEPTH_READ));
|
||||
# endif
|
||||
# if ENABLE_COMPUTE || ENABLE_RT || ENABLE_CLEAR
|
||||
Test.commandList->barriers(RenderBarrierStage::COPY, RenderTextureBarrier(Test.colorTargetMS.get(), RenderTextureLayout::RESOLVE_SOURCE));
|
||||
Test.commandList->barriers(RenderBarrierStage::COPY, RenderTextureBarrier(Test.colorTargetResolved.get(), RenderTextureLayout::RESOLVE_DEST));
|
||||
Test.commandList->resolveTexture(Test.colorTargetResolved.get(), Test.colorTargetMS.get());
|
||||
# endif
|
||||
# if ENABLE_COMPUTE || ENABLE_RT
|
||||
Test.commandList->barriers(RenderBarrierStage::COMPUTE, RenderTextureBarrier(Test.colorTargetResolved.get(), RenderTextureLayout::GENERAL));
|
||||
# endif
|
||||
# if ENABLE_COMPUTE
|
||||
const uint32_t GroupCount = 8;
|
||||
ComputePushConstant pushCostant;
|
||||
pushCostant.Resolution[0] = width;
|
||||
pushCostant.Resolution[1] = height;
|
||||
pushCostant.Multiply[0] = 0.5f;
|
||||
pushCostant.Multiply[1] = 0.5f;
|
||||
pushCostant.Multiply[2] = 1.0f;
|
||||
pushCostant.Multiply[3] = 1.0f;
|
||||
Test.commandList->setPipeline(Test.computePipeline.get());
|
||||
Test.commandList->setComputePipelineLayout(Test.computePipelineLayout.get());
|
||||
Test.commandList->setComputePushConstants(0, &pushCostant);
|
||||
Test.commandList->setComputeDescriptorSet(Test.computeFirstSet->get(), 0);
|
||||
Test.commandList->setComputeDescriptorSet(Test.computeSecondSet->get(), 1);
|
||||
Test.commandList->dispatch((width + GroupCount - 1) / GroupCount, (height + GroupCount - 1) / GroupCount, 1);
|
||||
# endif
|
||||
# if ENABLE_RT
|
||||
// RT.
|
||||
Test.commandList->barriers(RenderBarrierStage::COMPUTE, RenderTextureBarrier(Test.colorTargetResolved.get(), RenderTextureLayout::GENERAL));
|
||||
Test.commandList->setPipeline(Test.rtPipeline.get());
|
||||
Test.commandList->setRaytracingPipelineLayout(Test.rtPipelineLayout.get());
|
||||
Test.commandList->setRaytracingDescriptorSet(Test.rtSet->get(), 0);
|
||||
Test.commandList->traceRays(width, height, 1, Test.rtShaderBindingTableBuffer.get(), Test.rtShaderBindingTableInfo.groups);
|
||||
# endif
|
||||
# if ENABLE_SWAP_CHAIN
|
||||
const uint32_t swapChainTextureIndex = Test.swapChain->getTextureIndex();
|
||||
RenderTexture *swapChainTexture = Test.swapChain->getTexture(swapChainTextureIndex);
|
||||
RenderFramebuffer *swapFramebuffer = Test.swapFramebuffers[swapChainTextureIndex].get();
|
||||
Test.commandList->setViewports(viewport);
|
||||
Test.commandList->setScissors(scissor);
|
||||
Test.commandList->barriers(RenderBarrierStage::GRAPHICS, RenderTextureBarrier(swapChainTexture, RenderTextureLayout::COLOR_WRITE));
|
||||
Test.commandList->setFramebuffer(swapFramebuffer);
|
||||
# endif
|
||||
# if ENABLE_CLEAR
|
||||
Test.commandList->barriers(RenderBarrierStage::GRAPHICS, RenderTextureBarrier(Test.colorTargetResolved.get(), RenderTextureLayout::SHADER_READ));
|
||||
Test.commandList->clearColor(0, RenderColor(0.0f, 0.0f, 0.0f));
|
||||
Test.commandList->setPipeline(Test.postPipeline.get());
|
||||
Test.commandList->setGraphicsPipelineLayout(Test.postPipelineLayout.get());
|
||||
Test.postSet->setTexture(0, Test.colorTargetResolved.get(), RenderTextureLayout::SHADER_READ);
|
||||
Test.commandList->setGraphicsDescriptorSet(Test.postSet.get(), 0);
|
||||
Test.commandList->drawInstanced(3, 1, 0, 0);
|
||||
# endif
|
||||
# if ENABLE_SWAP_CHAIN
|
||||
Test.commandList->barriers(RenderBarrierStage::NONE, RenderTextureBarrier(swapChainTexture, RenderTextureLayout::PRESENT));
|
||||
# endif
|
||||
// End.
|
||||
Test.commandList->end();
|
||||
Test.commandQueue->executeCommandLists(Test.commandList.get(), Test.commandFence.get());
|
||||
# if ENABLE_SWAP_CHAIN
|
||||
Test.swapChain->present();
|
||||
# endif
|
||||
Test.commandQueue->waitForCommandFence(Test.commandFence.get());
|
||||
}
|
||||
|
||||
void TestShutdown() {
|
||||
Test.rtParamsBuffer.reset(nullptr);
|
||||
Test.rtVertexBuffer.reset(nullptr);
|
||||
Test.rtScratchBuffer.reset(nullptr);
|
||||
Test.rtInstancesBuffer.reset(nullptr);
|
||||
Test.rtBottomLevelASBuffer.reset(nullptr);
|
||||
Test.rtTopLevelASBuffer.reset(nullptr);
|
||||
Test.rtShaderBindingTableBuffer.reset(nullptr);
|
||||
Test.uploadBuffer.reset(nullptr);
|
||||
Test.blueNoiseTexture.reset(nullptr);
|
||||
Test.vertexBuffer.reset(nullptr);
|
||||
Test.indexBuffer.reset(nullptr);
|
||||
Test.rasterPipeline.reset(nullptr);
|
||||
Test.computePipeline.reset(nullptr);
|
||||
Test.rtPipeline.reset(nullptr);
|
||||
Test.postPipeline.reset(nullptr);
|
||||
Test.rasterPipelineLayout.reset(nullptr);
|
||||
Test.computePipelineLayout.reset(nullptr);
|
||||
Test.rtPipelineLayout.reset(nullptr);
|
||||
Test.postPipelineLayout.reset(nullptr);
|
||||
Test.rtSet.reset(nullptr);
|
||||
Test.rasterSet.reset(nullptr);
|
||||
Test.computeFirstSet.reset(nullptr);
|
||||
Test.computeSecondSet.reset(nullptr);
|
||||
Test.postSet.reset(nullptr);
|
||||
Test.linearSampler.reset(nullptr);
|
||||
Test.postSampler.reset(nullptr);
|
||||
Test.colorTargetMS.reset(nullptr);
|
||||
Test.colorTargetResolved.reset(nullptr);
|
||||
Test.framebuffer.reset(nullptr);
|
||||
Test.swapFramebuffers.clear();
|
||||
Test.commandList.reset(nullptr);
|
||||
Test.commandFence.reset(nullptr);
|
||||
Test.swapChain.reset(nullptr);
|
||||
Test.commandQueue.reset(nullptr);
|
||||
Test.device.reset(nullptr);
|
||||
}
|
||||
|
||||
#if defined(_WIN64)
|
||||
static LRESULT CALLBACK TestWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
switch (message) {
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
case WM_SIZE:
|
||||
TestResize();
|
||||
return 0;
|
||||
case WM_PAINT:
|
||||
TestDraw();
|
||||
return 0;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HWND TestCreateWindow() {
|
||||
// Register window class.
|
||||
WNDCLASS wc;
|
||||
memset(&wc, 0, sizeof(WNDCLASS));
|
||||
wc.lpfnWndProc = TestWndProc;
|
||||
wc.hInstance = GetModuleHandle(0);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND);
|
||||
wc.lpszClassName = "RenderInterfaceTest";
|
||||
RegisterClass(&wc);
|
||||
|
||||
// Create window.
|
||||
const int Width = 1280;
|
||||
const int Height = 720;
|
||||
RECT rect;
|
||||
UINT dwStyle = WS_OVERLAPPEDWINDOW | WS_VISIBLE;
|
||||
rect.left = (GetSystemMetrics(SM_CXSCREEN) - Width) / 2;
|
||||
rect.top = (GetSystemMetrics(SM_CYSCREEN) - Height) / 2;
|
||||
rect.right = rect.left + Width;
|
||||
rect.bottom = rect.top + Height;
|
||||
AdjustWindowRectEx(&rect, dwStyle, 0, 0);
|
||||
|
||||
return CreateWindow(wc.lpszClassName, "Render Interface Test", dwStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0, 0, wc.hInstance, NULL);
|
||||
}
|
||||
|
||||
void RenderInterfaceTest(RenderInterface *renderInterface) {
|
||||
HWND hwnd = TestCreateWindow();
|
||||
TestInitialize(renderInterface, hwnd);
|
||||
TestResize();
|
||||
|
||||
// Message loop.
|
||||
MSG msg = {};
|
||||
while (msg.message != WM_QUIT) {
|
||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
TestShutdown();
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
#elif defined(__ANDROID__)
|
||||
void RenderInterfaceTest(RenderInterface* renderInterface) {
|
||||
assert(false);
|
||||
}
|
||||
#elif defined(__linux__)
|
||||
void RenderInterfaceTest(RenderInterface* renderInterface) {
|
||||
Display* display = XOpenDisplay(nullptr);
|
||||
int blackColor = BlackPixel(display, DefaultScreen(display));
|
||||
Window window = XCreateSimpleWindow(display, DefaultRootWindow(display),
|
||||
0, 0, 1280, 720, 0, blackColor, blackColor);
|
||||
|
||||
|
||||
XSelectInput(display, window, StructureNotifyMask);
|
||||
// Map the window and wait for the notify event to come in.
|
||||
XMapWindow(display, window);
|
||||
while (true) {
|
||||
XEvent event;
|
||||
XNextEvent(display, &event);
|
||||
if (event.type == MapNotify) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the delete window protocol.
|
||||
Atom wmDeleteMessage = XInternAtom(display, "WM_DELETE_WINDOW", False);
|
||||
XSetWMProtocols(display, window, &wmDeleteMessage, 1);
|
||||
|
||||
TestInitialize(renderInterface, {display, window});
|
||||
TestResize();
|
||||
TestDraw();
|
||||
|
||||
// Loop until the window is closed.
|
||||
std::chrono::system_clock::time_point prev_frame = std::chrono::system_clock::now();
|
||||
bool running = true;
|
||||
while (running) {
|
||||
if (XPending(display) > 0) {
|
||||
XEvent event;
|
||||
XNextEvent(display, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
TestDraw();
|
||||
break;
|
||||
|
||||
case ClientMessage:
|
||||
if (event.xclient.data.l[0] == wmDeleteMessage)
|
||||
running = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
std::this_thread::sleep_for(1ms);
|
||||
auto now_time = std::chrono::system_clock::now();
|
||||
if (now_time - prev_frame > 16666us) {
|
||||
prev_frame = now_time;
|
||||
TestDraw();
|
||||
}
|
||||
}
|
||||
|
||||
TestShutdown();
|
||||
XDestroyWindow(display, window);
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
void RenderInterfaceTest(RenderInterface* renderInterface) {
|
||||
assert(false);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
struct Constants {
|
||||
float4 Multiply;
|
||||
uint2 Resolution;
|
||||
};
|
||||
|
||||
[[vk::push_constant]] ConstantBuffer<Constants> gConstants : register(b0);
|
||||
|
||||
Texture2D<float4> gBlueNoiseTexture : register(t1);
|
||||
SamplerState gSampler : register(s2);
|
||||
[[vk::image_format("rgba8")]]
|
||||
RWTexture2D<float4> gTarget : register(u16, space1);
|
||||
|
||||
[numthreads(8, 8, 1)]
|
||||
void CSMain(uint2 coord : SV_DispatchThreadID) {
|
||||
if (any(coord >= gConstants.Resolution)) {
|
||||
return;
|
||||
}
|
||||
|
||||
float2 blueNoiseUV = float2(coord) / float2(gConstants.Resolution);
|
||||
float4 blueNoise = float4(gBlueNoiseTexture.SampleLevel(gSampler, blueNoiseUV, 0).rgb, 1.0f);
|
||||
gTarget[coord] *= (blueNoise * gConstants.Multiply);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
struct Constants {
|
||||
float4 colorAdd;
|
||||
uint textureIndex;
|
||||
};
|
||||
|
||||
[[vk::push_constant]] ConstantBuffer<Constants> gConstants : register(b0);
|
||||
|
||||
SamplerState gSampler : register(s1);
|
||||
Texture2D<float4> gTexture[] : register(t2);
|
||||
|
||||
float4 PSMain(in float4 pos : SV_Position, in float2 uv : TEXCOORD) : SV_TARGET {
|
||||
float4 result = float4(gTexture[NonUniformResourceIndex(gConstants.textureIndex)].SampleLevel(gSampler, uv, 0).rgb, 1.0f);
|
||||
result += gConstants.colorAdd;
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
Texture2D<float4> gTexture : register(t1);
|
||||
SamplerState gSampler : register(s2);
|
||||
|
||||
float4 PSMain(in float4 pos : SV_Position, in float2 uv : TEXCOORD) : SV_TARGET {
|
||||
float4 result = float4(gTexture.SampleLevel(gSampler, uv, 0).rgb, 1.0f);
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
void VSMain(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD0) {
|
||||
uv.x = (id == 2) ? 2.0f : 0.0f;
|
||||
uv.y = (id == 1) ? 2.0f : 0.0f;
|
||||
pos = float4(uv * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 1.0f, 1.0f);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
struct Attributes {
|
||||
float2 bary;
|
||||
};
|
||||
|
||||
struct Payload {
|
||||
float4 color;
|
||||
};
|
||||
|
||||
struct BufferParams {
|
||||
float3 rgbMultiplier;
|
||||
uint3 pad;
|
||||
};
|
||||
|
||||
RaytracingAccelerationStructure gBVH : register(t0);
|
||||
RWTexture2D<float4> gOutput : register(u1);
|
||||
StructuredBuffer<BufferParams> gBufferParams : register(t2);
|
||||
|
||||
[shader("raygeneration")]
|
||||
void ColorRayGen() {
|
||||
RayDesc ray;
|
||||
ray.Origin = float3(float2(DispatchRaysIndex().xy) / float2(DispatchRaysDimensions().xy), 0.0f);
|
||||
ray.Direction = float3(0.0f, 0.0f, 1.0f);
|
||||
ray.TMin = 1e-6f;
|
||||
ray.TMax = 1e6f;
|
||||
|
||||
Payload payload;
|
||||
payload.color = float4(0.0f, 0.5f, 0.0f, 1.0f);
|
||||
TraceRay(gBVH, RAY_FLAG_NONE, 0xFF, 0, 0, 0, ray, payload);
|
||||
gOutput[DispatchRaysIndex().xy] = payload.color;
|
||||
}
|
||||
|
||||
[shader("closesthit")]
|
||||
void ColorClosestHit(inout Payload payload, in Attributes attr) {
|
||||
payload.color = float4(1.0f, attr.bary.xy, 1.0f) * float4(gBufferParams[0].rgbMultiplier, 1.0f);
|
||||
}
|
||||
|
||||
[shader("miss")]
|
||||
void ColorMiss(inout Payload payload) {
|
||||
payload.color = float4(0.25f, 0.25f, 0.5f, 1.0f) * float4(gBufferParams[1].rgbMultiplier, 1.0f);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
void VSMain(in float2 vertexPos : POSITION, in float2 vertexUV : TEXCOORD, out float4 pos : SV_POSITION, out float2 uv : TEXCOORD) {
|
||||
pos = float4(vertexPos, 1.0f, 1.0f);
|
||||
uv = vertexUV;
|
||||
}
|
||||
@@ -0,0 +1,518 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#ifndef RT64_EXTENDED_GBI
|
||||
#define RT64_EXTENDED_GBI
|
||||
|
||||
// G_SPNOOP on F3D and F3DEX2.
|
||||
#ifdef F3DEX_GBI_2
|
||||
# define RT64_HOOK_OPCODE 0xE0
|
||||
#else
|
||||
# define RT64_HOOK_OPCODE 0x00
|
||||
#endif
|
||||
|
||||
#define RT64_HOOK_OP_GETVERSION 0x0
|
||||
#define RT64_HOOK_OP_ENABLE 0x1
|
||||
#define RT64_HOOK_OP_DISABLE 0x2
|
||||
#define RT64_HOOK_OP_DL 0x3
|
||||
#define RT64_HOOK_OP_BRANCH 0x4
|
||||
|
||||
// 0x5254 for ASCII "RT" followed by 0x64.
|
||||
#define RT64_HOOK_MAGIC_NUMBER 0x525464
|
||||
|
||||
#ifndef RT64_EXTENDED_OPCODE
|
||||
// TODO: Define defaults here based on the GBI.
|
||||
# define RT64_EXTENDED_OPCODE 0x64
|
||||
#endif
|
||||
|
||||
#define G_EX_VERSION 0x1
|
||||
|
||||
#define G_EX_NOOP 0x000000
|
||||
#define G_EX_PRINT 0x000001
|
||||
#define G_EX_TEXRECT_V1 0x000002
|
||||
#define G_EX_FILLRECT_V1 0x000003
|
||||
#define G_EX_SETVIEWPORT_V1 0x000004
|
||||
#define G_EX_SETSCISSOR_V1 0x000005
|
||||
#define G_EX_SETRECTALIGN_V1 0x000006
|
||||
#define G_EX_SETVIEWPORTALIGN_V1 0x000007
|
||||
#define G_EX_SETSCISSORALIGN_V1 0x000008
|
||||
#define G_EX_SETREFRESHRATE_V1 0x000009
|
||||
#define G_EX_VERTEXZTEST_V1 0x00000A
|
||||
#define G_EX_ENDVERTEXZTEST_V1 0x00000B
|
||||
#define G_EX_MATRIXGROUP_V1 0x00000C
|
||||
#define G_EX_POPMATRIXGROUP_V1 0x00000D
|
||||
#define G_EX_FORCEUPSCALE2D_V1 0x00000E
|
||||
#define G_EX_FORCETRUEBILERP_V1 0x00000F
|
||||
#define G_EX_FORCESCALELOD_V1 0x000010
|
||||
#define G_EX_FORCEBRANCH_V1 0x000011
|
||||
#define G_EX_SETRENDERTORAM_V1 0x000012
|
||||
#define G_EX_EDITGROUPBYADDRESS_V1 0x000013
|
||||
#define G_EX_VERTEX_V1 0x000014
|
||||
#define G_EX_PUSHVIEWPORT_V1 0x000015
|
||||
#define G_EX_POPVIEWPORT_V1 0x000016
|
||||
#define G_EX_PUSHSCISSOR_V1 0x000017
|
||||
#define G_EX_POPSCISSOR_V1 0x000018
|
||||
#define G_EX_PUSHOTHERMODE_V1 0x000019
|
||||
#define G_EX_POPOTHERMODE_V1 0x00001A
|
||||
#define G_EX_PUSHCOMBINE_V1 0x00001B
|
||||
#define G_EX_POPCOMBINE_V1 0x00001C
|
||||
#define G_EX_PUSHPROJMATRIX_V1 0x00001D
|
||||
#define G_EX_POPPROJMATRIX_V1 0x00001E
|
||||
#define G_EX_PUSHENVCOLOR_V1 0x00001F
|
||||
#define G_EX_POPENVCOLOR_V1 0x000020
|
||||
#define G_EX_PUSHBLENDCOLOR_V1 0x000021
|
||||
#define G_EX_POPBLENDCOLOR_V1 0x000022
|
||||
#define G_EX_PUSHFOGCOLOR_V1 0x000023
|
||||
#define G_EX_POPFOGCOLOR_V1 0x000024
|
||||
#define G_EX_PUSHFILLCOLOR_V1 0x000025
|
||||
#define G_EX_POPFILLCOLOR_V1 0x000026
|
||||
#define G_EX_PUSHPRIMCOLOR_V1 0x000027
|
||||
#define G_EX_POPPRIMCOLOR_V1 0x000028
|
||||
#define G_EX_PUSHGEOMETRYMODE_V1 0x000029
|
||||
#define G_EX_POPGEOMETRYMODE_V1 0x00002A
|
||||
#define G_EX_SETDITHERNOISESTRENGTH_V1 0x00002B
|
||||
#define G_EX_SETRDRAMEXTENDED_V1 0x00002C
|
||||
#define G_EX_MAX 0x00002D
|
||||
|
||||
#define G_EX_ORIGIN_NONE 0x800
|
||||
#define G_EX_ORIGIN_LEFT 0x0
|
||||
#define G_EX_ORIGIN_CENTER 0x200
|
||||
#define G_EX_ORIGIN_RIGHT 0x400
|
||||
|
||||
#define G_EX_NOPUSH 0x0
|
||||
#define G_EX_PUSH 0x1
|
||||
|
||||
#define G_EX_ID_IGNORE 0x0
|
||||
#define G_EX_ID_AUTO 0xFFFFFFFF
|
||||
|
||||
#define G_EX_COMPONENT_SKIP 0x0
|
||||
#define G_EX_COMPONENT_INTERPOLATE 0x1
|
||||
#define G_EX_COMPONENT_AUTO 0x2
|
||||
|
||||
#define G_EX_INTERPOLATE_SIMPLE 0x0
|
||||
#define G_EX_INTERPOLATE_DECOMPOSE 0x1
|
||||
|
||||
#define G_EX_ORDER_LINEAR 0x0
|
||||
#define G_EX_ORDER_AUTO 0x1
|
||||
|
||||
#define G_EX_EDIT_NONE 0x0
|
||||
#define G_EX_EDIT_ALLOW 0x1
|
||||
|
||||
#define G_EX_BILERP_NONE 0x0
|
||||
#define G_EX_BILERP_ONLY 0x1
|
||||
#define G_EX_BILERP_ALL 0x2
|
||||
|
||||
// Represents the 8-byte commands in the F3D microcode family
|
||||
typedef union {
|
||||
struct {
|
||||
unsigned word0;
|
||||
unsigned word1;
|
||||
} values;
|
||||
unsigned long long dummy; // Force to 8-byte alignment
|
||||
} GfxCommand;
|
||||
|
||||
typedef struct {
|
||||
short ob[3];
|
||||
unsigned short flag;
|
||||
short tc[2];
|
||||
unsigned char cn[4];
|
||||
short obp[3];
|
||||
} VertexEXColor;
|
||||
|
||||
typedef struct {
|
||||
short ob[3];
|
||||
unsigned short flag;
|
||||
short tc[2];
|
||||
signed char n[3];
|
||||
unsigned char a;
|
||||
short obp[3];
|
||||
} VertexEXNormal;
|
||||
|
||||
typedef union {
|
||||
VertexEXColor v;
|
||||
VertexEXNormal n;
|
||||
long long alignment[3];
|
||||
} VertexEX;
|
||||
|
||||
#define PARAM(value, bits, shift) \
|
||||
((unsigned) (((unsigned)(value) & ((1U << (bits)) - 1U)) << (shift)))
|
||||
|
||||
#define DOWHILE(code) \
|
||||
do { code } while (0)
|
||||
|
||||
#define G_EX_WRITECOMMAND(cmd, _word0, _word1) \
|
||||
{ \
|
||||
cmd->values.word0 = _word0; \
|
||||
cmd->values.word1 = _word1; \
|
||||
}
|
||||
|
||||
#define G_EX_COMMAND1(cmd, _word0, _word1) \
|
||||
DOWHILE( \
|
||||
GfxCommand *_cmd = (GfxCommand*)(cmd); \
|
||||
G_EX_WRITECOMMAND((_cmd + 0), _word0, _word1) \
|
||||
)
|
||||
|
||||
#define G_EX_COMMAND2(cmd, _word0, _word1, _word2, _word3) \
|
||||
DOWHILE( \
|
||||
GfxCommand *_cmd = (GfxCommand*)(cmd); \
|
||||
(void)(cmd); \
|
||||
G_EX_WRITECOMMAND((_cmd + 0), _word0, _word1) \
|
||||
G_EX_WRITECOMMAND((_cmd + 1), _word2, _word3) \
|
||||
)
|
||||
|
||||
#define G_EX_COMMAND3(cmd, _word0, _word1, _word2, _word3, _word4, _word5) \
|
||||
DOWHILE( \
|
||||
GfxCommand *_cmd = (GfxCommand*)(cmd); \
|
||||
(void)(cmd); \
|
||||
(void)(cmd); \
|
||||
G_EX_WRITECOMMAND((_cmd + 0), _word0, _word1) \
|
||||
G_EX_WRITECOMMAND((_cmd + 1), _word2, _word3) \
|
||||
G_EX_WRITECOMMAND((_cmd + 2), _word4, _word5) \
|
||||
)
|
||||
|
||||
#define G_EX_COMMAND4(cmd, _word0, _word1, _word2, _word3, _word4, _word5, _word6, _word7) \
|
||||
DOWHILE( \
|
||||
GfxCommand *_cmd = (GfxCommand*)(cmd); \
|
||||
(void)(cmd); \
|
||||
(void)(cmd); \
|
||||
(void)(cmd); \
|
||||
G_EX_WRITECOMMAND(cmd_, _word0, _word1) \
|
||||
G_EX_WRITECOMMAND(cmd_, _word2, _word3) \
|
||||
G_EX_WRITECOMMAND(cmd_, _word4, _word5) \
|
||||
G_EX_WRITECOMMAND(cmd_, _word6, _word7) \
|
||||
)
|
||||
|
||||
#define gEXGetVersion(cmd, ret) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_HOOK_OPCODE, 8, 24) | PARAM(RT64_HOOK_MAGIC_NUMBER, 24, 0), \
|
||||
PARAM(RT64_HOOK_OP_GETVERSION, 4, 28) | PARAM(ret, 28, 0))
|
||||
|
||||
#define gEXEnable(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_HOOK_OPCODE, 8, 24) | PARAM(RT64_HOOK_MAGIC_NUMBER, 24, 0), \
|
||||
PARAM(RT64_HOOK_OP_ENABLE, 4, 28) | PARAM(RT64_EXTENDED_OPCODE, 8, 0))
|
||||
|
||||
#define gEXDisable(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_HOOK_OPCODE, 8, 24) | PARAM(RT64_HOOK_MAGIC_NUMBER, 24, 0), \
|
||||
PARAM(RT64_HOOK_OP_DISABLE, 4, 28))
|
||||
|
||||
#define gEXBranchList(cmd, dlist) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_HOOK_OPCODE, 8, 24) | PARAM(RT64_HOOK_MAGIC_NUMBER, 24, 0), \
|
||||
PARAM(RT64_HOOK_OP_BRANCH, 4, 28) | PARAM(dlist, 28, 0))
|
||||
|
||||
#define gEXDisplayList(cmd, dlist) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_HOOK_OPCODE, 8, 24) | PARAM(RT64_HOOK_MAGIC_NUMBER, 24, 0), \
|
||||
PARAM(RT64_HOOK_OP_DL, 4, 28) | PARAM(dlist, 28, 0))
|
||||
|
||||
#define gEXNoOp(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_NOOP, 24, 0), \
|
||||
0)
|
||||
|
||||
#define gEXPrint(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_PRINT, 24, 0), \
|
||||
0)
|
||||
|
||||
#define gEXTextureRectangle(cmd, lorigin, rorigin, ulx, uly, lrx, lry, tile, s, t, dsdx, dtdy) \
|
||||
G_EX_COMMAND3(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_TEXRECT_V1, 24, 0), \
|
||||
PARAM(tile, 3, 0) | PARAM(lorigin, 12, 3) | PARAM(rorigin, 12, 15) | PARAM(0, 5, 27), \
|
||||
\
|
||||
PARAM(ulx, 16, 16) | PARAM(uly, 16, 0), \
|
||||
PARAM(lrx, 16, 16) | PARAM(lry, 16, 0), \
|
||||
\
|
||||
PARAM(s, 16, 16) | PARAM(t, 16, 0), \
|
||||
PARAM(dsdx, 16, 16) | PARAM(dtdy, 16, 0) \
|
||||
)
|
||||
|
||||
#define gEXViewport(cmd, origin, vp) \
|
||||
G_EX_COMMAND2(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_SETVIEWPORT_V1, 24, 0), \
|
||||
PARAM(origin, 12, 0), \
|
||||
\
|
||||
0, \
|
||||
(unsigned)vp \
|
||||
)
|
||||
|
||||
#define gEXSetScissor(cmd, mode, lorigin, rorigin, ulx, uly, lrx, lry) \
|
||||
G_EX_COMMAND2(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_SETSCISSOR_V1, 24, 0), \
|
||||
PARAM(mode, 2, 0) | PARAM(lorigin, 12, 2) | PARAM(rorigin, 12, 14), \
|
||||
\
|
||||
PARAM((ulx) * 4, 16, 16) | PARAM((uly) * 4, 16, 0), \
|
||||
PARAM((lrx) * 4, 16, 16) | PARAM((lry) * 4, 16, 0) \
|
||||
)
|
||||
|
||||
#define gEXSetRectAlign(cmd, lorigin, rorigin, ulxOffset, ulyOffset, lrxOffset, lryOffset) \
|
||||
G_EX_COMMAND2(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_SETRECTALIGN_V1, 24, 0), \
|
||||
PARAM(lorigin, 12, 0) | PARAM(rorigin, 12, 12), \
|
||||
\
|
||||
PARAM((ulxOffset), 16, 16) | PARAM((ulyOffset), 16, 0), \
|
||||
PARAM((lrxOffset), 16, 16) | PARAM((lryOffset), 16, 0) \
|
||||
)
|
||||
|
||||
#define gEXSetViewportAlign(cmd, origin, xOffset, yOffset) \
|
||||
G_EX_COMMAND2(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_SETVIEWPORTALIGN_V1, 24, 0), \
|
||||
PARAM(origin, 12, 0), \
|
||||
\
|
||||
PARAM((xOffset), 16, 16) | PARAM((yOffset), 16, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXSetScissorAlign(cmd, lorigin, rorigin, ulxOffset, ulyOffset, lrxOffset, lryOffset, ulxBound, ulyBound, lrxBound, lryBound) \
|
||||
G_EX_COMMAND3(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_SETSCISSORALIGN_V1, 24, 0), \
|
||||
PARAM(lorigin, 12, 0) | PARAM(rorigin, 12, 12), \
|
||||
\
|
||||
PARAM((ulxOffset) * 4, 16, 16) | PARAM((ulyOffset) * 4, 16, 0), \
|
||||
PARAM((lrxOffset) * 4, 16, 16) | PARAM((lryOffset) * 4, 16, 0), \
|
||||
\
|
||||
PARAM((ulxBound) * 4, 16, 16) | PARAM((ulyBound) * 4, 16, 0), \
|
||||
PARAM((lrxBound) * 4, 16, 16) | PARAM((lryBound) * 4, 16, 0) \
|
||||
)
|
||||
|
||||
#define gEXSetRefreshRate(cmd, refresh_rate) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_SETREFRESHRATE_V1, 24, 0), \
|
||||
PARAM(refresh_rate, 16, 0) \
|
||||
)
|
||||
|
||||
#define gEXVertexZTest(cmd, vertex_index) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_VERTEXZTEST_V1, 24, 0), \
|
||||
PARAM(vertex_index, 8, 0) \
|
||||
)
|
||||
|
||||
#define gEXEndVertexZTest(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_ENDVERTEXZTEST_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXMatrixGroup(cmd, id, mode, push, proj, pos, rot, scale, skew, persp, vert, tile, order, edit) \
|
||||
G_EX_COMMAND2(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_MATRIXGROUP_V1, 24, 0), \
|
||||
id, \
|
||||
PARAM(push, 1, 0) | PARAM((proj) != 0, 1, 1) | PARAM(mode, 1, 2) | PARAM(pos, 2, 3) | PARAM(rot, 2, 5) | PARAM(scale, 2, 7) | PARAM(skew, 2, 9) | PARAM(persp, 2, 11) | PARAM(vert, 2, 13) | PARAM(tile, 2, 15) | PARAM(order, 2, 17) | PARAM(edit, 1, 19), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXMatrixGroupSimple(cmd, id, push, proj, pos, rot, persp, vert, tile, order, edit) \
|
||||
gEXMatrixGroup(cmd, id, G_EX_INTERPOLATE_SIMPLE, push, proj, pos, rot, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, persp, vert, tile, order, edit)
|
||||
|
||||
#define gEXMatrixGroupDecomposed(cmd, id, push, proj, pos, rot, scale, skew, persp, vert, tile, order, edit) \
|
||||
gEXMatrixGroup(cmd, id, G_EX_INTERPOLATE_DECOMPOSE, push, proj, pos, rot, scale, skew, persp, vert, tile, order, edit)
|
||||
|
||||
#define gEXMatrixGroupNoInterpolate(cmd, push, proj, edit) \
|
||||
gEXMatrixGroup(cmd, G_EX_ID_IGNORE, G_EX_INTERPOLATE_SIMPLE, push, proj, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_ORDER_LINEAR, edit)
|
||||
|
||||
#define gEXPopMatrixGroup(cmd, proj) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPMATRIXGROUP_V1, 24, 0), \
|
||||
PARAM(1, 8, 0) | PARAM(proj, 1, 8) \
|
||||
)
|
||||
|
||||
#define gEXPopMatrixGroupN(cmd, proj, count) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPMATRIXGROUP_V1, 24, 0), \
|
||||
PARAM(count, 8, 0) | PARAM(proj, 1, 8) \
|
||||
)
|
||||
|
||||
#define gEXForceUpscale2D(cmd, force) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_FORCEUPSCALE2D_V1, 24, 0), \
|
||||
PARAM(force, 1, 0) \
|
||||
)
|
||||
|
||||
#define gEXForceTrueBilerp(cmd, mode) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_FORCETRUEBILERP_V1, 24, 0), \
|
||||
PARAM(mode, 2, 0) \
|
||||
)
|
||||
|
||||
#define gEXForceScaleLOD(cmd, force) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_FORCESCALELOD_V1, 24, 0), \
|
||||
PARAM(force, 1, 0) \
|
||||
)
|
||||
|
||||
#define gEXForceBranch(cmd, force) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_FORCEBRANCH_V1, 24, 0), \
|
||||
PARAM(force, 1, 0) \
|
||||
)
|
||||
|
||||
#define gEXSetRenderToRAM(cmd, render) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_SETRENDERTORAM_V1, 24, 0), \
|
||||
PARAM(render, 1, 0) \
|
||||
)
|
||||
|
||||
#define gEXEditGroupByAddress(cmd, address, mode, push, proj, pos, rot, scale, skew, persp, vert, tile, order) \
|
||||
G_EX_COMMAND2(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_EDITGROUPBYADDRESS_V1, 24, 0), \
|
||||
(unsigned)(address), \
|
||||
PARAM(push, 1, 0) | PARAM((proj) != 0, 1, 1) | PARAM(mode, 1, 2) | PARAM(pos, 2, 3) | PARAM(rot, 2, 5) | PARAM(scale, 2, 7) | PARAM(skew, 2, 9) | PARAM(persp, 2, 11) | PARAM(vert, 2, 13) | PARAM(tile, 2, 15) | PARAM(order, 2, 17) | PARAM(G_EX_EDIT_ALLOW, 1, 18), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXVertexV1(cmd, vtx, count, v0) \
|
||||
G_EX_COMMAND2(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_VERTEX_V1, 24, 0), \
|
||||
PARAM((v0)+(n), 7, 1) | PARAM(n, 8, 12), \
|
||||
0, \
|
||||
(unsigned)(vtx) \
|
||||
)
|
||||
|
||||
#define gEXPushViewport(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_PUSHVIEWPORT_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPopViewport(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPVIEWPORT_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPushScissor(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_PUSHSCISSOR_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPopScissor(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPSCISSOR_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPushOtherMode(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_PUSHOTHERMODE_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPopOtherMode(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPOTHERMODE_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPushCombineMode(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_PUSHCOMBINE_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPopCombineMode(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPCOMBINE_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPushProjectionMatrix(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_PUSHPROJMATRIX_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPopProjectionMatrix(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPPROJMATRIX_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPushEnvColor(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_PUSHENVCOLOR_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPopEnvColor(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPENVCOLOR_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPushBlendColor(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_PUSHBLENDCOLOR_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPopBlendColor(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPBLENDCOLOR_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPushFogColor(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_PUSHFOGCOLOR_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPopFogColor(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPFOGCOLOR_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPushFillColor(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_PUSHFILLCOLOR_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPopFillColor(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPFILLCOLOR_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPushPrimColor(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_PUSHPRIMCOLOR_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPopPrimColor(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPPRIMCOLOR_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPushGeometryMode(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_PUSHGEOMETRYMODE_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXPopGeometryMode(cmd) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_POPGEOMETRYMODE_V1, 24, 0), \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define gEXSetDitherNoiseStrength(cmd, value) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_SETDITHERNOISESTRENGTH_V1, 24, 0), \
|
||||
PARAM((value) * 1024, 16, 0) \
|
||||
)
|
||||
|
||||
#define gEXSetRDRAMExtended(cmd, isExtended) \
|
||||
G_EX_COMMAND1(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_SETRDRAMEXTENDED_V1, 24, 0), \
|
||||
PARAM(isExtended, 1, 0) \
|
||||
)
|
||||
|
||||
#endif // RT64_EXTENDED_GBI
|
||||
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "m64p_common.h"
|
||||
#include "m64p_plugin.h"
|
||||
#include "m64p_types.h"
|
||||
|
||||
#include "rt64_api_common.h"
|
||||
|
||||
namespace RT64 {
|
||||
// Global container for the application.
|
||||
APIContainer API;
|
||||
};
|
||||
|
||||
DLLEXPORT void CALL ProcessRDPList(void) {
|
||||
const RT64::Application::Core &core = RT64::API.app->core;
|
||||
uint32_t &dpcStartReg = *core.DPC_START_REG;
|
||||
uint32_t &dpcCurReg = *core.DPC_CURRENT_REG;
|
||||
uint32_t &dpcEndReg = *core.DPC_END_REG;
|
||||
uint32_t &dpcStatusReg = *core.DPC_STATUS_REG;
|
||||
bool xbus = dpcStatusReg & DP_STATUS_XBUS_DMA;
|
||||
uint8_t *memory = xbus ? core.DMEM : core.RDRAM;
|
||||
|
||||
#ifdef LOG_PLUGIN_API_CALLS
|
||||
RT64_LOG_PRINTF("ProcessRDPList() 0x%08X", dpcCurReg);
|
||||
#endif
|
||||
|
||||
dpcStatusReg &= ~DP_STATUS_FREEZE;
|
||||
RT64::API.app->processDisplayLists(memory, dpcCurReg, dpcEndReg, false);
|
||||
|
||||
// Update registers to the end.
|
||||
dpcStartReg = dpcEndReg;
|
||||
dpcCurReg = dpcEndReg;
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL ProcessDList(void) {
|
||||
const RT64::Application::Core &core = RT64::API.app->core;
|
||||
const uint8_t *DMEM = core.DMEM;
|
||||
const OSTask_t *osTask = reinterpret_cast<const OSTask_t *>(&DMEM[0x0FC0]);
|
||||
#ifdef LOG_PLUGIN_API_CALLS
|
||||
RT64_LOG_PRINTF("ProcessDList() 0x%08X", osTask->data_ptr);
|
||||
#endif
|
||||
|
||||
RT64::API.app->state->rsp->reset();
|
||||
RT64::API.app->interpreter->loadUCodeGBI(osTask->ucode, osTask->ucode_data, true);
|
||||
RT64::API.app->processDisplayLists(core.RDRAM, osTask->data_ptr, 0, true);
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL UpdateScreen(void) {
|
||||
#ifdef LOG_PLUGIN_API_CALLS
|
||||
RT64_LOG_PRINTF("UpdateScreen()");
|
||||
#endif
|
||||
RT64::API.app->updateScreen();
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL ChangeWindow(void) {
|
||||
const bool isPJ64 = (RT64::API.apiType == RT64::APIType::Project64);
|
||||
if (!isPJ64) {
|
||||
CoreVideo_ToggleFullScreen();
|
||||
} else {
|
||||
RT64::ApplicationWindow *appWindow = RT64::API.app->appWindow.get();
|
||||
appWindow->setFullScreen(!appWindow->fullScreen);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "m64p_common.h"
|
||||
#include "m64p_plugin.h"
|
||||
#include "m64p_types.h"
|
||||
#include "m64p_vidext.h"
|
||||
|
||||
// mupen64plus function pointers for the video extension functions
|
||||
extern ptr_VidExt_InitWithRenderMode CoreVideo_InitWithRenderMode;
|
||||
extern ptr_VidExt_Quit CoreVideo_Quit;
|
||||
extern ptr_VidExt_SetCaption CoreVideo_SetCaption;
|
||||
extern ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen;
|
||||
extern ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow;
|
||||
extern ptr_VidExt_VK_GetSurface CoreVideo_VK_GetSurface;
|
||||
extern ptr_VidExt_VK_GetInstanceExtensions CoreVideo_VK_GetInstanceExtensions;
|
||||
extern ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode;
|
||||
|
||||
// TODO: move this to applicationwindow?
|
||||
extern int window_width;
|
||||
extern int window_height;
|
||||
|
||||
#ifdef _WIN32
|
||||
namespace pj64 {
|
||||
// Prevent PJ64's definitions from conflicting with the implementations
|
||||
# define InitiateGFX InitiateGFXPJ64
|
||||
# define RomOpen RomOpenPJ64
|
||||
# include "project64/Video.h"
|
||||
# undef InitiateGFX
|
||||
# undef RomOpen
|
||||
};
|
||||
#endif
|
||||
|
||||
#include "hle/rt64_application.h"
|
||||
|
||||
#define DP_STATUS_XBUS_DMA 0x01
|
||||
#define DP_STATUS_FREEZE 0x02
|
||||
|
||||
typedef GFX_INFO MupenGraphicsInfo;
|
||||
#ifdef _WIN32
|
||||
typedef pj64::GFX_INFO Project64GraphicsInfo;
|
||||
#endif
|
||||
|
||||
struct PluginGraphicsInfo {
|
||||
union {
|
||||
MupenGraphicsInfo mupen64plus;
|
||||
#ifdef _WIN32
|
||||
Project64GraphicsInfo project64;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
namespace RT64 {
|
||||
enum class APIType {
|
||||
Native,
|
||||
Mupen64Plus,
|
||||
Project64,
|
||||
};
|
||||
|
||||
struct APIContainer {
|
||||
std::unique_ptr<Application> app;
|
||||
APIType apiType;
|
||||
};
|
||||
|
||||
extern APIContainer API;
|
||||
|
||||
template<typename T>
|
||||
void InitiateGFXCore(Application::Core &appCore, T info) {
|
||||
appCore.HEADER = info.HEADER;
|
||||
appCore.RDRAM = info.RDRAM;
|
||||
appCore.DMEM = info.DMEM;
|
||||
appCore.IMEM = info.IMEM;
|
||||
appCore.MI_INTR_REG = info.MI_INTR_REG;
|
||||
appCore.DPC_START_REG = info.DPC_START_REG;
|
||||
appCore.DPC_END_REG = info.DPC_END_REG;
|
||||
appCore.DPC_CURRENT_REG = info.DPC_CURRENT_REG;
|
||||
appCore.DPC_STATUS_REG = info.DPC_STATUS_REG;
|
||||
appCore.DPC_CLOCK_REG = info.DPC_CLOCK_REG;
|
||||
appCore.DPC_BUFBUSY_REG = info.DPC_BUFBUSY_REG;
|
||||
appCore.DPC_PIPEBUSY_REG = info.DPC_PIPEBUSY_REG;
|
||||
appCore.DPC_TMEM_REG = info.DPC_TMEM_REG;
|
||||
appCore.VI_STATUS_REG = info.VI_STATUS_REG;
|
||||
appCore.VI_ORIGIN_REG = info.VI_ORIGIN_REG;
|
||||
appCore.VI_WIDTH_REG = info.VI_WIDTH_REG;
|
||||
appCore.VI_INTR_REG = info.VI_INTR_REG;
|
||||
appCore.VI_V_CURRENT_LINE_REG = info.VI_V_CURRENT_LINE_REG;
|
||||
appCore.VI_TIMING_REG = info.VI_TIMING_REG;
|
||||
appCore.VI_V_SYNC_REG = info.VI_V_SYNC_REG;
|
||||
appCore.VI_H_SYNC_REG = info.VI_H_SYNC_REG;
|
||||
appCore.VI_LEAP_REG = info.VI_LEAP_REG;
|
||||
appCore.VI_H_START_REG = info.VI_H_START_REG;
|
||||
appCore.VI_V_START_REG = info.VI_V_START_REG;
|
||||
appCore.VI_V_BURST_REG = info.VI_V_BURST_REG;
|
||||
appCore.VI_X_SCALE_REG = info.VI_X_SCALE_REG;
|
||||
appCore.VI_Y_SCALE_REG = info.VI_Y_SCALE_REG;
|
||||
appCore.checkInterrupts = info.CheckInterrupts;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,267 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rt64_api_common.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include "imgui/backends/imgui_impl_sdl2.h"
|
||||
|
||||
#define PLUGIN_NAME "RT64 Video Plugin"
|
||||
#define PLUGIN_VERSION 0x020509
|
||||
#define VIDEO_PLUGIN_API_VERSION 0x020200
|
||||
#define CONFIG_API_VERSION 0x020300
|
||||
|
||||
#ifndef NDEBUG
|
||||
# define LOG_PLUGIN_API_CALLS
|
||||
#endif
|
||||
|
||||
/* definitions of pointers to Core video extension functions */
|
||||
ptr_VidExt_InitWithRenderMode CoreVideo_InitWithRenderMode = NULL;
|
||||
ptr_VidExt_Quit CoreVideo_Quit = NULL;
|
||||
ptr_VidExt_SetCaption CoreVideo_SetCaption = NULL;
|
||||
ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen = NULL;
|
||||
ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow = NULL;
|
||||
ptr_VidExt_VK_GetSurface CoreVideo_VK_GetSurface = NULL;
|
||||
ptr_VidExt_VK_GetInstanceExtensions CoreVideo_VK_GetInstanceExtensions = NULL;
|
||||
ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
#define DLSYM(a, b) GetProcAddress(a, b)
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#define DLSYM(a, b) dlsym(a, b)
|
||||
#endif
|
||||
|
||||
DLLEXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Context, void (*DebugCallback)(void *, int, const char *)) {
|
||||
CoreVideo_InitWithRenderMode = (ptr_VidExt_InitWithRenderMode)DLSYM(CoreLibHandle, "VidExt_InitWithRenderMode");
|
||||
CoreVideo_Quit = (ptr_VidExt_Quit)DLSYM(CoreLibHandle, "VidExt_Quit");
|
||||
CoreVideo_SetCaption = (ptr_VidExt_SetCaption)DLSYM(CoreLibHandle, "VidExt_SetCaption");
|
||||
CoreVideo_ToggleFullScreen = (ptr_VidExt_ToggleFullScreen)DLSYM(CoreLibHandle, "VidExt_ToggleFullScreen");
|
||||
CoreVideo_ResizeWindow = (ptr_VidExt_ResizeWindow)DLSYM(CoreLibHandle, "VidExt_ResizeWindow");
|
||||
CoreVideo_VK_GetSurface = (ptr_VidExt_VK_GetSurface)DLSYM(CoreLibHandle, "VidExt_VK_GetSurface");
|
||||
CoreVideo_VK_GetInstanceExtensions = (ptr_VidExt_VK_GetInstanceExtensions)DLSYM(CoreLibHandle, "VidExt_VK_GetInstanceExtensions");
|
||||
CoreVideo_SetVideoMode = (ptr_VidExt_SetVideoMode)DLSYM(CoreLibHandle, "VidExt_SetVideoMode");
|
||||
if (CoreVideo_InitWithRenderMode == NULL ||
|
||||
CoreVideo_Quit == NULL ||
|
||||
CoreVideo_SetCaption == NULL ||
|
||||
CoreVideo_ToggleFullScreen == NULL ||
|
||||
CoreVideo_ResizeWindow == NULL ||
|
||||
CoreVideo_VK_GetSurface == NULL ||
|
||||
CoreVideo_VK_GetInstanceExtensions == NULL ||
|
||||
CoreVideo_SetVideoMode == NULL) {
|
||||
return M64ERR_SYSTEM_FAIL;
|
||||
}
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
DLLEXPORT m64p_error CALL PluginShutdown(void) {
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
DLLEXPORT m64p_error CALL PluginGetVersion(m64p_plugin_type *PluginType, int *PluginVersion, int *APIVersion, const char **PluginNamePtr, int *Capabilities) {
|
||||
/* set version info */
|
||||
if (PluginType != NULL)
|
||||
*PluginType = M64PLUGIN_GFX;
|
||||
|
||||
if (PluginVersion != NULL)
|
||||
*PluginVersion = PLUGIN_VERSION;
|
||||
|
||||
if (APIVersion != NULL)
|
||||
*APIVersion = VIDEO_PLUGIN_API_VERSION;
|
||||
|
||||
if (PluginNamePtr != NULL)
|
||||
*PluginNamePtr = PLUGIN_NAME;
|
||||
|
||||
if (Capabilities != NULL)
|
||||
*Capabilities = 0;
|
||||
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
DLLEXPORT void CALL GetDllInfo(pj64::PLUGIN_INFO *PluginInfo) {
|
||||
PluginInfo->Version = 0x103;
|
||||
PluginInfo->Type = pj64::PLUGIN_TYPE_VIDEO;
|
||||
strncpy(PluginInfo->Name, PLUGIN_NAME, sizeof(PluginInfo->Name));
|
||||
}
|
||||
#endif
|
||||
|
||||
DLLEXPORT void CALL MoveScreen(int xpos, int ypos) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL RomClosed(void) {
|
||||
if (RT64::API.app != nullptr) {
|
||||
RT64::API.app->end();
|
||||
RT64::API.app.reset();
|
||||
}
|
||||
}
|
||||
|
||||
DLLEXPORT int CALL RomOpen(void) {
|
||||
const bool isPJ64 = (RT64::API.apiType == RT64::APIType::Project64);
|
||||
if (isPJ64) {
|
||||
RT64::ApplicationWindow *appWindow = RT64::API.app->appWindow.get();
|
||||
appWindow->makeResizable();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL ViStatusChanged(void) { }
|
||||
|
||||
DLLEXPORT void CALL ViWidthChanged(void) { }
|
||||
|
||||
DLLEXPORT int CALL InitiateGFX(PluginGraphicsInfo graphicsInfo) {
|
||||
// Determine if this is a PJ64 plugin by checking if the HWND element is actually valid.
|
||||
#ifdef _WIN32
|
||||
const bool isPJ64 = IsWindow(HWND(graphicsInfo.project64.hWnd));
|
||||
#else
|
||||
const bool isPJ64 = false;
|
||||
#endif
|
||||
if (isPJ64) {
|
||||
RT64::API.apiType = RT64::APIType::Project64;
|
||||
}
|
||||
else {
|
||||
RT64::API.apiType = RT64::APIType::Mupen64Plus;
|
||||
}
|
||||
|
||||
// Store core information in application.
|
||||
RT64::Application::Core appCore;
|
||||
appCore.window = {};
|
||||
|
||||
switch (RT64::API.apiType) {
|
||||
case RT64::APIType::Mupen64Plus:
|
||||
RT64::InitiateGFXCore<MupenGraphicsInfo>(appCore, graphicsInfo.mupen64plus);
|
||||
break;
|
||||
#ifdef _WIN32
|
||||
case RT64::APIType::Project64:
|
||||
RT64::InitiateGFXCore<Project64GraphicsInfo>(appCore, graphicsInfo.project64);
|
||||
appCore.window = RT64::RenderWindow(graphicsInfo.project64.hWnd);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Make new application with core information and set it up.
|
||||
RT64::API.app = std::make_unique<RT64::Application>(appCore, RT64::ApplicationConfiguration());
|
||||
return (RT64::API.app->setup(0) == RT64::Application::SetupResult::Success);
|
||||
}
|
||||
|
||||
int window_width = 640;
|
||||
int window_height = 480;
|
||||
|
||||
DLLEXPORT void CALL ResizeVideoOutput(int width, int height) {
|
||||
window_width = width;
|
||||
window_height = height;
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL FBRead(uint32_t addr) {
|
||||
// Unused.
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL FBWrite(uint32_t addr, uint32_t size) {
|
||||
// Unused.
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL FBGetFrameBufferInfo(void *p) {
|
||||
// Unused.
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL ShowCFB(void) {
|
||||
// Unused.
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL ReadScreen2(void *dest, int *width, int *height, int bFront) {
|
||||
// Unused.
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL SetRenderingCallback(void (*callback)(int)) {
|
||||
// Unused.
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL CaptureScreen(const char *Directory) {
|
||||
// Unused.
|
||||
}
|
||||
|
||||
// TODO: PR this to mupen64plus....
|
||||
DLLEXPORT void CALL SDL_KeyDown(int keymod, int keysym)
|
||||
{
|
||||
SDL_Event event;
|
||||
event.type = SDL_KEYDOWN;
|
||||
event.key.keysym.mod = keymod;
|
||||
event.key.keysym.sym = keysym;
|
||||
if (RT64::API.app->presentQueue->inspector != nullptr) {
|
||||
ImGui_ImplSDL2_ProcessEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL SDL_KeyUp(int keymod, int keysym)
|
||||
{
|
||||
SDL_Event event;
|
||||
event.type = SDL_KEYUP;
|
||||
event.key.keysym.mod = SDL_SCANCODE_TO_KEYCODE(keymod);
|
||||
event.key.keysym.sym = SDL_SCANCODE_TO_KEYCODE(keysym);
|
||||
|
||||
if (keysym == SDL_SCANCODE_F10)
|
||||
{
|
||||
if (RT64::API.app->userConfig.developerMode) {
|
||||
fprintf(stderr, "creating inspector...\n");
|
||||
const std::lock_guard<std::mutex> lock(RT64::API.app->presentQueue->inspectorMutex);
|
||||
if (RT64::API.app->presentQueue->inspector == nullptr) {
|
||||
RT64::API.app->presentQueue->inspector = std::make_unique<RT64::Inspector>(RT64::API.app->device.get(), RT64::API.app->swapChain.get(), RT64::API.app->createdGraphicsAPI);
|
||||
if (!RT64::API.app->userPaths.isEmpty()) {
|
||||
RT64::API.app->presentQueue->inspector->setIniPath(RT64::API.app->userPaths.imguiPath);
|
||||
}
|
||||
|
||||
RT64::API.app->freeCamClearQueued = true;
|
||||
ImGui_ImplSDL2_InitForVulkan(nullptr); // TODO: move this elsewhere...
|
||||
//appWindow->blockSdlKeyboard();
|
||||
}
|
||||
else if (RT64::API.app->presentQueue->inspector != nullptr) {
|
||||
RT64::API.app->presentQueue->inspector.reset(nullptr);
|
||||
//appWindow->unblockSdlKeyboard();
|
||||
}
|
||||
}
|
||||
else {
|
||||
fprintf(stdout, "Inspector is not available: developer mode is not enabled in the configuration.\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (RT64::API.app->presentQueue->inspector != nullptr) {
|
||||
ImGui_ImplSDL2_ProcessEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL MouseMove(int x, int y)
|
||||
{
|
||||
SDL_Event event;
|
||||
event.type = SDL_MOUSEMOTION;
|
||||
event.motion.which = 1;
|
||||
event.motion.x = x;
|
||||
event.motion.y = y;
|
||||
|
||||
if (RT64::API.app->presentQueue->inspector != nullptr) {
|
||||
//printf("MouseMove x = %i, y = %i\n", x,y);
|
||||
ImGui_ImplSDL2_ProcessEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
DLLEXPORT void CALL MouseButton(int left, int right)
|
||||
{
|
||||
if (RT64::API.app->presentQueue->inspector != nullptr) {
|
||||
printf("MouseButton left = %i\n", left);
|
||||
SDL_Event event;
|
||||
|
||||
event.type = left ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP;
|
||||
event.button.button = SDL_BUTTON_LEFT;
|
||||
ImGui_ImplSDL2_ProcessEvent(&event);
|
||||
|
||||
event.type = right ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP;
|
||||
event.button.button = SDL_BUTTON_RIGHT;
|
||||
ImGui_ImplSDL2_ProcessEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rt64_common.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
namespace RT64 {
|
||||
FILE *GlobalLogFile = nullptr;
|
||||
std::string GlobalLastError = "";
|
||||
|
||||
// FixedRect
|
||||
|
||||
FixedRect::FixedRect() {
|
||||
reset();
|
||||
}
|
||||
|
||||
FixedRect::FixedRect(int32_t ulx, int32_t uly, int32_t lrx, int32_t lry) {
|
||||
this->ulx = ulx;
|
||||
this->uly = uly;
|
||||
this->lrx = lrx;
|
||||
this->lry = lry;
|
||||
}
|
||||
|
||||
void FixedRect::reset() {
|
||||
ulx = INT32_MAX;
|
||||
uly = INT32_MAX;
|
||||
lrx = INT32_MIN;
|
||||
lry = INT32_MIN;
|
||||
}
|
||||
|
||||
bool FixedRect::isEmpty() const {
|
||||
return isNull() || (lrx == ulx) || (lry == uly);
|
||||
}
|
||||
|
||||
bool FixedRect::isNull() const {
|
||||
return (ulx > lrx) || (uly > lry);
|
||||
}
|
||||
|
||||
void FixedRect::merge(const FixedRect &rect) {
|
||||
assert(!rect.isNull());
|
||||
|
||||
ulx = std::min(ulx, rect.ulx);
|
||||
uly = std::min(uly, rect.uly);
|
||||
lrx = std::max(lrx, rect.lrx);
|
||||
lry = std::max(lry, rect.lry);
|
||||
}
|
||||
|
||||
FixedRect FixedRect::scaled(float x, float y) const {
|
||||
assert(!isNull());
|
||||
assert(x >= 0.0f);
|
||||
assert(y >= 0.0f);
|
||||
|
||||
return FixedRect(
|
||||
int32_t(floorf(left(false) * x)) << 2,
|
||||
int32_t(floorf(top(false) * y)) << 2,
|
||||
int32_t(ceilf(right(true) * x)) << 2,
|
||||
int32_t(ceilf(bottom(true) * y)) << 2
|
||||
);
|
||||
}
|
||||
|
||||
FixedRect FixedRect::intersection(const FixedRect &rect) const {
|
||||
if (!isNull() && !rect.isNull()) {
|
||||
return {
|
||||
std::max(ulx, rect.ulx),
|
||||
std::max(uly, rect.uly),
|
||||
std::min(lrx, rect.lrx),
|
||||
std::min(lry, rect.lry)
|
||||
};
|
||||
}
|
||||
else {
|
||||
return FixedRect();
|
||||
}
|
||||
}
|
||||
|
||||
bool FixedRect::fullyInside(const FixedRect &rect) const {
|
||||
assert(!isNull());
|
||||
assert(!rect.isNull());
|
||||
return (rect.ulx >= ulx) && (rect.uly >= uly) && (rect.lrx <= lrx) && (rect.lry <= lry);
|
||||
}
|
||||
|
||||
int32_t FixedRect::left(bool ceil) const {
|
||||
assert(!isNull());
|
||||
return (ulx + (ceil ? 3 : 0)) >> 2;
|
||||
}
|
||||
|
||||
int32_t FixedRect::top(bool ceil) const {
|
||||
assert(!isNull());
|
||||
return (uly + (ceil ? 3 : 0)) >> 2;
|
||||
}
|
||||
|
||||
int32_t FixedRect::right(bool ceil) const {
|
||||
assert(!isNull());
|
||||
return (lrx + (ceil ? 3 : 0)) >> 2;
|
||||
}
|
||||
|
||||
int32_t FixedRect::bottom(bool ceil) const {
|
||||
assert(!isNull());
|
||||
return (lry + (ceil ? 3 : 0)) >> 2;
|
||||
}
|
||||
|
||||
int32_t FixedRect::width(bool leftCeil, bool rightCeil) const {
|
||||
assert(!isNull());
|
||||
return right(rightCeil) - left(leftCeil);
|
||||
}
|
||||
|
||||
int32_t FixedRect::height(bool topCeil, bool bottomCeil) const {
|
||||
assert(!isNull());
|
||||
return bottom(bottomCeil) - top(topCeil);
|
||||
}
|
||||
|
||||
// FixedMatrix
|
||||
|
||||
float FixedMatrix::toFloat(uint32_t i, uint32_t j) const {
|
||||
const int xorJ = j ^ 1;
|
||||
return FixedMatrix::fixedToFloat(integer[i][xorJ], frac[i][xorJ]);
|
||||
}
|
||||
|
||||
hlslpp::float4x4 FixedMatrix::toMatrix4x4() const {
|
||||
return hlslpp::float4x4(
|
||||
toFloat(0, 0), toFloat(0, 1), toFloat(0, 2), toFloat(0, 3),
|
||||
toFloat(1, 0), toFloat(1, 1), toFloat(1, 2), toFloat(1, 3),
|
||||
toFloat(2, 0), toFloat(2, 1), toFloat(2, 2), toFloat(2, 3),
|
||||
toFloat(3, 0), toFloat(3, 1), toFloat(3, 2), toFloat(3, 3)
|
||||
);
|
||||
}
|
||||
|
||||
float FixedMatrix::fixedToFloat(int16_t integerValue, uint16_t fracValue) {
|
||||
const uint32_t fullWord = (uint32_t(integerValue) << 16) | fracValue;
|
||||
return int32_t(fullWord) / 65536.0f;
|
||||
}
|
||||
|
||||
void FixedMatrix::modifyMatrix4x4Integer(hlslpp::float4x4 &matrix, uint32_t i, uint32_t j, int16_t value) {
|
||||
const int32_t fixedValue = int32_t(matrix[i][j] * 65536.0f);
|
||||
matrix[i][j] = fixedToFloat(value, uint16_t(fixedValue & 0xFFFFU));
|
||||
}
|
||||
|
||||
void FixedMatrix::modifyMatrix4x4Fraction(hlslpp::float4x4 &matrix, uint32_t i, uint32_t j, uint16_t value) {
|
||||
const int32_t fixedValue = int32_t(matrix[i][j] * 65536.0f);
|
||||
matrix[i][j] = fixedToFloat(int16_t((fixedValue >> 16) & 0xFFFF), value);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,125 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "rt64_hlslpp.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# define DLLEXPORT extern "C" __declspec(dllexport)
|
||||
#else
|
||||
# define DLLEXPORT extern "C" __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
namespace RT64 {
|
||||
enum class UpscaleMode {
|
||||
Bilinear,
|
||||
FSR,
|
||||
DLSS,
|
||||
XeSS
|
||||
};
|
||||
|
||||
static const unsigned int DepthRayQueryMask = 0x1;
|
||||
static const unsigned int NoDepthRayQueryMask = 0x2;
|
||||
static const unsigned int ShadowCatcherRayQueryMask = 0x4;
|
||||
|
||||
// Error string for last error or exception that was caught.
|
||||
extern std::string GlobalLastError;
|
||||
|
||||
#ifdef NDEBUG
|
||||
# define RT64_LOG_OPEN(x)
|
||||
# define RT64_LOG_CLOSE()
|
||||
# define RT64_LOG_PRINTF(x, ...)
|
||||
#else
|
||||
extern FILE *GlobalLogFile;
|
||||
# ifdef _WIN32
|
||||
# define RT64_LOG_OPEN(x) do { RT64::GlobalLogFile = _wfopen(x, L"wt"); } while (0)
|
||||
# else
|
||||
# define RT64_LOG_OPEN(x) do { RT64::GlobalLogFile = fopen(x, "w"); } while (0)
|
||||
# endif
|
||||
# define RT64_LOG_CLOSE() do { fclose(RT64::GlobalLogFile); } while (0)
|
||||
# define RT64_LOG_PRINTF(x, ...) do { fprintf(RT64::GlobalLogFile, x, ## __VA_ARGS__); fprintf(RT64::GlobalLogFile, "\n"); fflush(RT64::GlobalLogFile); } while (0)
|
||||
# define RT64_LOG_PRINTF_DETAILED(x, ...) do { fprintf(RT64::GlobalLogFile, x, ## __VA_ARGS__); fprintf(RT64::GlobalLogFile, " (%s in %s:%d)\n", __FUNCTION__, __FILE__, __LINE__); fflush(RT64::GlobalLogFile); } while (0)
|
||||
#endif
|
||||
|
||||
inline void CalculateTextureRowWidthPadding(uint32_t rowPitch, uint32_t &rowWidth, uint32_t &rowPadding) {
|
||||
const int RowMultiple = 256;
|
||||
rowWidth = rowPitch;
|
||||
rowPadding = (rowWidth % RowMultiple) ? RowMultiple - (rowWidth % RowMultiple) : 0;
|
||||
rowWidth += rowPadding;
|
||||
}
|
||||
|
||||
inline float HaltonSequence(int i, int b) {
|
||||
float f = 1.0;
|
||||
float r = 0.0;
|
||||
while (i > 0) {
|
||||
f = f / float(b);
|
||||
r = r + f * float(i % b);
|
||||
i = i / b;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
inline hlslpp::float2 HaltonJitter(int frame, int phases) {
|
||||
return { HaltonSequence(frame % phases + 1, 2) - 0.5f, HaltonSequence(frame % phases + 1, 3) - 0.5f };
|
||||
}
|
||||
|
||||
struct RectI {
|
||||
int x, y, w, h;
|
||||
};
|
||||
|
||||
struct FixedRect {
|
||||
int32_t ulx;
|
||||
int32_t uly;
|
||||
int32_t lrx;
|
||||
int32_t lry;
|
||||
|
||||
FixedRect();
|
||||
FixedRect(int32_t ulx, int32_t uly, int32_t lrx, int32_t lry);
|
||||
void reset();
|
||||
bool isEmpty() const;
|
||||
bool isNull() const;
|
||||
void merge(const FixedRect &rect);
|
||||
FixedRect scaled(float x, float y) const;
|
||||
|
||||
// Intersections can result in invalid rects if they don't overlap. Check if they're not null after using this.
|
||||
FixedRect intersection(const FixedRect &rect) const;
|
||||
bool fullyInside(const FixedRect &rect) const;
|
||||
int32_t left(bool ceil) const;
|
||||
int32_t top(bool ceil) const;
|
||||
int32_t right(bool ceil) const;
|
||||
int32_t bottom(bool ceil) const;
|
||||
int32_t width(bool leftCeil, bool rightCeil) const;
|
||||
int32_t height(bool topCeil, bool bottomCeil) const;
|
||||
};
|
||||
|
||||
struct FixedMatrix {
|
||||
int16_t integer[4][4];
|
||||
uint16_t frac[4][4];
|
||||
|
||||
float toFloat(uint32_t i, uint32_t j) const;
|
||||
hlslpp::float4x4 toMatrix4x4() const;
|
||||
|
||||
static float fixedToFloat(int16_t integerValue, uint16_t fracValue);
|
||||
static void modifyMatrix4x4Integer(hlslpp::float4x4 &matrix, uint32_t i, uint32_t j, int16_t integerValue);
|
||||
static void modifyMatrix4x4Fraction(hlslpp::float4x4 &matrix, uint32_t i, uint32_t j, uint16_t fracValue);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
void adjustVector(std::vector<T> &vector, size_t expectedSize) {
|
||||
if (vector.capacity() < expectedSize) {
|
||||
vector.reserve(expectedSize * 2);
|
||||
}
|
||||
|
||||
if (vector.size() < expectedSize) {
|
||||
vector.resize(expectedSize);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rt64_dynamic_libraries.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <filesystem>
|
||||
|
||||
#if defined(_WIN32)
|
||||
# include <Windows.h>
|
||||
# include "utf8conv/utf8conv.h"
|
||||
#endif
|
||||
|
||||
namespace RT64 {
|
||||
typedef std::pair<std::string, bool> NameRequiredPair;
|
||||
|
||||
const auto DynamicLibraryList = {
|
||||
NameRequiredPair("dxil.dll", true),
|
||||
NameRequiredPair("dxcompiler.dll", true),
|
||||
# if DLSS_ENABLED
|
||||
NameRequiredPair("nvngx_dlss.dll", false),
|
||||
# endif
|
||||
};
|
||||
|
||||
void LocalFunction() { }
|
||||
|
||||
// DynamicLibraries
|
||||
|
||||
bool DynamicLibraries::load() {
|
||||
# if defined(_WIN32)
|
||||
HMODULE moduleHandle = nullptr;
|
||||
if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, LPCWSTR(LocalFunction), &moduleHandle)) {
|
||||
fprintf(stderr, "GetModuleHandleExW failed with error code 0x%X\n", GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
WCHAR modulePath[FILENAME_MAX];
|
||||
DWORD modulePathSz = GetModuleFileNameW(moduleHandle, modulePath, sizeof(modulePath));
|
||||
if ((modulePathSz == 0) || (modulePathSz >= sizeof(modulePath))) {
|
||||
fprintf(stderr, "GetModuleFileNameW failed with error code 0x%X\n", GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Extract the directory from the module path.
|
||||
std::filesystem::path fullPath(modulePath);
|
||||
fullPath.remove_filename();
|
||||
|
||||
const std::wstring fullPathStr = fullPath.wstring();
|
||||
for (const NameRequiredPair &pair : DynamicLibraryList) {
|
||||
const std::wstring libraryPath = fullPathStr + win32::Utf8ToUtf16(pair.first);
|
||||
HMODULE libraryModule = LoadLibraryW(libraryPath.c_str());
|
||||
if (pair.second && (libraryModule == nullptr)) {
|
||||
fprintf(stderr, "LoadLibraryW with path %ls failed with error code 0x%X\n", libraryPath.c_str(), GetLastError());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rt64_timer.h"
|
||||
|
||||
namespace RT64 {
|
||||
struct DynamicLibraries {
|
||||
static bool load();
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rt64_elapsed_timer.h"
|
||||
|
||||
namespace RT64 {
|
||||
// ElapsedTimer
|
||||
|
||||
ElapsedTimer::ElapsedTimer() {
|
||||
reset();
|
||||
}
|
||||
|
||||
void ElapsedTimer::reset() {
|
||||
startTime = Timer::current();
|
||||
}
|
||||
|
||||
int64_t ElapsedTimer::elapsedMicroseconds() const {
|
||||
return Timer::deltaMicroseconds(startTime, Timer::current());
|
||||
}
|
||||
|
||||
double ElapsedTimer::elapsedMilliseconds() const {
|
||||
return static_cast<double>(elapsedMicroseconds()) / 1000.0;
|
||||
}
|
||||
|
||||
double ElapsedTimer::elapsedSeconds() const {
|
||||
return static_cast<double>(elapsedMicroseconds()) / 1000000.0;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rt64_timer.h"
|
||||
|
||||
namespace RT64 {
|
||||
struct ElapsedTimer {
|
||||
Timestamp startTime;
|
||||
|
||||
ElapsedTimer();
|
||||
void reset();
|
||||
int64_t elapsedMicroseconds() const;
|
||||
double elapsedMilliseconds() const;
|
||||
double elapsedSeconds() const;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rt64_emulator_configuration.h"
|
||||
|
||||
namespace RT64 {
|
||||
// EmulatorConfiguration
|
||||
|
||||
EmulatorConfiguration::EmulatorConfiguration() {
|
||||
dither.postBlendNoise = true;
|
||||
framebuffer.renderToRAM = true;
|
||||
framebuffer.copyWithGPU = true;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rt64_common.h"
|
||||
|
||||
namespace RT64 {
|
||||
struct EmulatorConfiguration {
|
||||
struct Dither {
|
||||
bool postBlendNoise;
|
||||
};
|
||||
|
||||
struct Framebuffer {
|
||||
bool renderToRAM;
|
||||
bool copyWithGPU;
|
||||
};
|
||||
|
||||
Dither dither;
|
||||
Framebuffer framebuffer;
|
||||
|
||||
EmulatorConfiguration();
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rt64_enhancement_configuration.h"
|
||||
|
||||
namespace RT64 {
|
||||
// EnhancementConfiguration
|
||||
|
||||
EnhancementConfiguration::EnhancementConfiguration() {
|
||||
framebuffer.reinterpretFixULS = true;
|
||||
presentation.mode = Presentation::Mode::SkipBuffering;
|
||||
rect.fixRectLR = true;
|
||||
f3dex.forceBranch = false;
|
||||
s2dex.fixBilerpMismatch = true;
|
||||
s2dex.framebufferFastPath = true;
|
||||
textureLOD.scale = false;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rt64_common.h"
|
||||
|
||||
namespace RT64 {
|
||||
struct EnhancementConfiguration {
|
||||
struct Framebuffer {
|
||||
bool reinterpretFixULS;
|
||||
};
|
||||
|
||||
struct Presentation {
|
||||
enum class Mode {
|
||||
Console,
|
||||
SkipBuffering,
|
||||
PresentEarly
|
||||
};
|
||||
|
||||
Mode mode;
|
||||
};
|
||||
|
||||
struct Rect {
|
||||
bool fixRectLR;
|
||||
};
|
||||
|
||||
struct F3DEX {
|
||||
bool forceBranch;
|
||||
};
|
||||
|
||||
struct S2DEX {
|
||||
bool fixBilerpMismatch;
|
||||
bool framebufferFastPath;
|
||||
};
|
||||
|
||||
struct TextureLOD {
|
||||
bool scale;
|
||||
};
|
||||
|
||||
Framebuffer framebuffer;
|
||||
Presentation presentation;
|
||||
Rect rect;
|
||||
F3DEX f3dex;
|
||||
S2DEX s2dex;
|
||||
TextureLOD textureLOD;
|
||||
|
||||
EnhancementConfiguration();
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
// Disable SIMD on GCC due to UB when compiling with optimizations.
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
|
||||
#define HLSLPP_SCALAR
|
||||
#endif
|
||||
|
||||
#include "hlsl++.h"
|
||||
@@ -0,0 +1,491 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rt64_math.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
|
||||
namespace RT64 {
|
||||
float sqr(float x) {
|
||||
return x * x;
|
||||
}
|
||||
|
||||
bool matrixIsNaN(const hlslpp::float4x4 &m) {
|
||||
for (uint32_t i = 0; i < 4; i++) {
|
||||
if (hlslpp::any(hlslpp::isnan(m[i]))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
hlslpp::float4x4 matrixScale(float scale) {
|
||||
hlslpp::float4x4 scaleMatrix(0.0f);
|
||||
scaleMatrix[0][0] = scale;
|
||||
scaleMatrix[1][1] = scale;
|
||||
scaleMatrix[2][2] = scale;
|
||||
scaleMatrix[3][3] = 1.0f;
|
||||
return scaleMatrix;
|
||||
}
|
||||
|
||||
hlslpp::float4x4 matrixScale(const hlslpp::float3& scale) {
|
||||
hlslpp::float4x4 scaleMatrix(0.0f);
|
||||
scaleMatrix[0][0] = scale.x;
|
||||
scaleMatrix[1][1] = scale.y;
|
||||
scaleMatrix[2][2] = scale.z;
|
||||
scaleMatrix[3][3] = 1.0f;
|
||||
return scaleMatrix;
|
||||
}
|
||||
|
||||
void matrixDecomposeViewProj(const hlslpp::float4x4 &vp, hlslpp::float4x4 &v, hlslpp::float4x4 &p) {
|
||||
v = hlslpp::float4x4::identity();
|
||||
p = hlslpp::float4x4::identity();
|
||||
|
||||
p[2][3] = -1.0f;
|
||||
p[3][3] = 0.0f;
|
||||
v[0][2] = -vp[0][3];
|
||||
v[1][2] = -vp[1][3];
|
||||
v[2][2] = -vp[2][3];
|
||||
v[3][2] = -vp[3][3];
|
||||
|
||||
p[2][2] = vp[0][2] / v[0][2];
|
||||
p[3][2] = vp[3][2] - p[2][2] * v[3][2];
|
||||
|
||||
p[0][0] = sqrtf(sqr(vp[0][0]) + sqr(vp[1][0]) + sqr(vp[2][0]));
|
||||
p[1][1] = sqrtf(sqr(vp[0][1]) + sqr(vp[1][1]) + sqr(vp[2][1]));
|
||||
|
||||
v[0][0] = vp[0][0] / p[0][0];
|
||||
v[1][0] = vp[1][0] / p[0][0];
|
||||
v[2][0] = vp[2][0] / p[0][0];
|
||||
v[3][0] = vp[3][0] / p[0][0];
|
||||
|
||||
v[0][1] = vp[0][1] / p[1][1];
|
||||
v[1][1] = vp[1][1] / p[1][1];
|
||||
v[2][1] = vp[2][1] / p[1][1];
|
||||
v[3][1] = vp[3][1] / p[1][1];
|
||||
|
||||
if (matrixIsNaN(v) || matrixIsNaN(p)) {
|
||||
v = hlslpp::float4x4::identity();
|
||||
p = vp;
|
||||
}
|
||||
}
|
||||
|
||||
hlslpp::float4x4 matrixTranslation(const hlslpp::float3 &t) {
|
||||
hlslpp::float4x4 m = hlslpp::float4x4::identity();
|
||||
m[3].xyz = t;
|
||||
return m;
|
||||
}
|
||||
|
||||
hlslpp::float3x3 matrixRotationX(float rad) {
|
||||
hlslpp::float3x3 m = hlslpp::float3x3::identity();
|
||||
const float rollCos = cos(rad);
|
||||
const float rollSin = sin(rad);
|
||||
m[0][0] = rollCos;
|
||||
m[0][1] = -rollSin;
|
||||
m[1][0] = rollSin;
|
||||
m[1][1] = rollCos;
|
||||
return m;
|
||||
}
|
||||
|
||||
hlslpp::float3x3 matrixRotationY(float rad) {
|
||||
hlslpp::float3x3 m = hlslpp::float3x3::identity();
|
||||
const float pitchCos = cos(rad);
|
||||
const float pitchSin = sin(rad);
|
||||
m[0][0] = pitchCos;
|
||||
m[0][2] = pitchSin;
|
||||
m[2][0] = -pitchSin;
|
||||
m[2][2] = pitchCos;
|
||||
return m;
|
||||
}
|
||||
|
||||
hlslpp::float3x3 matrixRotationZ(float rad) {
|
||||
hlslpp::float3x3 m = hlslpp::float3x3::identity();
|
||||
const float yawCos = cos(rad);
|
||||
const float yawSin = sin(rad);
|
||||
m[1][1] = yawCos;
|
||||
m[1][2] = -yawSin;
|
||||
m[2][1] = yawSin;
|
||||
m[2][2] = yawCos;
|
||||
return m;
|
||||
}
|
||||
|
||||
hlslpp::float3x3 extract3x3(const hlslpp::float4x4 &m) {
|
||||
return hlslpp::float3x3(
|
||||
m[0][0], m[0][1], m[0][2],
|
||||
m[1][0], m[1][1], m[1][2],
|
||||
m[2][0], m[2][1], m[2][2]
|
||||
);
|
||||
}
|
||||
|
||||
hlslpp::float3x3 rotationFrom3x3(const hlslpp::float3x3 &m) {
|
||||
return hlslpp::float3x3(hlslpp::normalize(m[0]), hlslpp::normalize(m[1]), hlslpp::normalize(m[2]));
|
||||
}
|
||||
|
||||
float traceFrom3x3(const hlslpp::float3x3 &m) {
|
||||
return m[0][0] + m[1][1] + m[2][2];
|
||||
}
|
||||
|
||||
float matrixDifference(const hlslpp::float4x4 &a, const hlslpp::float4x4 &b) {
|
||||
float difference = 0.0f;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
difference += hlslpp::dot(hlslpp::abs(a[i] - b[i]), 1.0f);
|
||||
}
|
||||
|
||||
return difference;
|
||||
}
|
||||
|
||||
bool isMatrixAffine(const hlslpp::float4x4 &m) {
|
||||
return (m[0][3] == 0.0f) && (m[1][3] == 0.0f) && (m[2][3] == 0.0f) && (m[3][3] == 1.0f);
|
||||
}
|
||||
|
||||
bool isMatrixIdentity(const hlslpp::float4x4 &m) {
|
||||
return hlslpp::all(m == hlslpp::float4x4::identity());
|
||||
}
|
||||
|
||||
bool isMatrixViewProj(const hlslpp::float4x4 &m) {
|
||||
return (abs(m[3][3]) >= 1e-6f) && (abs(1.0f - m[3][3]) >= 1e-6f);
|
||||
}
|
||||
|
||||
hlslpp::float4x4 lerpMatrix(const hlslpp::float4x4 &a, const hlslpp::float4x4 &b, float t) {
|
||||
// Copy b into the result.
|
||||
hlslpp::float4x4 c = b;
|
||||
|
||||
// Replace with a component-wise linear interpolation between a and b.
|
||||
for (int i = 0; i < 4; i++) {
|
||||
c[i] = hlslpp::lerp(a[i], b[i], t);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
hlslpp::float4x4 lerpMatrix3x3(const hlslpp::float4x4 &a, const hlslpp::float4x4 &b, float t) {
|
||||
// Copy b into the result.
|
||||
hlslpp::float4x4 c = b;
|
||||
|
||||
// Replace the result's top left 3x3 with a component-wise linear interpolation between a and b.
|
||||
for (int i = 0; i < 3; i++) {
|
||||
c[i].xyz = hlslpp::lerp(a[i].xyz, b[i].xyz, t);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
hlslpp::float4x4 lerpMatrixComponents(const hlslpp::float4x4 &a, const hlslpp::float4x4 &b, bool linear, bool angular, bool perspective, float t) {
|
||||
hlslpp::float4x4 ret;
|
||||
// Start by either component-wise lerping the top left 3x3 if rotation is enabled or directly copying it otherwise.
|
||||
// This leaves the last row and last column as a copy of b's in either case.
|
||||
if (angular) {
|
||||
ret = lerpMatrix3x3(a, b, t);
|
||||
}
|
||||
else {
|
||||
ret = b;
|
||||
}
|
||||
// Next, lerp the translation component of the last row if enabled, otherwise leave it intact from the initial copy step.
|
||||
if (linear) {
|
||||
ret[3].xyz = lerp(a[3].xyz, b[3].xyz, t);
|
||||
}
|
||||
// Finally, do the same for the last column if perspective is enabled.
|
||||
if (perspective) {
|
||||
ret[0].w = lerp(a[0].w, b[0].w, t);
|
||||
ret[1].w = lerp(a[1].w, b[1].w, t);
|
||||
ret[2].w = lerp(a[2].w, b[2].w, t);
|
||||
ret[3].w = lerp(a[3].w, b[3].w, t);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
float nearPlaneFromProj(const hlslpp::float4x4 &m) {
|
||||
return std::max((m[3][3] + m[3][2]) / (m[2][2] + m[2][3]), 1e-5f);
|
||||
}
|
||||
|
||||
float farPlaneFromProj(const hlslpp::float4x4 &m) {
|
||||
return std::max((m[3][2] - m[3][3]) / (m[2][2] - m[2][3]), 1e-4f);
|
||||
}
|
||||
|
||||
float fovFromProj(const hlslpp::float4x4 &m) {
|
||||
return std::max(2.0f * atanf(-m[2][3] / m[1][1]), 1e-2f);
|
||||
}
|
||||
|
||||
float pseudoRandom(uint32_t &s) {
|
||||
s = 1664525u * s + 1013904223u;
|
||||
return float(s & 0x00FFFFFF) / float(0x01000000);
|
||||
}
|
||||
|
||||
inline hlslpp::float2 barycentricCoordinates(const hlslpp::float2 p, const hlslpp::float2 a, const hlslpp::float2 b, const hlslpp::float2 c) {
|
||||
float area = -b.y * c.x + a.y * (c.x - b.x) + a.x * (b.y - c.y) + b.x * c.y;
|
||||
float s = (a.y * c.x - a.x * c.y + (c.y - a.y) * p.x + (a.x - c.x) * p.y) / area;
|
||||
float t = (a.x * b.y - a.y * b.x + (a.y - b.y) * p.x + (b.x - a.x) * p.y) / area;
|
||||
return { s, t };
|
||||
}
|
||||
|
||||
bool epsilonEqual(float a, float b) {
|
||||
return abs(a - b) < std::numeric_limits<float>::epsilon();
|
||||
}
|
||||
|
||||
// Adapted from https://github.com/g-truc/glm/blob/master/glm/gtx/matrix_decompose.inl
|
||||
/// Make a linear combination of two vectors and return the result.
|
||||
// result = (a * ascl) + (b * bscl)
|
||||
hlslpp::float3 vecCombine(
|
||||
const hlslpp::float3& a,
|
||||
const hlslpp::float3& b,
|
||||
float ascl, float bscl)
|
||||
{
|
||||
return (a * ascl) + (b * bscl);
|
||||
}
|
||||
|
||||
hlslpp::float3 vecScale(const hlslpp::float3& v, float desiredLength)
|
||||
{
|
||||
return v * desiredLength / length(v);
|
||||
}
|
||||
|
||||
bool decomposeMatrix(const hlslpp::float4x4& mtx, hlslpp::quaternion& rotation, hlslpp::float3& scale, hlslpp::float3& skew,
|
||||
hlslpp::float3& translation, hlslpp::float4& perspective)
|
||||
{
|
||||
hlslpp::float4x4 LocalMatrix(mtx);
|
||||
|
||||
// Normalize the matrix.
|
||||
if(epsilonEqual(LocalMatrix[3][3], 0.0f)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < 4; i++) {
|
||||
for(size_t j = 0; j < 4; j++) {
|
||||
LocalMatrix[i][j] /= LocalMatrix[3][3];
|
||||
}
|
||||
}
|
||||
|
||||
// perspectiveMatrix is used to solve for perspective, but it also provides
|
||||
// an easy way to test for singularity of the upper 3x3 component.
|
||||
hlslpp::float4x4 PerspectiveMatrix(LocalMatrix);
|
||||
|
||||
for(size_t i = 0; i < 3; i++) {
|
||||
PerspectiveMatrix[i][3] = 0.0f;
|
||||
}
|
||||
PerspectiveMatrix[3][3] = 1.0f;
|
||||
|
||||
/// TODO: Fixme!
|
||||
if(epsilonEqual(determinant(PerspectiveMatrix), 0.0f)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// First, isolate perspective. This is the messiest.
|
||||
if(
|
||||
!epsilonEqual(LocalMatrix[0][3], 0.0f) ||
|
||||
!epsilonEqual(LocalMatrix[1][3], 0.0f) ||
|
||||
!epsilonEqual(LocalMatrix[2][3], 0.0f))
|
||||
{
|
||||
// rightHandSide is the right hand side of the equation.
|
||||
hlslpp::float4 RightHandSide;
|
||||
RightHandSide[0] = LocalMatrix[0][3];
|
||||
RightHandSide[1] = LocalMatrix[1][3];
|
||||
RightHandSide[2] = LocalMatrix[2][3];
|
||||
RightHandSide[3] = LocalMatrix[3][3];
|
||||
|
||||
// Solve the equation by inverting PerspectiveMatrix and multiplying
|
||||
// rightHandSide by the inverse. (This is the easiest way, not
|
||||
// necessarily the best.)
|
||||
hlslpp::float4x4 InversePerspectiveMatrix = inverse(PerspectiveMatrix);
|
||||
hlslpp::float4x4 TransposedInversePerspectiveMatrix = transpose(InversePerspectiveMatrix);
|
||||
|
||||
perspective = hlslpp::mul(TransposedInversePerspectiveMatrix, RightHandSide);
|
||||
|
||||
// Clear the perspective partition
|
||||
LocalMatrix[0][3] = LocalMatrix[1][3] = LocalMatrix[2][3] = 0.0f;
|
||||
LocalMatrix[3][3] = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No perspective.
|
||||
perspective = hlslpp::float4{0, 0, 0, 1.0f};
|
||||
}
|
||||
|
||||
// Next take care of translation (easy).
|
||||
translation = hlslpp::float3(LocalMatrix[3].xyz);
|
||||
LocalMatrix[3] = hlslpp::float4(0, 0, 0, LocalMatrix[3].w);
|
||||
|
||||
hlslpp::float3 Row[3], Pdum3;
|
||||
|
||||
// Now get scale and shear.
|
||||
for(size_t i = 0; i < 3; ++i) {
|
||||
for(size_t j = 0; j < 3; ++j) {
|
||||
Row[i][j] = LocalMatrix[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
// Compute X scale factor and normalize first row.
|
||||
scale.x = length(Row[0]);// v3Length(Row[0]);
|
||||
|
||||
Row[0] = vecScale(Row[0], 1.0f);
|
||||
|
||||
// Compute XY shear factor and make 2nd row orthogonal to 1st.
|
||||
skew.z = dot(Row[0], Row[1]);
|
||||
Row[1] = vecCombine(Row[1], Row[0], 1.0f, -skew.z);
|
||||
|
||||
// Now, compute Y scale and normalize 2nd row.
|
||||
scale.y = length(Row[1]);
|
||||
Row[1] = vecScale(Row[1], 1.0f);
|
||||
skew.z /= scale.y;
|
||||
|
||||
// Compute XZ and YZ shears, orthogonalize 3rd row.
|
||||
skew.y = dot(Row[0], Row[2]);
|
||||
Row[2] = vecCombine(Row[2], Row[0], 1.0f, -skew.y);
|
||||
skew.x = dot(Row[1], Row[2]);
|
||||
Row[2] = vecCombine(Row[2], Row[1], 1.0f, -skew.x);
|
||||
|
||||
// Next, get Z scale and normalize 3rd row.
|
||||
scale.z = length(Row[2]);
|
||||
Row[2] = vecScale(Row[2], 1.0f);
|
||||
skew.y /= scale.z;
|
||||
skew.x /= scale.z;
|
||||
|
||||
// At this point, the matrix (in rows[]) is orthonormal.
|
||||
// Check for a coordinate system flip. If the determinant
|
||||
// is -1, then negate the matrix and the scaling factors.
|
||||
Pdum3 = cross(Row[1], Row[2]);
|
||||
if(dot(Row[0], Pdum3).x < 0.0f) {
|
||||
for(size_t i = 0; i < 3; i++) {
|
||||
scale[i] *= -1.0f;
|
||||
Row[i] *= -1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Now, get the rotations out, as described in the gem.
|
||||
int i, j, k = 0;
|
||||
float root, trace = Row[0].x + Row[1].y + Row[2].z;
|
||||
if(trace > 0.0f)
|
||||
{
|
||||
root = sqrt(trace + 1.0f);
|
||||
rotation.w = 0.5f * root;
|
||||
root = 0.5f / root;
|
||||
rotation.x = root * (Row[1].z - Row[2].y);
|
||||
rotation.y = root * (Row[2].x - Row[0].z);
|
||||
rotation.z = root * (Row[0].y - Row[1].x);
|
||||
} // End if > 0
|
||||
else
|
||||
{
|
||||
static int Next[3] = {1, 2, 0};
|
||||
i = 0;
|
||||
if(Row[1].y > Row[0].x) i = 1;
|
||||
if(Row[2].z > Row[i][i]) i = 2;
|
||||
j = Next[i];
|
||||
k = Next[j];
|
||||
|
||||
root = sqrt(Row[i][i] - Row[j][j] - Row[k][k] + 1.0f);
|
||||
|
||||
rotation.f32[i] = 0.5f * root;
|
||||
root = 0.5f / root;
|
||||
rotation.f32[j] = root * (Row[i][j] + Row[j][i]);
|
||||
rotation.f32[k] = root * (Row[i][k] + Row[k][i]);
|
||||
rotation.w = root * (Row[j][k] - Row[k][j]);
|
||||
} // End if <= 0
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
hlslpp::float4x4 recomposeMatrix(const hlslpp::quaternion& rotation, const hlslpp::float3& scale, const hlslpp::float3& skew,
|
||||
const hlslpp::float3& translation, const hlslpp::float4& perspective)
|
||||
{
|
||||
hlslpp::float4x4 m = hlslpp::float4x4::identity();
|
||||
|
||||
m[0][3] = perspective.x;
|
||||
m[1][3] = perspective.y;
|
||||
m[2][3] = perspective.z;
|
||||
m[3][3] = perspective.w;
|
||||
|
||||
m = mul(matrixTranslation(translation.xyz), m);
|
||||
m = mul(hlslpp::float4x4(rotation), m);
|
||||
|
||||
if (fabs(skew.x) > 0.0f) {
|
||||
hlslpp::float4x4 tmp = hlslpp::float4x4::identity();
|
||||
tmp[2][1] = skew.x;
|
||||
m = mul(tmp, m);
|
||||
}
|
||||
|
||||
if (fabs(skew.y) > 0.0f) {
|
||||
hlslpp::float4x4 tmp = hlslpp::float4x4::identity();
|
||||
tmp[2][0] = skew.y;
|
||||
m = mul(tmp, m);
|
||||
}
|
||||
|
||||
if (fabs(skew.z) > 0.0f) {
|
||||
hlslpp::float4x4 tmp = hlslpp::float4x4::identity();
|
||||
tmp[1][0] = skew.z;
|
||||
m = mul(tmp, m);
|
||||
}
|
||||
|
||||
m = mul(matrixScale(scale), m);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
DecomposedTransform::DecomposedTransform(const hlslpp::float4x4& mtx) {
|
||||
valid = decomposeMatrix(mtx, rotation, scale, skew, translation, perspective);
|
||||
}
|
||||
|
||||
DecomposedTransform lerpTransforms(const DecomposedTransform& a, const DecomposedTransform& b, float weight,
|
||||
bool lerpTranslation, bool lerpRotation, bool lerpScale, bool lerpSkew, bool lerpPerpsective, bool useSlerp)
|
||||
{
|
||||
assert(a.valid && b.valid);
|
||||
DecomposedTransform ret;
|
||||
|
||||
// Lerp the individual fields based on the provided flags.
|
||||
if (lerpTranslation) {
|
||||
ret.translation = lerp(a.translation, b.translation, weight);
|
||||
}
|
||||
else {
|
||||
ret.translation = b.translation;
|
||||
}
|
||||
|
||||
if (lerpRotation) {
|
||||
if (float(dot(a.rotation, b.rotation)) > 0.0f) {
|
||||
if (useSlerp) {
|
||||
ret.rotation = slerp(a.rotation, b.rotation, 1.0f - weight);
|
||||
}
|
||||
else {
|
||||
ret.rotation = lerp(a.rotation, b.rotation, weight);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (useSlerp) {
|
||||
ret.rotation = slerp(a.rotation, -b.rotation, 1.0f - weight);
|
||||
}
|
||||
else {
|
||||
ret.rotation = lerp(a.rotation, -b.rotation, weight);
|
||||
}
|
||||
}
|
||||
ret.rotation = normalize(ret.rotation);
|
||||
}
|
||||
else {
|
||||
ret.rotation = b.rotation;
|
||||
}
|
||||
|
||||
if (lerpScale) {
|
||||
ret.scale = lerp(a.scale, b.scale, weight);
|
||||
}
|
||||
else {
|
||||
ret.scale = b.scale;
|
||||
}
|
||||
|
||||
if (lerpSkew) {
|
||||
ret.skew = lerp(a.skew, b.skew, weight);
|
||||
}
|
||||
else {
|
||||
ret.skew = b.skew;
|
||||
}
|
||||
|
||||
if (lerpPerpsective) {
|
||||
ret.perspective = lerp(a.perspective, b.perspective, weight);
|
||||
}
|
||||
else {
|
||||
ret.perspective = b.perspective;
|
||||
}
|
||||
|
||||
// Mark the resultant transform as valid and return it.
|
||||
ret.valid = true;
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rt64_common.h"
|
||||
|
||||
namespace RT64 {
|
||||
inline constexpr uint32_t swappedOffset(uint32_t i) {
|
||||
return i ^ 3;
|
||||
}
|
||||
|
||||
float sqr(float x);
|
||||
bool matrixIsNaN(const hlslpp::float4x4 &m);
|
||||
hlslpp::float4x4 matrixScale(float scale);
|
||||
hlslpp::float4x4 matrixScale(const hlslpp::float3& scale);
|
||||
void matrixDecomposeViewProj(const hlslpp::float4x4 &vp, hlslpp::float4x4 &v, hlslpp::float4x4 &p);
|
||||
hlslpp::float4x4 matrixTranslation(const hlslpp::float3 &t);
|
||||
hlslpp::float3x3 matrixRotationX(float rad);
|
||||
hlslpp::float3x3 matrixRotationY(float rad);
|
||||
hlslpp::float3x3 matrixRotationZ(float rad);
|
||||
hlslpp::float3x3 extract3x3(const hlslpp::float4x4 &m);
|
||||
hlslpp::float3x3 rotationFrom3x3(const hlslpp::float3x3 &m);
|
||||
float traceFrom3x3(const hlslpp::float3x3 &m);
|
||||
float matrixDifference(const hlslpp::float4x4 &a, const hlslpp::float4x4 &b);
|
||||
bool isMatrixAffine(const hlslpp::float4x4 &m);
|
||||
bool isMatrixIdentity(const hlslpp::float4x4 &m);
|
||||
bool isMatrixViewProj(const hlslpp::float4x4 &m);
|
||||
hlslpp::float4x4 lerpMatrix(const hlslpp::float4x4 &a, const hlslpp::float4x4 &b, float t);
|
||||
hlslpp::float4x4 lerpMatrix3x3(const hlslpp::float4x4 &a, const hlslpp::float4x4 &b, float t);
|
||||
hlslpp::float4x4 lerpMatrixComponents(const hlslpp::float4x4 &a, const hlslpp::float4x4 &b, bool linear, bool angular, bool perspective, float t);
|
||||
float nearPlaneFromProj(const hlslpp::float4x4 &m);
|
||||
float farPlaneFromProj(const hlslpp::float4x4 &m);
|
||||
float fovFromProj(const hlslpp::float4x4 &m);
|
||||
float pseudoRandom(uint32_t &s);
|
||||
hlslpp::float2 barycentricCoordinates(const hlslpp::float2 p, const hlslpp::float2 a, const hlslpp::float2 b, const hlslpp::float2 c);
|
||||
bool decomposeMatrix(const hlslpp::float4x4& mtx, hlslpp::quaternion& rotation, hlslpp::float3& scale, hlslpp::float3& skew,
|
||||
hlslpp::float3& translation, hlslpp::float4& perspective);
|
||||
hlslpp::float4x4 recomposeMatrix(const hlslpp::quaternion& rotation, const hlslpp::float3& scale, const hlslpp::float3& skew,
|
||||
const hlslpp::float3& translation, const hlslpp::float4& perspective);
|
||||
|
||||
struct DecomposedTransform {
|
||||
hlslpp::quaternion rotation;
|
||||
hlslpp::float3 scale;
|
||||
hlslpp::float3 skew;
|
||||
hlslpp::float3 translation;
|
||||
hlslpp::float4 perspective;
|
||||
bool valid = false;
|
||||
|
||||
DecomposedTransform() = default;
|
||||
DecomposedTransform(const hlslpp::float4x4& mtx);
|
||||
};
|
||||
|
||||
DecomposedTransform lerpTransforms(const DecomposedTransform& a, const DecomposedTransform& b, float weight,
|
||||
bool lerpTranslation, bool lerpRotation, bool lerpScale, bool lerpSkew, bool lerpPerpsective, bool useSlerp);
|
||||
};
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rt64_profiling_timer.h"
|
||||
|
||||
#include <numeric>
|
||||
|
||||
namespace RT64 {
|
||||
// ProfilingTimer
|
||||
|
||||
ProfilingTimer::ProfilingTimer() {
|
||||
historyIndex = 0;
|
||||
accumulation = 0.0;
|
||||
startedTimestamp = {};
|
||||
}
|
||||
|
||||
ProfilingTimer::ProfilingTimer(size_t historySize) : ProfilingTimer() {
|
||||
setCount(historySize);
|
||||
}
|
||||
|
||||
void ProfilingTimer::setCount(size_t historyCount) {
|
||||
history.clear();
|
||||
history.resize(historyCount, 0);
|
||||
}
|
||||
|
||||
void ProfilingTimer::clear() {
|
||||
setCount(history.size());
|
||||
historyIndex = 0;
|
||||
accumulation = 0.0;
|
||||
}
|
||||
|
||||
void ProfilingTimer::reset() {
|
||||
accumulation = 0.0;
|
||||
}
|
||||
|
||||
void ProfilingTimer::start() {
|
||||
assert(startedTimestamp == Timestamp{});
|
||||
startedTimestamp = Timer::current();
|
||||
}
|
||||
|
||||
void ProfilingTimer::end() {
|
||||
assert(startedTimestamp > Timestamp{});
|
||||
accumulation += Timer::deltaMicroseconds(startedTimestamp, Timer::current()) / 1000.0;
|
||||
startedTimestamp = {};
|
||||
}
|
||||
|
||||
void ProfilingTimer::log() {
|
||||
assert(!history.empty());
|
||||
history[historyIndex] = accumulation;
|
||||
historyIndex = (historyIndex + 1) % history.size();
|
||||
}
|
||||
|
||||
void ProfilingTimer::logAndRestart() {
|
||||
if (startedTimestamp == Timestamp{}) {
|
||||
reset();
|
||||
start();
|
||||
}
|
||||
|
||||
end();
|
||||
log();
|
||||
reset();
|
||||
start();
|
||||
}
|
||||
|
||||
uint32_t ProfilingTimer::index() const {
|
||||
return historyIndex;
|
||||
}
|
||||
|
||||
size_t ProfilingTimer::size() const {
|
||||
return history.size();
|
||||
}
|
||||
|
||||
const double *ProfilingTimer::data() const {
|
||||
return history.data();
|
||||
}
|
||||
|
||||
double ProfilingTimer::average() const {
|
||||
assert(!history.empty());
|
||||
return std::accumulate(history.begin(), history.end(), 0.0) / history.size();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "rt64_elapsed_timer.h"
|
||||
|
||||
namespace RT64 {
|
||||
struct ProfilingTimer {
|
||||
std::vector<double> history;
|
||||
uint32_t historyIndex;
|
||||
double accumulation;
|
||||
Timestamp startedTimestamp;
|
||||
|
||||
ProfilingTimer();
|
||||
ProfilingTimer(size_t historyCount);
|
||||
void setCount(size_t historyCount);
|
||||
void clear();
|
||||
void reset();
|
||||
void start();
|
||||
void end();
|
||||
void log();
|
||||
|
||||
// Convenience function for logging the time between each call to it.
|
||||
void logAndRestart();
|
||||
uint32_t index() const;
|
||||
size_t size() const;
|
||||
const double *data() const;
|
||||
double average() const;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
namespace RT64 {
|
||||
struct Sommelier {
|
||||
static bool detectWine() {
|
||||
HMODULE dllHandle = GetModuleHandle("ntdll.dll");
|
||||
if (dllHandle != NULL) {
|
||||
return GetProcAddress(dllHandle, "wine_get_version") != NULL;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rt64_thread.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <thread>
|
||||
|
||||
#if defined(_WIN64)
|
||||
# include <Windows.h>
|
||||
# include "utf8conv/utf8conv.h"
|
||||
#elif defined(__linux__)
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
namespace RT64 {
|
||||
# if defined(_WIN32)
|
||||
static int toWindowsPriority(Thread::Priority priority) {
|
||||
switch (priority) {
|
||||
case Thread::Priority::Idle:
|
||||
return THREAD_PRIORITY_IDLE;
|
||||
case Thread::Priority::Lowest:
|
||||
return THREAD_PRIORITY_LOWEST;
|
||||
case Thread::Priority::Low:
|
||||
return THREAD_PRIORITY_BELOW_NORMAL;
|
||||
case Thread::Priority::Normal:
|
||||
return THREAD_PRIORITY_NORMAL;
|
||||
case Thread::Priority::High:
|
||||
return THREAD_PRIORITY_ABOVE_NORMAL;
|
||||
case Thread::Priority::Highest:
|
||||
return THREAD_PRIORITY_HIGHEST;
|
||||
default:
|
||||
assert(false && "Unknown thread priority.");
|
||||
return THREAD_PRIORITY_NORMAL;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
// Thread
|
||||
|
||||
void Thread::setCurrentThreadName(const std::string &str) {
|
||||
# if defined(_WIN32)
|
||||
std::wstring nameWide = win32::Utf8ToUtf16(str);
|
||||
SetThreadDescription(GetCurrentThread(), nameWide.c_str());
|
||||
# elif defined(__linux__)
|
||||
pthread_setname_np(pthread_self(), str.c_str());
|
||||
# elif defined(__APPLE__)
|
||||
pthread_setname_np(str.c_str());
|
||||
# else
|
||||
static_assert(false, "Unimplemented");
|
||||
# endif
|
||||
}
|
||||
|
||||
void Thread::setCurrentThreadPriority(Priority priority) {
|
||||
# if defined(_WIN32)
|
||||
SetThreadPriority(GetCurrentThread(), toWindowsPriority(priority));
|
||||
# elif defined(__linux__) || defined(__APPLE__)
|
||||
// On Linux, thread priorities can't be changed under the default scheduler policy (SCHED_OTHER) and the other policies
|
||||
// that are available without root privileges are lower priority. Instead you can set the thread's "nice" value, which ranges
|
||||
// from -20 to 19 (lower being higher priority). However, by strict POSIX spec "nice" is meant to be per-process instead of
|
||||
// per-thread. Therefore to avoid issues in case Linux is modified to match the spec in the future, this function does nothing.
|
||||
(void)priority;
|
||||
# else
|
||||
static_assert(false, "Unimplemented");
|
||||
# endif
|
||||
}
|
||||
|
||||
void Thread::sleepMilliseconds(uint32_t millis) {
|
||||
# if defined(_WIN32)
|
||||
// The implementations of std::chrono::sleep_until and sleep_for were affected by changing the system clock backwards in older versions
|
||||
// of Microsoft's STL. This was fixed as of Visual Studio 2022 17.9, but to be safe RT64 uses Win32 Sleep directly.
|
||||
Sleep(millis);
|
||||
# else
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(millis));
|
||||
# endif
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace RT64 {
|
||||
struct Thread {
|
||||
enum class Priority {
|
||||
Idle,
|
||||
Lowest,
|
||||
Low,
|
||||
Normal,
|
||||
High,
|
||||
Highest
|
||||
};
|
||||
|
||||
static void setCurrentThreadName(const std::string &str);
|
||||
static void setCurrentThreadPriority(Priority priority);
|
||||
static void sleepMilliseconds(uint32_t millis);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rt64_timer.h"
|
||||
|
||||
namespace RT64 {
|
||||
// Timer
|
||||
|
||||
void Timer::initialize() {
|
||||
}
|
||||
|
||||
Timestamp Timer::current() {
|
||||
return std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
|
||||
int64_t Timer::deltaMicroseconds(const Timestamp t1, const Timestamp t2) {
|
||||
return std::chrono::duration_cast<std::chrono::microseconds>(t2 - t1).count();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <chrono>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace RT64 {
|
||||
typedef std::chrono::high_resolution_clock::time_point Timestamp;
|
||||
|
||||
struct Timer {
|
||||
static void initialize();
|
||||
static Timestamp current();
|
||||
static int64_t deltaMicroseconds(const Timestamp t1, const Timestamp t2);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,155 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rt64_user_configuration.h"
|
||||
|
||||
#if RT64_BUILD_PLUGIN
|
||||
# include "api/rt64_api_common.h"
|
||||
#endif
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
namespace RT64 {
|
||||
#if defined(_WIN32)
|
||||
UserConfiguration::GraphicsAPI UserConfiguration::DefaultGraphicsAPI = UserConfiguration::GraphicsAPI::D3D12;
|
||||
#else
|
||||
UserConfiguration::GraphicsAPI UserConfiguration::DefaultGraphicsAPI = UserConfiguration::GraphicsAPI::Vulkan;
|
||||
#endif
|
||||
|
||||
void to_json(json &j, const UserConfiguration &cfg) {
|
||||
j["graphicsAPI"] = cfg.graphicsAPI;
|
||||
j["resolution"] = cfg.resolution;
|
||||
j["antialiasing"] = cfg.antialiasing;
|
||||
j["resolutionMultiplier"] = cfg.resolutionMultiplier;
|
||||
j["downsampleMultiplier"] = cfg.downsampleMultiplier;
|
||||
j["filtering"] = cfg.filtering;
|
||||
j["aspectRatio"] = cfg.aspectRatio;
|
||||
j["aspectTarget"] = cfg.aspectTarget;
|
||||
j["extAspectRatio"] = cfg.extAspectRatio;
|
||||
j["extAspectTarget"] = cfg.extAspectTarget;
|
||||
j["upscale2D"] = cfg.upscale2D;
|
||||
j["threePointFiltering"] = cfg.threePointFiltering;
|
||||
j["refreshRate"] = cfg.refreshRate;
|
||||
j["refreshRateTarget"] = cfg.refreshRateTarget;
|
||||
j["internalColorFormat"] = cfg.internalColorFormat;
|
||||
j["idleWorkActive"] = cfg.idleWorkActive;
|
||||
j["developerMode"] = cfg.developerMode;
|
||||
}
|
||||
|
||||
void from_json(const json &j, UserConfiguration &cfg) {
|
||||
UserConfiguration defaultCfg;
|
||||
cfg.graphicsAPI = j.value("graphicsAPI", defaultCfg.graphicsAPI);
|
||||
cfg.resolution = j.value("resolution", defaultCfg.resolution);
|
||||
cfg.antialiasing = j.value("antialiasing", defaultCfg.antialiasing);
|
||||
cfg.resolutionMultiplier = j.value("resolutionMultiplier", defaultCfg.resolutionMultiplier);
|
||||
cfg.downsampleMultiplier = j.value("downsampleMultiplier", defaultCfg.downsampleMultiplier);
|
||||
cfg.filtering = j.value("filtering", defaultCfg.filtering);
|
||||
cfg.aspectRatio = j.value("aspectRatio", defaultCfg.aspectRatio);
|
||||
cfg.aspectTarget = j.value("aspectTarget", defaultCfg.aspectTarget);
|
||||
cfg.extAspectRatio = j.value("extAspectRatio", defaultCfg.extAspectRatio);
|
||||
cfg.extAspectTarget = j.value("extAspectTarget", defaultCfg.extAspectTarget);
|
||||
cfg.upscale2D = j.value("upscale2D", defaultCfg.upscale2D);
|
||||
cfg.threePointFiltering = j.value("threePointFiltering", defaultCfg.threePointFiltering);
|
||||
cfg.refreshRate = j.value("refreshRate", defaultCfg.refreshRate);
|
||||
cfg.refreshRateTarget = j.value("refreshRateTarget", defaultCfg.refreshRateTarget);
|
||||
cfg.internalColorFormat = j.value("internalColorFormat", defaultCfg.internalColorFormat);
|
||||
cfg.idleWorkActive = j.value("idleWorkActive", defaultCfg.idleWorkActive);
|
||||
cfg.developerMode = j.value("developerMode", defaultCfg.developerMode);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void clampEnum(T &e) {
|
||||
e = std::clamp(e, T(0), T(int(T::OptionCount) - 1));
|
||||
}
|
||||
|
||||
// Configuration
|
||||
|
||||
const int UserConfiguration::ResolutionMultiplierLimit = 32;
|
||||
|
||||
UserConfiguration::UserConfiguration() {
|
||||
# ifdef RT64_BUILD_PLUGIN
|
||||
const bool isPJ64 = (RT64::API.apiType == RT64::APIType::Project64);
|
||||
if (isPJ64) {
|
||||
graphicsAPI = DefaultGraphicsAPI;
|
||||
} else {
|
||||
graphicsAPI = UserConfiguration::GraphicsAPI::Vulkan;
|
||||
}
|
||||
# else
|
||||
graphicsAPI = DefaultGraphicsAPI;
|
||||
# endif
|
||||
resolution = Resolution::WindowIntegerScale;
|
||||
antialiasing = Antialiasing::None;
|
||||
resolutionMultiplier = 2.0f;
|
||||
downsampleMultiplier = 1;
|
||||
filtering = Filtering::AntiAliasedPixelScaling;
|
||||
aspectRatio = AspectRatio::Original;
|
||||
aspectTarget = 16.0f / 9.0f;
|
||||
extAspectRatio = AspectRatio::Original;
|
||||
extAspectTarget = 16.0f / 9.0f;
|
||||
upscale2D = Upscale2D::ScaledOnly;
|
||||
threePointFiltering = true;
|
||||
refreshRate = RefreshRate::Original;
|
||||
refreshRateTarget = 60;
|
||||
internalColorFormat = InternalColorFormat::Automatic;
|
||||
idleWorkActive = true;
|
||||
developerMode = false;
|
||||
}
|
||||
|
||||
void UserConfiguration::validate() {
|
||||
clampEnum<GraphicsAPI>(graphicsAPI);
|
||||
clampEnum<Resolution>(resolution);
|
||||
clampEnum<Antialiasing>(antialiasing);
|
||||
clampEnum<Filtering>(filtering);
|
||||
clampEnum<AspectRatio>(aspectRatio);
|
||||
clampEnum<AspectRatio>(extAspectRatio);
|
||||
clampEnum<Upscale2D>(upscale2D);
|
||||
clampEnum<RefreshRate>(refreshRate);
|
||||
clampEnum<InternalColorFormat>(internalColorFormat);
|
||||
resolutionMultiplier = std::clamp<double>(resolutionMultiplier, 0.0f, ResolutionMultiplierLimit);
|
||||
downsampleMultiplier = std::clamp<int>(downsampleMultiplier, 1, ResolutionMultiplierLimit);
|
||||
aspectTarget = std::clamp<double>(aspectTarget, 0.1f, 100.0f);
|
||||
extAspectTarget = std::clamp<double>(extAspectTarget, 0.1f, 100.0f);
|
||||
refreshRateTarget = std::clamp<int>(refreshRateTarget, 10, 1000);
|
||||
}
|
||||
|
||||
uint32_t UserConfiguration::msaaSampleCount() const {
|
||||
return UserConfiguration::msaaSampleCount(antialiasing);
|
||||
}
|
||||
|
||||
uint32_t UserConfiguration::msaaSampleCount(Antialiasing antialiasing) {
|
||||
switch (antialiasing) {
|
||||
case Antialiasing::MSAA2X:
|
||||
return 2;
|
||||
case Antialiasing::MSAA4X:
|
||||
return 4;
|
||||
case Antialiasing::MSAA8X:
|
||||
return 8;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ConfigurationJSON
|
||||
|
||||
bool ConfigurationJSON::read(UserConfiguration &cfg, std::istream &stream) {
|
||||
try {
|
||||
json jroot;
|
||||
stream >> jroot;
|
||||
cfg = jroot.value("configuration", UserConfiguration());
|
||||
return !stream.bad();
|
||||
}
|
||||
catch (const nlohmann::detail::exception &e) {
|
||||
fprintf(stderr, "JSON parsing error: %s\n", e.what());
|
||||
cfg = UserConfiguration();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ConfigurationJSON::write(const UserConfiguration &cfg, std::ostream &stream) {
|
||||
json jroot;
|
||||
jroot["configuration"] = cfg;
|
||||
stream << std::setw(4) << jroot << std::endl;
|
||||
return !stream.bad();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <json/json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace RT64 {
|
||||
struct UserConfiguration {
|
||||
static const int ResolutionMultiplierLimit;
|
||||
|
||||
enum class GraphicsAPI {
|
||||
D3D12,
|
||||
Vulkan,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
static GraphicsAPI DefaultGraphicsAPI;
|
||||
|
||||
enum class Resolution {
|
||||
Original,
|
||||
WindowIntegerScale,
|
||||
Manual,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
enum class Antialiasing {
|
||||
None,
|
||||
MSAA2X,
|
||||
MSAA4X,
|
||||
MSAA8X,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
enum class Filtering {
|
||||
Nearest,
|
||||
Linear,
|
||||
AntiAliasedPixelScaling,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
enum class AspectRatio {
|
||||
Original,
|
||||
Expand,
|
||||
Manual,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
enum class Upscale2D {
|
||||
Original,
|
||||
ScaledOnly,
|
||||
All,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
enum class RefreshRate {
|
||||
Original,
|
||||
Display,
|
||||
Manual,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
enum class InternalColorFormat {
|
||||
Standard,
|
||||
High,
|
||||
Automatic,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
GraphicsAPI graphicsAPI;
|
||||
Resolution resolution;
|
||||
Antialiasing antialiasing;
|
||||
double resolutionMultiplier;
|
||||
int downsampleMultiplier;
|
||||
Filtering filtering;
|
||||
AspectRatio aspectRatio;
|
||||
double aspectTarget;
|
||||
AspectRatio extAspectRatio;
|
||||
double extAspectTarget;
|
||||
Upscale2D upscale2D;
|
||||
bool threePointFiltering;
|
||||
RefreshRate refreshRate;
|
||||
int refreshRateTarget;
|
||||
InternalColorFormat internalColorFormat;
|
||||
bool idleWorkActive;
|
||||
bool developerMode;
|
||||
|
||||
UserConfiguration();
|
||||
void validate();
|
||||
uint32_t msaaSampleCount() const;
|
||||
static uint32_t msaaSampleCount(Antialiasing antialiasing);
|
||||
};
|
||||
|
||||
extern void to_json(json &j, const UserConfiguration &cfg);
|
||||
extern void from_json(const json &j, UserConfiguration &cfg);
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(UserConfiguration::GraphicsAPI, {
|
||||
{ UserConfiguration::GraphicsAPI::D3D12, "D3D12" },
|
||||
{ UserConfiguration::GraphicsAPI::Vulkan, "Vulkan" }
|
||||
});
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(UserConfiguration::Resolution, {
|
||||
{ UserConfiguration::Resolution::Original, "Original" },
|
||||
{ UserConfiguration::Resolution::WindowIntegerScale, "WindowIntegerScale" },
|
||||
{ UserConfiguration::Resolution::Manual, "Manual" }
|
||||
});
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(UserConfiguration::AspectRatio, {
|
||||
{ UserConfiguration::AspectRatio::Original, "Original" },
|
||||
{ UserConfiguration::AspectRatio::Expand, "Expand" },
|
||||
{ UserConfiguration::AspectRatio::Manual, "Manual" }
|
||||
});
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(UserConfiguration::Antialiasing, {
|
||||
{ UserConfiguration::Antialiasing::None, "None" },
|
||||
{ UserConfiguration::Antialiasing::MSAA2X, "MSAA2X" },
|
||||
{ UserConfiguration::Antialiasing::MSAA4X, "MSAA4X" },
|
||||
{ UserConfiguration::Antialiasing::MSAA8X, "MSAA8X" }
|
||||
});
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(UserConfiguration::Filtering, {
|
||||
{ UserConfiguration::Filtering::Nearest, "Nearest" },
|
||||
{ UserConfiguration::Filtering::Linear, "Linear" },
|
||||
{ UserConfiguration::Filtering::AntiAliasedPixelScaling, "AntiAliasedPixelScaling" }
|
||||
});
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(UserConfiguration::Upscale2D, {
|
||||
{ UserConfiguration::Upscale2D::Original, "Original" },
|
||||
{ UserConfiguration::Upscale2D::ScaledOnly, "ScaledOnly" },
|
||||
{ UserConfiguration::Upscale2D::All, "All" }
|
||||
});
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(UserConfiguration::RefreshRate, {
|
||||
{ UserConfiguration::RefreshRate::Original, "Original" },
|
||||
{ UserConfiguration::RefreshRate::Display, "Display" },
|
||||
{ UserConfiguration::RefreshRate::Manual, "Manual" }
|
||||
});
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(UserConfiguration::InternalColorFormat, {
|
||||
{ UserConfiguration::InternalColorFormat::Standard, "Standard" },
|
||||
{ UserConfiguration::InternalColorFormat::High, "High" },
|
||||
{ UserConfiguration::InternalColorFormat::Automatic, "Automatic" }
|
||||
});
|
||||
|
||||
struct ConfigurationJSON {
|
||||
static bool read(UserConfiguration &cfg, std::istream &stream);
|
||||
static bool write(const UserConfiguration &cfg, std::ostream &stream);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#include "rt64_user_paths.h"
|
||||
|
||||
#if defined(__linux__)
|
||||
# include <unistd.h>
|
||||
# include <pwd.h>
|
||||
#elif defined(_WIN32)
|
||||
# include <Shlobj.h>
|
||||
#endif
|
||||
|
||||
namespace RT64 {
|
||||
// UserPaths
|
||||
|
||||
const std::filesystem::path GamesDirectory = "games";
|
||||
const std::filesystem::path ConfigurationFile = "rt64.json";
|
||||
const std::filesystem::path ImGuiFile = "rt64-imgui.ini";
|
||||
const std::filesystem::path LogFile = "rt64.log";
|
||||
|
||||
std::filesystem::path UserPaths::detectDataPath(const std::filesystem::path &appId) {
|
||||
std::filesystem::path resultPath;
|
||||
|
||||
# if defined(_WIN32)
|
||||
PWSTR knownPath = NULL;
|
||||
HRESULT result = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &knownPath);
|
||||
if (result == S_OK) {
|
||||
resultPath = std::filesystem::path{ knownPath } / appId;
|
||||
}
|
||||
|
||||
CoTaskMemFree(knownPath);
|
||||
# elif defined(__linux__)
|
||||
const char *homeDir = getenv("HOME");
|
||||
if (homeDir == nullptr) {
|
||||
homeDir = getpwuid(getuid())->pw_dir;
|
||||
}
|
||||
|
||||
if (homeDir != nullptr) {
|
||||
// Prefer to store in the .config directory if it exists. Use the home directory otherwise.
|
||||
const std::string appDirName = std::string(".") + std::string(appId.c_str());
|
||||
std::filesystem::path homePath = homeDir;
|
||||
std::filesystem::path configPath = homePath / ".config";
|
||||
if (std::filesystem::exists(configPath)) {
|
||||
resultPath = configPath / appDirName;
|
||||
}
|
||||
else {
|
||||
resultPath = homePath / appDirName;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
return resultPath;
|
||||
}
|
||||
|
||||
void UserPaths::setupPaths(const std::filesystem::path &dataPath) {
|
||||
this->dataPath = dataPath;
|
||||
|
||||
if (!dataPath.empty()) {
|
||||
gamesPath = dataPath / GamesDirectory;
|
||||
configurationPath = dataPath / ConfigurationFile;
|
||||
imguiPath = dataPath / ImGuiFile;
|
||||
logPath = dataPath / LogFile;
|
||||
}
|
||||
}
|
||||
|
||||
bool UserPaths::isEmpty() const {
|
||||
return dataPath.empty();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
|
||||
namespace RT64 {
|
||||
struct UserPaths {
|
||||
std::filesystem::path dataPath;
|
||||
std::filesystem::path gamesPath;
|
||||
std::filesystem::path configurationPath;
|
||||
std::filesystem::path imguiPath;
|
||||
std::filesystem::path logPath;
|
||||
|
||||
std::filesystem::path detectDataPath(const std::filesystem::path &appId);
|
||||
void setupPaths(const std::filesystem::path &dataPath);
|
||||
bool isEmpty() const;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
build/
|
||||
bin/
|
||||
@@ -0,0 +1,23 @@
|
||||
# 2.0.1 (2022-04-05)
|
||||
|
||||
A maintenance release with some bug fixes and improvements. There are no changes in the library API.
|
||||
|
||||
- Fixed an assert failing when detailed JSON dump was made while a custom pool was present with specified string name (#36, thanks @rbertin-aso).
|
||||
- Fixed image height calculation in JSON dump visualization tool "GpuMemDumpVis.py" (#37, thanks @rbertin-aso).
|
||||
- Added JSON Schema for JSON dump format - see file "tools\GpuMemDumpVis\GpuMemDump.schema.json".
|
||||
- Added documentation section "Resource reference counting".
|
||||
|
||||
# 2.0.0 (2022-03-25)
|
||||
|
||||
So much has changed since the first release that it doesn’t make much sense to compare the differences. Here are the most important features that the library now provides:
|
||||
|
||||
- Powerful custom pools, which give an opportunity to not only keep certain resources together, reserve some minimum or limit the maximum amount of memory they can take, but also to pass additional allocation parameters unavailable to simple allocations. Among them, probably the most interesting is `POOL_DESC::HeapProperties`, which allows you to specify parameters of a custom memory type, which may be useful on UMA platforms. Committed allocations can now also be created in custom pools.
|
||||
- The API for statistics and budget has been redesigned - see structures `Statistics`, `Budget`, `DetailedStatistics`, `TotalStatistics`.
|
||||
- The library exposes its core allocation algorithm via the “virtual allocator” interface. This can be used to allocate pieces of custom memory or whatever you like, even something completely unrelated to graphics.
|
||||
- The allocation algorithm has been replaced with the new, more efficient TLSF.
|
||||
- Added support for defragmentation.
|
||||
- Objects of the library can be used with smart pointers designed for COM objects.
|
||||
|
||||
# 1.0.0 (2019-09-02)
|
||||
|
||||
First published version.
|
||||
@@ -0,0 +1,35 @@
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
|
||||
project(D3D12MemoryAllocator)
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
find_package(Doxygen)
|
||||
option(BUILD_DOCUMENTATION "Create and install the HTML-based API documentation (requires Doxygen)" OFF)
|
||||
option(BUILD_SHARED_LIBS "Build D3D12 Memory Allocator shared library" OFF)
|
||||
|
||||
if(BUILD_DOCUMENTATION)
|
||||
if(DOXYGEN_FOUND)
|
||||
# set input and output files
|
||||
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/src/Doxyfile)
|
||||
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||
|
||||
# request to configure the file
|
||||
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
|
||||
# note the option ALL which allows to build the docs together with the application
|
||||
add_custom_target( doc_doxygen ALL
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating API documentation with Doxygen"
|
||||
VERBATIM )
|
||||
else()
|
||||
message("Doxygen need to be installed to generate the doxygen documentation")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# D3D12MemoryAllocator contains an sample application which is not build by default
|
||||
option(D3D12MA_BUILD_SAMPLE "Build D3D12MemoryAllocator sample application" OFF)
|
||||
|
||||
message(STATUS "D3D12MA_BUILD_SAMPLE = ${D3D12MA_BUILD_SAMPLE}")
|
||||
|
||||
add_subdirectory(src)
|
||||
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2019-2022 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,52 @@
|
||||
Notices and licenses file
|
||||
_________________________
|
||||
|
||||
AMD copyrighted code (MIT)
|
||||
Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Dependecnies on microsoft-directx-graphics-samples v-u (MIT)
|
||||
|
||||
Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
|
||||
Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
This code is licensed under the MIT License (MIT).
|
||||
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
|
||||
|
||||
gpuopen-librariesandsdks-vulkanmemoryallocator v-u (MIT)
|
||||
Copyright (c) 2019-2022 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,115 @@
|
||||
# D3D12 Memory Allocator
|
||||
|
||||
Easy to integrate memory allocation library for Direct3D 12.
|
||||
|
||||
**Documentation:** Browse online: [D3D12 Memory Allocator](https://gpuopen-librariesandsdks.github.io/D3D12MemoryAllocator/html/) (generated from Doxygen-style comments in [src/D3D12MemAlloc.h](src/D3D12MemAlloc.h))
|
||||
|
||||
**License:** MIT. See [LICENSE.txt](LICENSE.txt)
|
||||
|
||||
**Changelog:** See [CHANGELOG.md](CHANGELOG.md)
|
||||
|
||||
**Product page:** [D3D12 Memory Allocator on GPUOpen](https://gpuopen.com/gaming-product/d3d12-memory-allocator/)
|
||||
|
||||
**Build status:**
|
||||
|
||||
Windows: [](https://ci.appveyor.com/project/adam-sawicki-amd/d3d12memoryallocator)
|
||||
|
||||
[](http://isitmaintained.com/project/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator "Average time to resolve an issue")
|
||||
|
||||
# Problem
|
||||
|
||||
Memory allocation and resource (buffer and texture) creation in new, explicit graphics APIs (Vulkan® and Direct3D 12) is difficult comparing to older graphics APIs like Direct3D 11 or OpenGL® because it is recommended to allocate bigger blocks of memory and assign parts of them to resources. [Vulkan Memory Allocator](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/) is a library that implements this functionality for Vulkan. It is available online since 2017 and it is successfully used in many software projects, including some AAA game studios. This is an equivalent library for D3D12.
|
||||
|
||||
# Features
|
||||
|
||||
This library can help developers to manage memory allocations and resource creation by offering function `Allocator::CreateResource` similar to the standard `ID3D12Device::CreateCommittedResource`. It internally:
|
||||
|
||||
- Allocates and keeps track of bigger memory heaps, used and unused ranges inside them, finds best matching unused ranges to create new resources there as placed resources.
|
||||
- Automatically respects size and alignment requirements for created resources.
|
||||
- Automatically handles resource heap tier - whether it's `D3D12_RESOURCE_HEAP_TIER_1` that requires to keep certain classes of resources separate or `D3D12_RESOURCE_HEAP_TIER_2` that allows to keep them all together.
|
||||
|
||||
Additional features:
|
||||
|
||||
- Well-documented - description of all classes and functions provided, along with chapters that contain general description and example code.
|
||||
- Thread-safety: Library is designed to be used in multithreaded code.
|
||||
- Configuration: Fill optional members of `ALLOCATOR_DESC` structure to provide custom CPU memory allocator and other parameters.
|
||||
- Customization and integration with custom engines: Predefine appropriate macros to provide your own implementation of external facilities used by the library, like assert, mutex, and atomic.
|
||||
- Support for resource aliasing (overlap).
|
||||
- Custom memory pools: Create a pool with desired parameters (e.g. fixed or limited maximum size, custom `D3D12_HEAP_PROPERTIES` and `D3D12_HEAP_FLAGS`) and allocate memory out of it.
|
||||
- Linear allocator: Create a pool with linear algorithm and use it for much faster allocations and deallocations in free-at-once, stack, double stack, or ring buffer fashion.
|
||||
- Defragmentation: Let the library move data around to free some memory blocks and make your allocations better compacted.
|
||||
- Statistics: Obtain brief or detailed statistics about the amount of memory used, unused, number of allocated heaps, number of allocations etc. - globally and per memory heap type. Current memory usage and budget as reported by the system can also be queried.
|
||||
- Debug annotations: Associate custom `void* pPrivateData` and debug `LPCWSTR pName` with each allocation.
|
||||
- JSON dump: Obtain a string in JSON format with detailed map of internal state, including list of allocations, their string names, and gaps between them.
|
||||
- Convert this JSON dump into a picture to visualize your memory. See [tools/GpuMemDumpVis](tools/GpuMemDumpVis/README.md).
|
||||
- Virtual allocator - an API that exposes the core allocation algorithm to be used without allocating real GPU memory, to allocate your own stuff, e.g. sub-allocate pieces of one large buffer.
|
||||
|
||||
# Prerequisites
|
||||
|
||||
- Self-contained C++ library in single pair of H + CPP files. No external dependencies other than standard C, C++ library and Windows SDK. Some features of C++14 used. STL containers, C++ exceptions, and RTTI are not used.
|
||||
- Object-oriented interface in a convention similar to D3D12.
|
||||
- Error handling implemented by returning `HRESULT` error codes - same way as in D3D12.
|
||||
- Interface documented using Doxygen-style comments.
|
||||
|
||||
# Example
|
||||
|
||||
Basic usage of this library is very simple. Advanced features are optional. After you created global `Allocator` object, a complete code needed to create a texture may look like this:
|
||||
|
||||
```cpp
|
||||
D3D12_RESOURCE_DESC resourceDesc = {};
|
||||
resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
|
||||
resourceDesc.Alignment = 0;
|
||||
resourceDesc.Width = 1024;
|
||||
resourceDesc.Height = 1024;
|
||||
resourceDesc.DepthOrArraySize = 1;
|
||||
resourceDesc.MipLevels = 1;
|
||||
resourceDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
resourceDesc.SampleDesc.Count = 1;
|
||||
resourceDesc.SampleDesc.Quality = 0;
|
||||
resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
|
||||
resourceDesc.Flags = D3D12_RESOURCE_FLAG_NONE;
|
||||
|
||||
D3D12MA::ALLOCATION_DESC allocDesc = {};
|
||||
allocDesc.HeapType = D3D12_HEAP_TYPE_DEFAULT;
|
||||
|
||||
D3D12Resource* resource;
|
||||
D3D12MA::Allocation* allocation;
|
||||
HRESULT hr = allocator->CreateResource(
|
||||
&allocDesc, &resourceDesc,
|
||||
D3D12_RESOURCE_STATE_COPY_DEST, NULL,
|
||||
&allocation, IID_PPV_ARGS(&resource));
|
||||
```
|
||||
|
||||
With this one function call:
|
||||
|
||||
1. `ID3D12Heap` memory block is allocated if needed.
|
||||
2. An unused region of the memory block is reserved for the allocation.
|
||||
3. `ID3D12Resource` is created as placed resource, bound to this region.
|
||||
|
||||
`Allocation` is an object that represents memory assigned to this texture. It can be queried for parameters like offset and size.
|
||||
|
||||
# Binaries
|
||||
|
||||
The release comes with precompiled binary executable for "D3D12Sample" application which contains test suite. It is compiled using Visual Studio 2019, so it requires appropriate libraries to work, including "MSVCP140.dll", "VCRUNTIME140.dll", "VCRUNTIME140_1.dll". If its launch fails with error message telling about those files missing, please download and install [Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads), "x64" version.
|
||||
|
||||
# Copyright notice
|
||||
|
||||
This software package uses third party software:
|
||||
|
||||
- Parts of the code of [Vulkan Memory Allocator](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/) by AMD, license: MIT
|
||||
- Parts of the code of [DirectX-Graphics-Samples](https://github.com/microsoft/DirectX-Graphics-Samples) by Microsoft, license: MIT
|
||||
|
||||
For more information see [NOTICES.txt](NOTICES.txt).
|
||||
|
||||
# Software using this library
|
||||
|
||||
- **[The Forge](https://github.com/ConfettiFX/The-Forge)** - cross-platform rendering framework. Apache License 2.0.
|
||||
- **[Wicked Engine<img src="https://github.com/turanszkij/WickedEngine/blob/master/Content/logo_small.png" width="28px" align="center"/>](https://github.com/turanszkij/WickedEngine)** - 3D engine with modern graphics
|
||||
|
||||
[Some other projects on GitHub](https://github.com/search?q=D3D12MemAlloc.h&type=Code) and some game development studios that use DX12 in their games.
|
||||
|
||||
# See also
|
||||
|
||||
- **[Vcpkg](https://github.com/Microsoft/vcpkg)** dependency manager from Microsoft offers a port of this library that is easy to install.
|
||||
- **[Vulkan Memory Allocator](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/)** - equivalent library for Vulkan. License: MIT.
|
||||
- **[TerraFX.Interop.D3D12MemoryAllocator](https://github.com/terrafx/terrafx.interop.d3d12memoryallocator)** - interop bindings for this library for C#, as used by [TerraFX](https://github.com/terrafx/terrafx). License: MIT.
|
||||
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 268 B |
|
After Width: | Height: | Size: 6.4 KiB |
@@ -0,0 +1,297 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: D:/PROJECTS/D3D12 Memory Allocator/REPO/include/D3D12MemAlloc.h File Reference</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#nested-classes">Classes</a> |
|
||||
<a href="#namespaces">Namespaces</a> |
|
||||
<a href="#define-members">Macros</a> |
|
||||
<a href="#typedef-members">Typedefs</a> |
|
||||
<a href="#enum-members">Enumerations</a> |
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle"><div class="title">D3D12MemAlloc.h File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><code>#include <d3d12.h></code><br />
|
||||
<code>#include <dxgi1_4.h></code><br />
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
|
||||
Classes</h2></td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s.html">D3D12MA::ALLOCATION_CALLBACKS</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Custom callbacks to CPU memory allocation functions. <a href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">D3D12MA::ALLOCATION_DESC</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Parameters of created <a class="el" href="class_d3_d12_m_a_1_1_allocation.html" title="Represents single memory allocation.">D3D12MA::Allocation</a> object. To be used with <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aa37d6b9fe8ea0864f7a35b9d68e8345a" title="Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation functi...">Allocator::CreateResource</a>. <a href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_statistics.html">D3D12MA::Statistics</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Calculated statistics of memory usage e.g. in a specific memory heap type, memory segment group, custom pool, or total. <a href="struct_d3_d12_m_a_1_1_statistics.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_detailed_statistics.html">D3D12MA::DetailedStatistics</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">More detailed statistics than <a class="el" href="struct_d3_d12_m_a_1_1_statistics.html" title="Calculated statistics of memory usage e.g. in a specific memory heap type, memory segment group,...">D3D12MA::Statistics</a>. <a href="struct_d3_d12_m_a_1_1_detailed_statistics.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_total_statistics.html">D3D12MA::TotalStatistics</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">General statistics from current state of the allocator - total memory usage across all memory heaps and segments. <a href="struct_d3_d12_m_a_1_1_total_statistics.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_budget.html">D3D12MA::Budget</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Statistics of current memory usage and available budget for a specific memory segment group. <a href="struct_d3_d12_m_a_1_1_budget.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_virtual_allocation.html">D3D12MA::VirtualAllocation</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Represents single memory allocation done inside <a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html" title="Represents pure allocation algorithm and a data structure with allocations in some memory block,...">VirtualBlock</a>. <a href="struct_d3_d12_m_a_1_1_virtual_allocation.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Represents single memory allocation. <a href="class_d3_d12_m_a_1_1_allocation.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html">D3D12MA::DEFRAGMENTATION_DESC</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Parameters for defragmentation. <a href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e.html">D3D12MA::DEFRAGMENTATION_MOVE</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Single move of an allocation to be done for defragmentation. <a href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html">D3D12MA::DEFRAGMENTATION_PASS_MOVE_INFO</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Parameters for incremental defragmentation steps. <a href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___s_t_a_t_s.html">D3D12MA::DEFRAGMENTATION_STATS</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Statistics returned for defragmentation process by function <a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#a1c21c26f47dcbf8f4e562063a3e25f38" title="Returns statistics of the defragmentation performed so far.">DefragmentationContext::GetStats()</a>. <a href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___s_t_a_t_s.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">D3D12MA::DefragmentationContext</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Represents defragmentation process in progress. <a href="class_d3_d12_m_a_1_1_defragmentation_context.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html">D3D12MA::POOL_DESC</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Parameters of created <a class="el" href="class_d3_d12_m_a_1_1_pool.html" title="Custom memory pool.">D3D12MA::Pool</a> object. To be used with <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aac7b1f6bf53cbf4c4ce2264cb72ca515" title="Creates custom pool.">D3D12MA::Allocator::CreatePool</a>. <a href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_d3_d12_m_a_1_1_pool.html">D3D12MA::Pool</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Custom memory pool. <a href="class_d3_d12_m_a_1_1_pool.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html">D3D12MA::ALLOCATOR_DESC</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Parameters of created <a class="el" href="class_d3_d12_m_a_1_1_allocator.html" title="Represents main object of this library initialized for particular ID3D12Device.">Allocator</a> object. To be used with <a class="el" href="namespace_d3_d12_m_a.html#ab7a1cd1683986d75ce1488b0920f4cb0" title="Creates new main D3D12MA::Allocator object and returns it through ppAllocator.">CreateAllocator()</a>. <a href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Represents main object of this library initialized for particular <code>ID3D12Device</code>. <a href="class_d3_d12_m_a_1_1_allocator.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___b_l_o_c_k___d_e_s_c.html">D3D12MA::VIRTUAL_BLOCK_DESC</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Parameters of created <a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html" title="Represents pure allocation algorithm and a data structure with allocations in some memory block,...">D3D12MA::VirtualBlock</a> object to be passed to <a class="el" href="namespace_d3_d12_m_a.html#ab024647ae85ee63e2fa2c1c4beac6d98" title="Creates new D3D12MA::VirtualBlock object and returns it through ppVirtualBlock.">CreateVirtualBlock()</a>. <a href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___b_l_o_c_k___d_e_s_c.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">D3D12MA::VIRTUAL_ALLOCATION_DESC</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Parameters of created virtual allocation to be passed to <a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#a9281daf76e888ea1bd5247d5732e8179" title="Creates new allocation.">VirtualBlock::Allocate()</a>. <a href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___a_l_l_o_c_a_t_i_o_n___d_e_s_c.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___a_l_l_o_c_a_t_i_o_n___i_n_f_o.html">D3D12MA::VIRTUAL_ALLOCATION_INFO</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Parameters of an existing virtual allocation, returned by <a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#ac605dce05ca0d411e46079f0bad765d1" title="Returns information about an allocation - its offset, size and custom pointer.">VirtualBlock::GetAllocationInfo()</a>. <a href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___a_l_l_o_c_a_t_i_o_n___i_n_f_o.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Represents pure allocation algorithm and a data structure with allocations in some memory block, without actually allocating any GPU memory. <a href="class_d3_d12_m_a_1_1_virtual_block.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
|
||||
Namespaces</h2></td></tr>
|
||||
<tr class="memitem:namespace_d3_d12_m_a" id="r_namespace_d3_d12_m_a"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
|
||||
Macros</h2></td></tr>
|
||||
<tr class="memitem:aa623643886b8481adb32017e5c748b50" id="r_aa623643886b8481adb32017e5c748b50"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="#aa623643886b8481adb32017e5c748b50">D3D12MA_DXGI_1_4</a>   0</td></tr>
|
||||
<tr class="separator:aa623643886b8481adb32017e5c748b50"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ad04069a2e2bbc53b7d65f85a04a2dcbc" id="r_ad04069a2e2bbc53b7d65f85a04a2dcbc"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="#ad04069a2e2bbc53b7d65f85a04a2dcbc">D3D12MA_USE_SMALL_RESOURCE_PLACEMENT_ALIGNMENT</a>   1</td></tr>
|
||||
<tr class="separator:ad04069a2e2bbc53b7d65f85a04a2dcbc"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
|
||||
Typedefs</h2></td></tr>
|
||||
<tr class="memitem:a15e349adce86a40e0417d405aef1af80" id="r_a15e349adce86a40e0417d405aef1af80"><td class="memItemLeft" align="right" valign="top">typedef UINT64 </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html#a15e349adce86a40e0417d405aef1af80">D3D12MA::AllocHandle</a></td></tr>
|
||||
<tr class="memdesc:a15e349adce86a40e0417d405aef1af80"><td class="mdescLeft"> </td><td class="mdescRight">Unique identifier of single allocation done inside the memory heap. <br /></td></tr>
|
||||
<tr class="separator:a15e349adce86a40e0417d405aef1af80"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ad998d40b4601b84dbc538694b1faf4d5" id="r_ad998d40b4601b84dbc538694b1faf4d5"><td class="memItemLeft" align="right" valign="top">using </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html#ad998d40b4601b84dbc538694b1faf4d5">D3D12MA::ALLOCATE_FUNC_PTR</a> = void* (*)(size_t Size, size_t Alignment, void* pPrivateData)</td></tr>
|
||||
<tr class="memdesc:ad998d40b4601b84dbc538694b1faf4d5"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to custom callback function that allocates CPU memory. <br /></td></tr>
|
||||
<tr class="separator:ad998d40b4601b84dbc538694b1faf4d5"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a7c61f55eeb64451cb0c08c0461bbe1a3" id="r_a7c61f55eeb64451cb0c08c0461bbe1a3"><td class="memItemLeft" align="right" valign="top">using </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html#a7c61f55eeb64451cb0c08c0461bbe1a3">D3D12MA::FREE_FUNC_PTR</a> = void (*)(void* pMemory, void* pPrivateData)</td></tr>
|
||||
<tr class="memdesc:a7c61f55eeb64451cb0c08c0461bbe1a3"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to custom callback function that deallocates CPU memory. <br /></td></tr>
|
||||
<tr class="separator:a7c61f55eeb64451cb0c08c0461bbe1a3"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
|
||||
Enumerations</h2></td></tr>
|
||||
<tr class="memitem:abbad31a7e0b3d09d77f3fb704b77645e" id="r_abbad31a7e0b3d09d77f3fb704b77645e"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645e">D3D12MA::ALLOCATION_FLAGS</a> { <br />
|
||||
  <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645ea0bf578b096d6ea73cea86b031541733e">D3D12MA::ALLOCATION_FLAG_NONE</a> = 0
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645ea661a5472dba3dcecc5a2cc92afd25675">D3D12MA::ALLOCATION_FLAG_COMMITTED</a> = 0x1
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645ea9a52c6ae694eadcd20896091e77c0628">D3D12MA::ALLOCATION_FLAG_NEVER_ALLOCATE</a> = 0x2
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645eab374417c1f22a833ead268a6c21424e6">D3D12MA::ALLOCATION_FLAG_WITHIN_BUDGET</a> = 0x4
|
||||
, <br />
|
||||
  <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645eafb0e2dacce691336e717550a1df72474">D3D12MA::ALLOCATION_FLAG_UPPER_ADDRESS</a> = 0x8
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645ea4d6808f27de6d0ae57014ec1f4d54326">D3D12MA::ALLOCATION_FLAG_CAN_ALIAS</a> = 0x10
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645ea4b4fa95bb0daf6a80add7fb292aa63ae">D3D12MA::ALLOCATION_FLAG_STRATEGY_MIN_MEMORY</a> = 0x00010000
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645eaa3ded8847563c24b4522af0586dbd2cb">D3D12MA::ALLOCATION_FLAG_STRATEGY_MIN_TIME</a> = 0x00020000
|
||||
, <br />
|
||||
  <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645eac30b62e36906b3c6e97b8b1d2ad8709d">D3D12MA::ALLOCATION_FLAG_STRATEGY_MIN_OFFSET</a> = 0x0004000
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645eaaeed6a77f0fe7f33459df593cea44c35">D3D12MA::ALLOCATION_FLAG_STRATEGY_BEST_FIT</a> = ALLOCATION_FLAG_STRATEGY_MIN_MEMORY
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645ea103ff3115f3c2126779c25be435bf6aa">D3D12MA::ALLOCATION_FLAG_STRATEGY_FIRST_FIT</a> = ALLOCATION_FLAG_STRATEGY_MIN_TIME
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645ea3e29297ad3c6cf9d9bb61b6d27a13ab3">D3D12MA::ALLOCATION_FLAG_STRATEGY_MASK</a>
|
||||
<br />
|
||||
}</td></tr>
|
||||
<tr class="memdesc:abbad31a7e0b3d09d77f3fb704b77645e"><td class="mdescLeft"> </td><td class="mdescRight">Bit flags to be used with ALLOCATION_DESC::Flags. <a href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645e">More...</a><br /></td></tr>
|
||||
<tr class="separator:abbad31a7e0b3d09d77f3fb704b77645e"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ab433989212ee6736bf9d63c5bc565df4" id="r_ab433989212ee6736bf9d63c5bc565df4"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html#ab433989212ee6736bf9d63c5bc565df4">D3D12MA::DEFRAGMENTATION_FLAGS</a> { <a class="el" href="namespace_d3_d12_m_a.html#ab433989212ee6736bf9d63c5bc565df4a9d0301a81136ca79e3ba52542c6d2e13">D3D12MA::DEFRAGMENTATION_FLAG_ALGORITHM_FAST</a> = 0x1
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#ab433989212ee6736bf9d63c5bc565df4ace3a84861ed6a1b8066fa9c12c7e89b9">D3D12MA::DEFRAGMENTATION_FLAG_ALGORITHM_BALANCED</a> = 0x2
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#ab433989212ee6736bf9d63c5bc565df4af205647f08a5c2cddced83ed66892467">D3D12MA::DEFRAGMENTATION_FLAG_ALGORITHM_FULL</a> = 0x4
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#ab433989212ee6736bf9d63c5bc565df4a567e0fe890cc07d8dd6576584e8d9f2d">D3D12MA::DEFRAGMENTATION_FLAG_ALGORITHM_MASK</a>
|
||||
}</td></tr>
|
||||
<tr class="memdesc:ab433989212ee6736bf9d63c5bc565df4"><td class="mdescLeft"> </td><td class="mdescRight">Flags to be passed as DEFRAGMENTATION_DESC::Flags. <a href="namespace_d3_d12_m_a.html#ab433989212ee6736bf9d63c5bc565df4">More...</a><br /></td></tr>
|
||||
<tr class="separator:ab433989212ee6736bf9d63c5bc565df4"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a82bb787a69699a877b4166789a30e602" id="r_a82bb787a69699a877b4166789a30e602"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602">D3D12MA::DEFRAGMENTATION_MOVE_OPERATION</a> { <a class="el" href="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602a29a5c20322e633f6c34ddebd16bc61ac">D3D12MA::DEFRAGMENTATION_MOVE_OPERATION_COPY</a> = 0
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602abefe270a1803998dda3f8e01ec3a4ad6">D3D12MA::DEFRAGMENTATION_MOVE_OPERATION_IGNORE</a> = 1
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602aa2143507d723de458c2ed94e143ac242">D3D12MA::DEFRAGMENTATION_MOVE_OPERATION_DESTROY</a> = 2
|
||||
}</td></tr>
|
||||
<tr class="memdesc:a82bb787a69699a877b4166789a30e602"><td class="mdescLeft"> </td><td class="mdescRight">Operation performed on single defragmentation move. <a href="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602">More...</a><br /></td></tr>
|
||||
<tr class="separator:a82bb787a69699a877b4166789a30e602"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a919d8545365d6b7209a964f2b99936d1" id="r_a919d8545365d6b7209a964f2b99936d1"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html#a919d8545365d6b7209a964f2b99936d1">D3D12MA::POOL_FLAGS</a> { <a class="el" href="namespace_d3_d12_m_a.html#a919d8545365d6b7209a964f2b99936d1a5d8dc91add3423140809a550c7224d02">D3D12MA::POOL_FLAG_NONE</a> = 0
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#a919d8545365d6b7209a964f2b99936d1aa37a0103f511954ea42a1d0bba286b6a">D3D12MA::POOL_FLAG_ALGORITHM_LINEAR</a> = 0x1
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#a919d8545365d6b7209a964f2b99936d1acc379a89755438c0f76667783b778baa">D3D12MA::POOL_FLAG_MSAA_TEXTURES_ALWAYS_COMMITTED</a> = 0x2
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#a919d8545365d6b7209a964f2b99936d1aec9d4939b8cc5438545b9df840b5f5f7">D3D12MA::POOL_FLAG_ALGORITHM_MASK</a> = POOL_FLAG_ALGORITHM_LINEAR
|
||||
}</td></tr>
|
||||
<tr class="memdesc:a919d8545365d6b7209a964f2b99936d1"><td class="mdescLeft"> </td><td class="mdescRight">Bit flags to be used with POOL_DESC::Flags. <a href="namespace_d3_d12_m_a.html#a919d8545365d6b7209a964f2b99936d1">More...</a><br /></td></tr>
|
||||
<tr class="separator:a919d8545365d6b7209a964f2b99936d1"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ad5ae5a5e42b878f2e18ab5d1fbfb9916" id="r_ad5ae5a5e42b878f2e18ab5d1fbfb9916"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html#ad5ae5a5e42b878f2e18ab5d1fbfb9916">D3D12MA::ALLOCATOR_FLAGS</a> { <br />
|
||||
  <a class="el" href="namespace_d3_d12_m_a.html#ad5ae5a5e42b878f2e18ab5d1fbfb9916a2fb30967b492c27823a80b5de3aea26f">D3D12MA::ALLOCATOR_FLAG_NONE</a> = 0
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#ad5ae5a5e42b878f2e18ab5d1fbfb9916a1b06bb21df006f76a9ed1bc41838bc52">D3D12MA::ALLOCATOR_FLAG_SINGLETHREADED</a> = 0x1
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#ad5ae5a5e42b878f2e18ab5d1fbfb9916a068863dc0538ff4ea153b046b31e94fb">D3D12MA::ALLOCATOR_FLAG_ALWAYS_COMMITTED</a> = 0x2
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#ad5ae5a5e42b878f2e18ab5d1fbfb9916ae7dc7ab9168148281ebfe1586f554335">D3D12MA::ALLOCATOR_FLAG_DEFAULT_POOLS_NOT_ZEROED</a> = 0x4
|
||||
, <br />
|
||||
  <a class="el" href="namespace_d3_d12_m_a.html#ad5ae5a5e42b878f2e18ab5d1fbfb9916adfbfd20d716f2a46f74d6226056fef1e">D3D12MA::ALLOCATOR_FLAG_MSAA_TEXTURES_ALWAYS_COMMITTED</a> = 0x8
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#ad5ae5a5e42b878f2e18ab5d1fbfb9916a15c1ba5fbc182ac927b3011e23e74a72">D3D12MA::ALLOCATOR_FLAG_DONT_PREFER_SMALL_BUFFERS_COMMITTED</a> = 0x10
|
||||
<br />
|
||||
}</td></tr>
|
||||
<tr class="memdesc:ad5ae5a5e42b878f2e18ab5d1fbfb9916"><td class="mdescLeft"> </td><td class="mdescRight">Bit flags to be used with ALLOCATOR_DESC::Flags. <a href="namespace_d3_d12_m_a.html#ad5ae5a5e42b878f2e18ab5d1fbfb9916">More...</a><br /></td></tr>
|
||||
<tr class="separator:ad5ae5a5e42b878f2e18ab5d1fbfb9916"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a578329923a103be086ac52e3bed2085d" id="r_a578329923a103be086ac52e3bed2085d"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html#a578329923a103be086ac52e3bed2085d">D3D12MA::VIRTUAL_BLOCK_FLAGS</a> { <a class="el" href="namespace_d3_d12_m_a.html#a578329923a103be086ac52e3bed2085dafc882884f8bacd5cab3087567df8c53d">D3D12MA::VIRTUAL_BLOCK_FLAG_NONE</a> = 0
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#a578329923a103be086ac52e3bed2085dabd9968af113acc9a756254ab9f1dc13d">D3D12MA::VIRTUAL_BLOCK_FLAG_ALGORITHM_LINEAR</a> = POOL_FLAG_ALGORITHM_LINEAR
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#a578329923a103be086ac52e3bed2085da0fee243cbf2902a68123ac85caa21e3e">D3D12MA::VIRTUAL_BLOCK_FLAG_ALGORITHM_MASK</a> = POOL_FLAG_ALGORITHM_MASK
|
||||
}</td></tr>
|
||||
<tr class="memdesc:a578329923a103be086ac52e3bed2085d"><td class="mdescLeft"> </td><td class="mdescRight">Bit flags to be used with VIRTUAL_BLOCK_DESC::Flags. <a href="namespace_d3_d12_m_a.html#a578329923a103be086ac52e3bed2085d">More...</a><br /></td></tr>
|
||||
<tr class="separator:a578329923a103be086ac52e3bed2085d"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a7e4152ccaf661f5398b24a23cbe9ae72" id="r_a7e4152ccaf661f5398b24a23cbe9ae72"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html#a7e4152ccaf661f5398b24a23cbe9ae72">D3D12MA::VIRTUAL_ALLOCATION_FLAGS</a> { <br />
|
||||
  <a class="el" href="namespace_d3_d12_m_a.html#a7e4152ccaf661f5398b24a23cbe9ae72a03576295004dec9dc8f99a895d232027">D3D12MA::VIRTUAL_ALLOCATION_FLAG_NONE</a> = 0
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#a7e4152ccaf661f5398b24a23cbe9ae72a86beebcb80a1a10cb5525e2c9ed1435e">D3D12MA::VIRTUAL_ALLOCATION_FLAG_UPPER_ADDRESS</a> = ALLOCATION_FLAG_UPPER_ADDRESS
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#a7e4152ccaf661f5398b24a23cbe9ae72affe589cb8817363fed0d207c3a5f2ad9">D3D12MA::VIRTUAL_ALLOCATION_FLAG_STRATEGY_MIN_MEMORY</a> = ALLOCATION_FLAG_STRATEGY_MIN_MEMORY
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#a7e4152ccaf661f5398b24a23cbe9ae72ae37ebe327c9d46b5ad68e5a95c888efe">D3D12MA::VIRTUAL_ALLOCATION_FLAG_STRATEGY_MIN_TIME</a> = ALLOCATION_FLAG_STRATEGY_MIN_TIME
|
||||
, <br />
|
||||
  <a class="el" href="namespace_d3_d12_m_a.html#a7e4152ccaf661f5398b24a23cbe9ae72abd8063a364dba797e928b6aaa85dd5f0">D3D12MA::VIRTUAL_ALLOCATION_FLAG_STRATEGY_MIN_OFFSET</a> = ALLOCATION_FLAG_STRATEGY_MIN_OFFSET
|
||||
, <a class="el" href="namespace_d3_d12_m_a.html#a7e4152ccaf661f5398b24a23cbe9ae72a6a78fdd4c16ef443e9353622caf7efb9">D3D12MA::VIRTUAL_ALLOCATION_FLAG_STRATEGY_MASK</a> = ALLOCATION_FLAG_STRATEGY_MASK
|
||||
<br />
|
||||
}</td></tr>
|
||||
<tr class="memdesc:a7e4152ccaf661f5398b24a23cbe9ae72"><td class="mdescLeft"> </td><td class="mdescRight">Bit flags to be used with VIRTUAL_ALLOCATION_DESC::Flags. <a href="namespace_d3_d12_m_a.html#a7e4152ccaf661f5398b24a23cbe9ae72">More...</a><br /></td></tr>
|
||||
<tr class="separator:a7e4152ccaf661f5398b24a23cbe9ae72"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:ab7a1cd1683986d75ce1488b0920f4cb0" id="r_ab7a1cd1683986d75ce1488b0920f4cb0"><td class="memItemLeft" align="right" valign="top">D3D12MA_API HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html#ab7a1cd1683986d75ce1488b0920f4cb0">D3D12MA::CreateAllocator</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html">ALLOCATOR_DESC</a> *pDesc, <a class="el" href="class_d3_d12_m_a_1_1_allocator.html">Allocator</a> **ppAllocator)</td></tr>
|
||||
<tr class="memdesc:ab7a1cd1683986d75ce1488b0920f4cb0"><td class="mdescLeft"> </td><td class="mdescRight">Creates new main <a class="el" href="class_d3_d12_m_a_1_1_allocator.html" title="Represents main object of this library initialized for particular ID3D12Device.">D3D12MA::Allocator</a> object and returns it through <code>ppAllocator</code>. <br /></td></tr>
|
||||
<tr class="separator:ab7a1cd1683986d75ce1488b0920f4cb0"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ab024647ae85ee63e2fa2c1c4beac6d98" id="r_ab024647ae85ee63e2fa2c1c4beac6d98"><td class="memItemLeft" align="right" valign="top">D3D12MA_API HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_d3_d12_m_a.html#ab024647ae85ee63e2fa2c1c4beac6d98">D3D12MA::CreateVirtualBlock</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___b_l_o_c_k___d_e_s_c.html">VIRTUAL_BLOCK_DESC</a> *pDesc, <a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">VirtualBlock</a> **ppVirtualBlock)</td></tr>
|
||||
<tr class="memdesc:ab024647ae85ee63e2fa2c1c4beac6d98"><td class="mdescLeft"> </td><td class="mdescRight">Creates new <a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html" title="Represents pure allocation algorithm and a data structure with allocations in some memory block,...">D3D12MA::VirtualBlock</a> object and returns it through <code>ppVirtualBlock</code>. <br /></td></tr>
|
||||
<tr class="separator:ab024647ae85ee63e2fa2c1c4beac6d98"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<h2 class="groupheader">Macro Definition Documentation</h2>
|
||||
<a id="aa623643886b8481adb32017e5c748b50" name="aa623643886b8481adb32017e5c748b50"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aa623643886b8481adb32017e5c748b50">◆ </a></span>D3D12MA_DXGI_1_4</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">#define D3D12MA_DXGI_1_4   0</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ad04069a2e2bbc53b7d65f85a04a2dcbc" name="ad04069a2e2bbc53b7d65f85a04a2dcbc"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ad04069a2e2bbc53b7d65f85a04a2dcbc">◆ </a></span>D3D12MA_USE_SMALL_RESOURCE_PLACEMENT_ALIGNMENT</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">#define D3D12MA_USE_SMALL_RESOURCE_PLACEMENT_ALIGNMENT   1</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,109 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: Class List</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle"><div class="title">Class List</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock">Here are the classes, structs, unions and interfaces with brief descriptions:</div><div class="directory">
|
||||
<div class="levels">[detail level <span onclick="javascript:dynsection.toggleLevel(1);">1</span><span onclick="javascript:dynsection.toggleLevel(2);">2</span>]</div><table class="directory">
|
||||
<tr id="row_0_" class="even"><td class="entry"><span style="width:0px;display:inline-block;"> </span><span id="arr_0_" class="arrow" onclick="dynsection.toggleFolder('0_')">▼</span><span class="icona"><span class="icon">N</span></span><a class="el" href="namespace_d3_d12_m_a.html" target="_self">D3D12MA</a></td><td class="desc"></td></tr>
|
||||
<tr id="row_0_0_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_d3_d12_m_a_1_1_allocation.html" target="_self">Allocation</a></td><td class="desc">Represents single memory allocation </td></tr>
|
||||
<tr id="row_0_1_" class="even"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s.html" target="_self">ALLOCATION_CALLBACKS</a></td><td class="desc">Custom callbacks to CPU memory allocation functions </td></tr>
|
||||
<tr id="row_0_2_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html" target="_self">ALLOCATION_DESC</a></td><td class="desc">Parameters of created <a class="el" href="class_d3_d12_m_a_1_1_allocation.html" title="Represents single memory allocation.">D3D12MA::Allocation</a> object. To be used with <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aa37d6b9fe8ea0864f7a35b9d68e8345a" title="Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation functi...">Allocator::CreateResource</a> </td></tr>
|
||||
<tr id="row_0_3_" class="even"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_d3_d12_m_a_1_1_allocator.html" target="_self">Allocator</a></td><td class="desc">Represents main object of this library initialized for particular <code>ID3D12Device</code> </td></tr>
|
||||
<tr id="row_0_4_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html" target="_self">ALLOCATOR_DESC</a></td><td class="desc">Parameters of created <a class="el" href="class_d3_d12_m_a_1_1_allocator.html" title="Represents main object of this library initialized for particular ID3D12Device.">Allocator</a> object. To be used with <a class="el" href="namespace_d3_d12_m_a.html#ab7a1cd1683986d75ce1488b0920f4cb0" title="Creates new main D3D12MA::Allocator object and returns it through ppAllocator.">CreateAllocator()</a> </td></tr>
|
||||
<tr id="row_0_5_" class="even"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_budget.html" target="_self">Budget</a></td><td class="desc">Statistics of current memory usage and available budget for a specific memory segment group </td></tr>
|
||||
<tr id="row_0_6_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html" target="_self">DEFRAGMENTATION_DESC</a></td><td class="desc">Parameters for defragmentation </td></tr>
|
||||
<tr id="row_0_7_" class="even"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e.html" target="_self">DEFRAGMENTATION_MOVE</a></td><td class="desc">Single move of an allocation to be done for defragmentation </td></tr>
|
||||
<tr id="row_0_8_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html" target="_self">DEFRAGMENTATION_PASS_MOVE_INFO</a></td><td class="desc">Parameters for incremental defragmentation steps </td></tr>
|
||||
<tr id="row_0_9_" class="even"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___s_t_a_t_s.html" target="_self">DEFRAGMENTATION_STATS</a></td><td class="desc">Statistics returned for defragmentation process by function <a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#a1c21c26f47dcbf8f4e562063a3e25f38" title="Returns statistics of the defragmentation performed so far.">DefragmentationContext::GetStats()</a> </td></tr>
|
||||
<tr id="row_0_10_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html" target="_self">DefragmentationContext</a></td><td class="desc">Represents defragmentation process in progress </td></tr>
|
||||
<tr id="row_0_11_" class="even"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_detailed_statistics.html" target="_self">DetailedStatistics</a></td><td class="desc">More detailed statistics than <a class="el" href="struct_d3_d12_m_a_1_1_statistics.html" title="Calculated statistics of memory usage e.g. in a specific memory heap type, memory segment group,...">D3D12MA::Statistics</a> </td></tr>
|
||||
<tr id="row_0_12_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_d3_d12_m_a_1_1_pool.html" target="_self">Pool</a></td><td class="desc">Custom memory pool </td></tr>
|
||||
<tr id="row_0_13_" class="even"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html" target="_self">POOL_DESC</a></td><td class="desc">Parameters of created <a class="el" href="class_d3_d12_m_a_1_1_pool.html" title="Custom memory pool.">D3D12MA::Pool</a> object. To be used with <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aac7b1f6bf53cbf4c4ce2264cb72ca515" title="Creates custom pool.">D3D12MA::Allocator::CreatePool</a> </td></tr>
|
||||
<tr id="row_0_14_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_statistics.html" target="_self">Statistics</a></td><td class="desc">Calculated statistics of memory usage e.g. in a specific memory heap type, memory segment group, custom pool, or total </td></tr>
|
||||
<tr id="row_0_15_" class="even"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_total_statistics.html" target="_self">TotalStatistics</a></td><td class="desc">General statistics from current state of the allocator - total memory usage across all memory heaps and segments </td></tr>
|
||||
<tr id="row_0_16_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___a_l_l_o_c_a_t_i_o_n___d_e_s_c.html" target="_self">VIRTUAL_ALLOCATION_DESC</a></td><td class="desc">Parameters of created virtual allocation to be passed to <a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#a9281daf76e888ea1bd5247d5732e8179" title="Creates new allocation.">VirtualBlock::Allocate()</a> </td></tr>
|
||||
<tr id="row_0_17_" class="even"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___a_l_l_o_c_a_t_i_o_n___i_n_f_o.html" target="_self">VIRTUAL_ALLOCATION_INFO</a></td><td class="desc">Parameters of an existing virtual allocation, returned by <a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#ac605dce05ca0d411e46079f0bad765d1" title="Returns information about an allocation - its offset, size and custom pointer.">VirtualBlock::GetAllocationInfo()</a> </td></tr>
|
||||
<tr id="row_0_18_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___b_l_o_c_k___d_e_s_c.html" target="_self">VIRTUAL_BLOCK_DESC</a></td><td class="desc">Parameters of created <a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html" title="Represents pure allocation algorithm and a data structure with allocations in some memory block,...">D3D12MA::VirtualBlock</a> object to be passed to <a class="el" href="namespace_d3_d12_m_a.html#ab024647ae85ee63e2fa2c1c4beac6d98" title="Creates new D3D12MA::VirtualBlock object and returns it through ppVirtualBlock.">CreateVirtualBlock()</a> </td></tr>
|
||||
<tr id="row_0_19_" class="even"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_d3_d12_m_a_1_1_virtual_allocation.html" target="_self">VirtualAllocation</a></td><td class="desc">Represents single memory allocation done inside <a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html" title="Represents pure allocation algorithm and a data structure with allocations in some memory block,...">VirtualBlock</a> </td></tr>
|
||||
<tr id="row_0_20_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html" target="_self">VirtualBlock</a></td><td class="desc">Represents pure allocation algorithm and a data structure with allocations in some memory block, without actually allocating any GPU memory </td></tr>
|
||||
</table>
|
||||
</div><!-- directory -->
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 676 B |
|
After Width: | Height: | Size: 635 B |
|
After Width: | Height: | Size: 147 B |
@@ -0,0 +1,111 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: Member List</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a></li><li class="navelem"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="headertitle"><div class="title">D3D12MA::Allocation Member List</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>This is the complete list of members for <a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a>, including all inherited members.</p>
|
||||
<table class="directory">
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a5c38846905b1ca0ff228c6081f2fc20c">allocHandle</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a413aec64eba9f4ec57e912511591b3b8">block</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a968f13f23d03e50cc50b87835b6d5a85">D3D12MA_DELETE</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"><span class="mlabel">friend</span></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a0acdc6b31e957b6d83762bdaace6d255">GetAlignment</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#adca8d5a82bed492fe7265fcda6e53da2">GetHeap</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a65fab0c479df1b6b72c9300e68dc6770">GetName</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a47be9557d441797b65de177a3d5cdf60">GetOffset</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#ae45eed901de5d16afe179f883028c5ee">GetPrivateData</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#ad00308118252f82d8f803c623c67bf18">GetResource</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a92c2fb6f22b28817eb83a59407d7dd30">GetSize</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a4e7380aabcac5b0a1cd833c5c84459c6">heap</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#ab1f59d849add2cdbfbebf4eb98db5c97">list</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a5b3d5b189021973d9934cbe9f5f266f0">m_Committed</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#adc7cf6224b7ca6205d1099a013f40424">m_Heap</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a35fca5f0b1c5eb46d0bb33cdb7ccc198">m_Placed</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a6f31560bc71451410a2a907b6d81b48f">next</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#adc3ac89758a915a409e047f9b89aa160">prev</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#af9e643276b577aa7f21937f75d4b82ac">SetName</a>(LPCWSTR Name)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a6f209094455dd876b6d9f84076ee1436">SetPrivateData</a>(void *pPrivateData)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a414a088c22bae0f29b1038f5f9346d14">SetResource</a>(ID3D12Resource *pResource)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html#a1b1ef2717beed503fcb3cb7e6a171762">WasZeroInitialized</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
</table></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,560 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: D3D12MA::Allocation Class Reference</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a></li><li class="navelem"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#pub-methods">Public Member Functions</a> |
|
||||
<a href="class_d3_d12_m_a_1_1_allocation-members.html">List of all members</a> </div>
|
||||
<div class="headertitle"><div class="title">D3D12MA::Allocation Class Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Represents single memory allocation.
|
||||
<a href="#details">More...</a></p>
|
||||
|
||||
<p><code>#include <D3D12MemAlloc.h></code></p>
|
||||
<div class="dynheader">
|
||||
Inheritance diagram for D3D12MA::Allocation:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center">
|
||||
<img src="class_d3_d12_m_a_1_1_allocation.png" alt=""/>
|
||||
</div></div>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
|
||||
Public Member Functions</h2></td></tr>
|
||||
<tr class="memitem:a47be9557d441797b65de177a3d5cdf60" id="r_a47be9557d441797b65de177a3d5cdf60"><td class="memItemLeft" align="right" valign="top">UINT64 </td><td class="memItemRight" valign="bottom"><a class="el" href="#a47be9557d441797b65de177a3d5cdf60">GetOffset</a> () const</td></tr>
|
||||
<tr class="memdesc:a47be9557d441797b65de177a3d5cdf60"><td class="mdescLeft"> </td><td class="mdescRight">Returns offset in bytes from the start of memory heap. <br /></td></tr>
|
||||
<tr class="separator:a47be9557d441797b65de177a3d5cdf60"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a0acdc6b31e957b6d83762bdaace6d255" id="r_a0acdc6b31e957b6d83762bdaace6d255"><td class="memItemLeft" align="right" valign="top">UINT64 </td><td class="memItemRight" valign="bottom"><a class="el" href="#a0acdc6b31e957b6d83762bdaace6d255">GetAlignment</a> () const</td></tr>
|
||||
<tr class="memdesc:a0acdc6b31e957b6d83762bdaace6d255"><td class="mdescLeft"> </td><td class="mdescRight">Returns alignment that resource was created with. <br /></td></tr>
|
||||
<tr class="separator:a0acdc6b31e957b6d83762bdaace6d255"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a92c2fb6f22b28817eb83a59407d7dd30" id="r_a92c2fb6f22b28817eb83a59407d7dd30"><td class="memItemLeft" align="right" valign="top">UINT64 </td><td class="memItemRight" valign="bottom"><a class="el" href="#a92c2fb6f22b28817eb83a59407d7dd30">GetSize</a> () const</td></tr>
|
||||
<tr class="memdesc:a92c2fb6f22b28817eb83a59407d7dd30"><td class="mdescLeft"> </td><td class="mdescRight">Returns size in bytes of the allocation. <br /></td></tr>
|
||||
<tr class="separator:a92c2fb6f22b28817eb83a59407d7dd30"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ad00308118252f82d8f803c623c67bf18" id="r_ad00308118252f82d8f803c623c67bf18"><td class="memItemLeft" align="right" valign="top">ID3D12Resource * </td><td class="memItemRight" valign="bottom"><a class="el" href="#ad00308118252f82d8f803c623c67bf18">GetResource</a> () const</td></tr>
|
||||
<tr class="memdesc:ad00308118252f82d8f803c623c67bf18"><td class="mdescLeft"> </td><td class="mdescRight">Returns D3D12 resource associated with this object. <br /></td></tr>
|
||||
<tr class="separator:ad00308118252f82d8f803c623c67bf18"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a414a088c22bae0f29b1038f5f9346d14" id="r_a414a088c22bae0f29b1038f5f9346d14"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a414a088c22bae0f29b1038f5f9346d14">SetResource</a> (ID3D12Resource *pResource)</td></tr>
|
||||
<tr class="memdesc:a414a088c22bae0f29b1038f5f9346d14"><td class="mdescLeft"> </td><td class="mdescRight">Releases the resource currently pointed by the allocation (if any), sets it to new one, incrementing its reference counter (if not null). <br /></td></tr>
|
||||
<tr class="separator:a414a088c22bae0f29b1038f5f9346d14"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:adca8d5a82bed492fe7265fcda6e53da2" id="r_adca8d5a82bed492fe7265fcda6e53da2"><td class="memItemLeft" align="right" valign="top">ID3D12Heap * </td><td class="memItemRight" valign="bottom"><a class="el" href="#adca8d5a82bed492fe7265fcda6e53da2">GetHeap</a> () const</td></tr>
|
||||
<tr class="memdesc:adca8d5a82bed492fe7265fcda6e53da2"><td class="mdescLeft"> </td><td class="mdescRight">Returns memory heap that the resource is created in. <br /></td></tr>
|
||||
<tr class="separator:adca8d5a82bed492fe7265fcda6e53da2"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a6f209094455dd876b6d9f84076ee1436" id="r_a6f209094455dd876b6d9f84076ee1436"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a6f209094455dd876b6d9f84076ee1436">SetPrivateData</a> (void *pPrivateData)</td></tr>
|
||||
<tr class="memdesc:a6f209094455dd876b6d9f84076ee1436"><td class="mdescLeft"> </td><td class="mdescRight">Changes custom pointer for an allocation to a new value. <br /></td></tr>
|
||||
<tr class="separator:a6f209094455dd876b6d9f84076ee1436"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ae45eed901de5d16afe179f883028c5ee" id="r_ae45eed901de5d16afe179f883028c5ee"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae45eed901de5d16afe179f883028c5ee">GetPrivateData</a> () const</td></tr>
|
||||
<tr class="memdesc:ae45eed901de5d16afe179f883028c5ee"><td class="mdescLeft"> </td><td class="mdescRight">Get custom pointer associated with the allocation. <br /></td></tr>
|
||||
<tr class="separator:ae45eed901de5d16afe179f883028c5ee"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:af9e643276b577aa7f21937f75d4b82ac" id="r_af9e643276b577aa7f21937f75d4b82ac"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#af9e643276b577aa7f21937f75d4b82ac">SetName</a> (LPCWSTR Name)</td></tr>
|
||||
<tr class="memdesc:af9e643276b577aa7f21937f75d4b82ac"><td class="mdescLeft"> </td><td class="mdescRight">Associates a name with the allocation object. This name is for use in debug diagnostics and tools. <br /></td></tr>
|
||||
<tr class="separator:af9e643276b577aa7f21937f75d4b82ac"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a65fab0c479df1b6b72c9300e68dc6770" id="r_a65fab0c479df1b6b72c9300e68dc6770"><td class="memItemLeft" align="right" valign="top">LPCWSTR </td><td class="memItemRight" valign="bottom"><a class="el" href="#a65fab0c479df1b6b72c9300e68dc6770">GetName</a> () const</td></tr>
|
||||
<tr class="memdesc:a65fab0c479df1b6b72c9300e68dc6770"><td class="mdescLeft"> </td><td class="mdescRight">Returns the name associated with the allocation object. <br /></td></tr>
|
||||
<tr class="separator:a65fab0c479df1b6b72c9300e68dc6770"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a1b1ef2717beed503fcb3cb7e6a171762" id="r_a1b1ef2717beed503fcb3cb7e6a171762"><td class="memItemLeft" align="right" valign="top">BOOL </td><td class="memItemRight" valign="bottom"><a class="el" href="#a1b1ef2717beed503fcb3cb7e6a171762">WasZeroInitialized</a> () const</td></tr>
|
||||
<tr class="memdesc:a1b1ef2717beed503fcb3cb7e6a171762"><td class="mdescLeft"> </td><td class="mdescRight">Returns <code>TRUE</code> if the memory of the allocation was filled with zeros when the allocation was created. <br /></td></tr>
|
||||
<tr class="separator:a1b1ef2717beed503fcb3cb7e6a171762"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Represents single memory allocation. </p>
|
||||
<p>It may be either implicit memory heap dedicated to a single resource or a specific region of a bigger heap plus unique offset.</p>
|
||||
<p>To create such object, fill structure <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html" title="Parameters of created D3D12MA::Allocation object. To be used with Allocator::CreateResource.">D3D12MA::ALLOCATION_DESC</a> and call function <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aa37d6b9fe8ea0864f7a35b9d68e8345a" title="Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation functi...">Allocator::CreateResource</a>.</p>
|
||||
<p>The object remembers size and some other information. To retrieve this information, use methods of this class.</p>
|
||||
<p>The object also remembers <code>ID3D12Resource</code> and "owns" a reference to it, so it calls <code>Release()</code> on the resource when destroyed. </p>
|
||||
</div><h2 class="groupheader">Member Function Documentation</h2>
|
||||
<a id="a0acdc6b31e957b6d83762bdaace6d255" name="a0acdc6b31e957b6d83762bdaace6d255"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a0acdc6b31e957b6d83762bdaace6d255">◆ </a></span>GetAlignment()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="mlabels">
|
||||
<tr>
|
||||
<td class="mlabels-left">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">UINT64 D3D12MA::Allocation::GetAlignment </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns alignment that resource was created with. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="adca8d5a82bed492fe7265fcda6e53da2" name="adca8d5a82bed492fe7265fcda6e53da2"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#adca8d5a82bed492fe7265fcda6e53da2">◆ </a></span>GetHeap()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">ID3D12Heap * D3D12MA::Allocation::GetHeap </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns memory heap that the resource is created in. </p>
|
||||
<p>If the <a class="el" href="class_d3_d12_m_a_1_1_allocation.html" title="Represents single memory allocation.">Allocation</a> represents committed resource with implicit heap, returns NULL. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a65fab0c479df1b6b72c9300e68dc6770" name="a65fab0c479df1b6b72c9300e68dc6770"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a65fab0c479df1b6b72c9300e68dc6770">◆ </a></span>GetName()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="mlabels">
|
||||
<tr>
|
||||
<td class="mlabels-left">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">LPCWSTR D3D12MA::Allocation::GetName </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns the name associated with the allocation object. </p>
|
||||
<p>Returned string points to an internal copy.</p>
|
||||
<p>If no name was associated with the allocation, returns null. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a47be9557d441797b65de177a3d5cdf60" name="a47be9557d441797b65de177a3d5cdf60"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a47be9557d441797b65de177a3d5cdf60">◆ </a></span>GetOffset()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">UINT64 D3D12MA::Allocation::GetOffset </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns offset in bytes from the start of memory heap. </p>
|
||||
<p>You usually don't need to use this offset. If you create a buffer or a texture together with the allocation using function <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aa37d6b9fe8ea0864f7a35b9d68e8345a" title="Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation functi...">D3D12MA::Allocator::CreateResource</a>, functions that operate on that resource refer to the beginning of the resource, not entire memory heap.</p>
|
||||
<p>If the <a class="el" href="class_d3_d12_m_a_1_1_allocation.html" title="Represents single memory allocation.">Allocation</a> represents committed resource with implicit heap, returns 0. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae45eed901de5d16afe179f883028c5ee" name="ae45eed901de5d16afe179f883028c5ee"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae45eed901de5d16afe179f883028c5ee">◆ </a></span>GetPrivateData()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="mlabels">
|
||||
<tr>
|
||||
<td class="mlabels-left">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void * D3D12MA::Allocation::GetPrivateData </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Get custom pointer associated with the allocation. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ad00308118252f82d8f803c623c67bf18" name="ad00308118252f82d8f803c623c67bf18"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ad00308118252f82d8f803c623c67bf18">◆ </a></span>GetResource()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="mlabels">
|
||||
<tr>
|
||||
<td class="mlabels-left">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">ID3D12Resource * D3D12MA::Allocation::GetResource </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns D3D12 resource associated with this object. </p>
|
||||
<p>Calling this method doesn't increment resource's reference counter. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a92c2fb6f22b28817eb83a59407d7dd30" name="a92c2fb6f22b28817eb83a59407d7dd30"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a92c2fb6f22b28817eb83a59407d7dd30">◆ </a></span>GetSize()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="mlabels">
|
||||
<tr>
|
||||
<td class="mlabels-left">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">UINT64 D3D12MA::Allocation::GetSize </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns size in bytes of the allocation. </p>
|
||||
<ul>
|
||||
<li>If you created a buffer or a texture together with the allocation using function <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aa37d6b9fe8ea0864f7a35b9d68e8345a" title="Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation functi...">D3D12MA::Allocator::CreateResource</a>, this is the size of the resource returned by <code>ID3D12Device::GetResourceAllocationInfo</code>.</li>
|
||||
<li>For allocations made out of bigger memory blocks, this also is the size of the memory region assigned exclusively to this allocation.</li>
|
||||
<li>For resources created as committed, this value may not be accurate. DirectX implementation may optimize memory usage internally so that you may even observe regions of <code>ID3D12Resource::GetGPUVirtualAddress()</code> + <a class="el" href="#a92c2fb6f22b28817eb83a59407d7dd30" title="Returns size in bytes of the allocation.">Allocation::GetSize()</a> to overlap in memory and still work correctly. </li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="af9e643276b577aa7f21937f75d4b82ac" name="af9e643276b577aa7f21937f75d4b82ac"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#af9e643276b577aa7f21937f75d4b82ac">◆ </a></span>SetName()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::Allocation::SetName </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">LPCWSTR</td> <td class="paramname"><span class="paramname"><em>Name</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Associates a name with the allocation object. This name is for use in debug diagnostics and tools. </p>
|
||||
<p>Internal copy of the string is made, so the memory pointed by the argument can be changed of freed immediately after this call.</p>
|
||||
<p><code>Name</code> can be null. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a6f209094455dd876b6d9f84076ee1436" name="a6f209094455dd876b6d9f84076ee1436"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a6f209094455dd876b6d9f84076ee1436">◆ </a></span>SetPrivateData()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="mlabels">
|
||||
<tr>
|
||||
<td class="mlabels-left">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::Allocation::SetPrivateData </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">void *</td> <td class="paramname"><span class="paramname"><em>pPrivateData</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Changes custom pointer for an allocation to a new value. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a414a088c22bae0f29b1038f5f9346d14" name="a414a088c22bae0f29b1038f5f9346d14"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a414a088c22bae0f29b1038f5f9346d14">◆ </a></span>SetResource()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::Allocation::SetResource </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">ID3D12Resource *</td> <td class="paramname"><span class="paramname"><em>pResource</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Releases the resource currently pointed by the allocation (if any), sets it to new one, incrementing its reference counter (if not null). </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a1b1ef2717beed503fcb3cb7e6a171762" name="a1b1ef2717beed503fcb3cb7e6a171762"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a1b1ef2717beed503fcb3cb7e6a171762">◆ </a></span>WasZeroInitialized()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="mlabels">
|
||||
<tr>
|
||||
<td class="mlabels-left">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">BOOL D3D12MA::Allocation::WasZeroInitialized </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns <code>TRUE</code> if the memory of the allocation was filled with zeros when the allocation was created. </p>
|
||||
<p>Returns <code>TRUE</code> only if the allocator is sure that the entire memory where the allocation was created was filled with zeros at the moment the allocation was made.</p>
|
||||
<p>Returns <code>FALSE</code> if the memory could potentially contain garbage data. If it's a render-target or depth-stencil texture, it then needs proper initialization with <code>ClearRenderTargetView</code>, <code>ClearDepthStencilView</code>, <code>DiscardResource</code>, or a copy operation, as described on page "ID3D12Device::CreatePlacedResource method - Notes on the required resource initialization" in Microsoft documentation. Please note that rendering a fullscreen triangle or quad to the texture as a render target is not a proper way of initialization!</p>
|
||||
<p>See also articles:</p>
|
||||
<ul>
|
||||
<li>"Coming to DirectX 12: More control over memory allocation" on DirectX Developer Blog</li>
|
||||
<li><a href="https://asawicki.info/news_1724_initializing_dx12_textures_after_allocation_and_aliasing">"Initializing DX12 Textures After Allocation and Aliasing"</a>. </li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<h2 class="groupheader">Member Data Documentation</h2>
|
||||
<a id="a5c38846905b1ca0ff228c6081f2fc20c" name="a5c38846905b1ca0ff228c6081f2fc20c"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a5c38846905b1ca0ff228c6081f2fc20c">◆ </a></span>allocHandle</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname"><a class="el" href="namespace_d3_d12_m_a.html#a15e349adce86a40e0417d405aef1af80">AllocHandle</a> D3D12MA::Allocation::allocHandle</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a413aec64eba9f4ec57e912511591b3b8" name="a413aec64eba9f4ec57e912511591b3b8"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a413aec64eba9f4ec57e912511591b3b8">◆ </a></span>block</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">NormalBlock* D3D12MA::Allocation::block</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a4e7380aabcac5b0a1cd833c5c84459c6" name="a4e7380aabcac5b0a1cd833c5c84459c6"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a4e7380aabcac5b0a1cd833c5c84459c6">◆ </a></span>heap</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">ID3D12Heap* D3D12MA::Allocation::heap</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ab1f59d849add2cdbfbebf4eb98db5c97" name="ab1f59d849add2cdbfbebf4eb98db5c97"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ab1f59d849add2cdbfbebf4eb98db5c97">◆ </a></span>list</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname"><a class="el" href="#a49c0b7395d40df48949fc68599058a06">CommittedAllocationList</a>* D3D12MA::Allocation::list</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a5b3d5b189021973d9934cbe9f5f266f0" name="a5b3d5b189021973d9934cbe9f5f266f0"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a5b3d5b189021973d9934cbe9f5f266f0">◆ </a></span>[struct]</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">struct { ... } D3D12MA::Allocation::m_Committed</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="adc7cf6224b7ca6205d1099a013f40424" name="adc7cf6224b7ca6205d1099a013f40424"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#adc7cf6224b7ca6205d1099a013f40424">◆ </a></span>[struct]</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">struct { ... } D3D12MA::Allocation::m_Heap</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a35fca5f0b1c5eb46d0bb33cdb7ccc198" name="a35fca5f0b1c5eb46d0bb33cdb7ccc198"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a35fca5f0b1c5eb46d0bb33cdb7ccc198">◆ </a></span>[struct]</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">struct { ... } D3D12MA::Allocation::m_Placed</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a6f31560bc71451410a2a907b6d81b48f" name="a6f31560bc71451410a2a907b6d81b48f"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a6f31560bc71451410a2a907b6d81b48f">◆ </a></span>next</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a>* D3D12MA::Allocation::next</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="adc3ac89758a915a409e047f9b89aa160" name="adc3ac89758a915a409e047f9b89aa160"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#adc3ac89758a915a409e047f9b89aa160">◆ </a></span>prev</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a>* D3D12MA::Allocation::prev</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<hr/>The documentation for this class was generated from the following file:<ul>
|
||||
<li>D:/PROJECTS/D3D12 Memory Allocator/REPO/include/<a class="el" href="_d3_d12_mem_alloc_8h.html">D3D12MemAlloc.h</a></li>
|
||||
</ul>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 538 B |
@@ -0,0 +1,110 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: Member List</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a></li><li class="navelem"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">Allocator</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="headertitle"><div class="title">D3D12MA::Allocator Member List</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>This is the complete list of members for <a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a>, including all inherited members.</p>
|
||||
<table class="directory">
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#acb8a10a5ea30171ce60128286aec5ee2">AllocateMemory</a>(const ALLOCATION_DESC *pAllocDesc, const D3D12_RESOURCE_ALLOCATION_INFO *pAllocInfo, Allocation **ppAllocation)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a08e1468f1dbb63ce3bf6680e592b2143">BeginDefragmentation</a>(const DEFRAGMENTATION_DESC *pDesc, DefragmentationContext **ppContext)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a29716b3084916abed7793bf2ec4b65db">BuildStatsString</a>(WCHAR **ppStatsString, BOOL DetailedMap) const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a99db00df909963573a976c203b107d22">CalculateStatistics</a>(TotalStatistics *pStats)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#ab45536f92410aedb7be44ea36b1b4717">CreateAliasingResource</a>(Allocation *pAllocation, UINT64 AllocationLocalOffset, const D3D12_RESOURCE_DESC *pResourceDesc, D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riidResource, void **ppvResource)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#ad3b83cc5707cb4ed92bc277069c4ddd6">CreateAliasingResource1</a>(Allocation *pAllocation, UINT64 AllocationLocalOffset, const D3D12_RESOURCE_DESC1 *pResourceDesc, D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riidResource, void **ppvResource)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a562cbaa71cbd333cade09cd67ed82453">CreateAliasingResource2</a>(Allocation *pAllocation, UINT64 AllocationLocalOffset, const D3D12_RESOURCE_DESC1 *pResourceDesc, D3D12_BARRIER_LAYOUT InitialLayout, const D3D12_CLEAR_VALUE *pOptimizedClearValue, UINT32 NumCastableFormats, DXGI_FORMAT *pCastableFormats, REFIID riidResource, void **ppvResource)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a458f044fdc81e4a0b147e99ffcf73459">CreateAllocator</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"><span class="mlabel">friend</span></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aac7b1f6bf53cbf4c4ce2264cb72ca515">CreatePool</a>(const POOL_DESC *pPoolDesc, Pool **ppPool)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aa37d6b9fe8ea0864f7a35b9d68e8345a">CreateResource</a>(const ALLOCATION_DESC *pAllocDesc, const D3D12_RESOURCE_DESC *pResourceDesc, D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, Allocation **ppAllocation, REFIID riidResource, void **ppvResource)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a7a1c79c79a7a573c438aa45c4a531b96">CreateResource2</a>(const ALLOCATION_DESC *pAllocDesc, const D3D12_RESOURCE_DESC1 *pResourceDesc, D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, Allocation **ppAllocation, REFIID riidResource, void **ppvResource)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a323b2af320b01d0fdecfc515c75db747">CreateResource3</a>(const ALLOCATION_DESC *pAllocDesc, const D3D12_RESOURCE_DESC1 *pResourceDesc, D3D12_BARRIER_LAYOUT InitialLayout, const D3D12_CLEAR_VALUE *pOptimizedClearValue, UINT32 NumCastableFormats, DXGI_FORMAT *pCastableFormats, Allocation **ppAllocation, REFIID riidResource, void **ppvResource)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a968f13f23d03e50cc50b87835b6d5a85">D3D12MA_DELETE</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"><span class="mlabel">friend</span></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a8392663494384c16d8bfa12b827b4f9c">FreeStatsString</a>(WCHAR *pStatsString) const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a1ac113daec5f6ef28ecb1786cf544144">GetBudget</a>(Budget *pLocalBudget, Budget *pNonLocalBudget)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#ae276d2358a58a36f8c6639f837f29be5">GetD3D12Options</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a434ae3147209953253da26687bfd62dc">GetMemoryCapacity</a>(UINT memorySegmentGroup) const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a08210561b92c4bd7ede9dd7beba4bb80">IsCacheCoherentUMA</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a9e742884bd45dd7f01193d13fcd05af0">IsUMA</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a468ba0c93121eaaee402b08775f1dd11">SetCurrentFrameIndex</a>(UINT frameIndex)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></td><td class="entry"></td></tr>
|
||||
</table></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,839 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: D3D12MA::Allocator Class Reference</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a></li><li class="navelem"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">Allocator</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#pub-methods">Public Member Functions</a> |
|
||||
<a href="class_d3_d12_m_a_1_1_allocator-members.html">List of all members</a> </div>
|
||||
<div class="headertitle"><div class="title">D3D12MA::Allocator Class Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Represents main object of this library initialized for particular <code>ID3D12Device</code>.
|
||||
<a href="#details">More...</a></p>
|
||||
|
||||
<p><code>#include <D3D12MemAlloc.h></code></p>
|
||||
<div class="dynheader">
|
||||
Inheritance diagram for D3D12MA::Allocator:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center">
|
||||
<img src="class_d3_d12_m_a_1_1_allocator.png" alt=""/>
|
||||
</div></div>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
|
||||
Public Member Functions</h2></td></tr>
|
||||
<tr class="memitem:ae276d2358a58a36f8c6639f837f29be5" id="r_ae276d2358a58a36f8c6639f837f29be5"><td class="memItemLeft" align="right" valign="top">const D3D12_FEATURE_DATA_D3D12_OPTIONS & </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae276d2358a58a36f8c6639f837f29be5">GetD3D12Options</a> () const</td></tr>
|
||||
<tr class="memdesc:ae276d2358a58a36f8c6639f837f29be5"><td class="mdescLeft"> </td><td class="mdescRight">Returns cached options retrieved from D3D12 device. <br /></td></tr>
|
||||
<tr class="separator:ae276d2358a58a36f8c6639f837f29be5"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a9e742884bd45dd7f01193d13fcd05af0" id="r_a9e742884bd45dd7f01193d13fcd05af0"><td class="memItemLeft" align="right" valign="top">BOOL </td><td class="memItemRight" valign="bottom"><a class="el" href="#a9e742884bd45dd7f01193d13fcd05af0">IsUMA</a> () const</td></tr>
|
||||
<tr class="memdesc:a9e742884bd45dd7f01193d13fcd05af0"><td class="mdescLeft"> </td><td class="mdescRight">Returns true if <code>D3D12_FEATURE_DATA_ARCHITECTURE1::UMA</code> was found to be true. <br /></td></tr>
|
||||
<tr class="separator:a9e742884bd45dd7f01193d13fcd05af0"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a08210561b92c4bd7ede9dd7beba4bb80" id="r_a08210561b92c4bd7ede9dd7beba4bb80"><td class="memItemLeft" align="right" valign="top">BOOL </td><td class="memItemRight" valign="bottom"><a class="el" href="#a08210561b92c4bd7ede9dd7beba4bb80">IsCacheCoherentUMA</a> () const</td></tr>
|
||||
<tr class="memdesc:a08210561b92c4bd7ede9dd7beba4bb80"><td class="mdescLeft"> </td><td class="mdescRight">Returns true if <code>D3D12_FEATURE_DATA_ARCHITECTURE1::CacheCoherentUMA</code> was found to be true. <br /></td></tr>
|
||||
<tr class="separator:a08210561b92c4bd7ede9dd7beba4bb80"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a434ae3147209953253da26687bfd62dc" id="r_a434ae3147209953253da26687bfd62dc"><td class="memItemLeft" align="right" valign="top">UINT64 </td><td class="memItemRight" valign="bottom"><a class="el" href="#a434ae3147209953253da26687bfd62dc">GetMemoryCapacity</a> (UINT memorySegmentGroup) const</td></tr>
|
||||
<tr class="memdesc:a434ae3147209953253da26687bfd62dc"><td class="mdescLeft"> </td><td class="mdescRight">Returns total amount of memory of specific segment group, in bytes. <br /></td></tr>
|
||||
<tr class="separator:a434ae3147209953253da26687bfd62dc"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aa37d6b9fe8ea0864f7a35b9d68e8345a" id="r_aa37d6b9fe8ea0864f7a35b9d68e8345a"><td class="memItemLeft" align="right" valign="top">HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="#aa37d6b9fe8ea0864f7a35b9d68e8345a">CreateResource</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *pAllocDesc, const D3D12_RESOURCE_DESC *pResourceDesc, D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, <a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **ppAllocation, REFIID riidResource, void **ppvResource)</td></tr>
|
||||
<tr class="memdesc:aa37d6b9fe8ea0864f7a35b9d68e8345a"><td class="mdescLeft"> </td><td class="mdescRight">Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation function. <br /></td></tr>
|
||||
<tr class="separator:aa37d6b9fe8ea0864f7a35b9d68e8345a"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a7a1c79c79a7a573c438aa45c4a531b96" id="r_a7a1c79c79a7a573c438aa45c4a531b96"><td class="memItemLeft" align="right" valign="top">HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="#a7a1c79c79a7a573c438aa45c4a531b96">CreateResource2</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *pAllocDesc, const D3D12_RESOURCE_DESC1 *pResourceDesc, D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, <a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **ppAllocation, REFIID riidResource, void **ppvResource)</td></tr>
|
||||
<tr class="memdesc:a7a1c79c79a7a573c438aa45c4a531b96"><td class="mdescLeft"> </td><td class="mdescRight">Similar to <a class="el" href="#aa37d6b9fe8ea0864f7a35b9d68e8345a" title="Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation functi...">Allocator::CreateResource</a>, but supports new structure <code>D3D12_RESOURCE_DESC1</code>. <br /></td></tr>
|
||||
<tr class="separator:a7a1c79c79a7a573c438aa45c4a531b96"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a323b2af320b01d0fdecfc515c75db747" id="r_a323b2af320b01d0fdecfc515c75db747"><td class="memItemLeft" align="right" valign="top">HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="#a323b2af320b01d0fdecfc515c75db747">CreateResource3</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *pAllocDesc, const D3D12_RESOURCE_DESC1 *pResourceDesc, D3D12_BARRIER_LAYOUT InitialLayout, const D3D12_CLEAR_VALUE *pOptimizedClearValue, UINT32 NumCastableFormats, DXGI_FORMAT *pCastableFormats, <a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **ppAllocation, REFIID riidResource, void **ppvResource)</td></tr>
|
||||
<tr class="memdesc:a323b2af320b01d0fdecfc515c75db747"><td class="mdescLeft"> </td><td class="mdescRight">Similar to <a class="el" href="#a7a1c79c79a7a573c438aa45c4a531b96" title="Similar to Allocator::CreateResource, but supports new structure D3D12_RESOURCE_DESC1.">Allocator::CreateResource2</a>, but there are initial layout instead of state and castable formats list. <br /></td></tr>
|
||||
<tr class="separator:a323b2af320b01d0fdecfc515c75db747"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:acb8a10a5ea30171ce60128286aec5ee2" id="r_acb8a10a5ea30171ce60128286aec5ee2"><td class="memItemLeft" align="right" valign="top">HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="#acb8a10a5ea30171ce60128286aec5ee2">AllocateMemory</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *pAllocDesc, const D3D12_RESOURCE_ALLOCATION_INFO *pAllocInfo, <a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **ppAllocation)</td></tr>
|
||||
<tr class="memdesc:acb8a10a5ea30171ce60128286aec5ee2"><td class="mdescLeft"> </td><td class="mdescRight">Allocates memory without creating any resource placed in it. <br /></td></tr>
|
||||
<tr class="separator:acb8a10a5ea30171ce60128286aec5ee2"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ab45536f92410aedb7be44ea36b1b4717" id="r_ab45536f92410aedb7be44ea36b1b4717"><td class="memItemLeft" align="right" valign="top">HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="#ab45536f92410aedb7be44ea36b1b4717">CreateAliasingResource</a> (<a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> *pAllocation, UINT64 AllocationLocalOffset, const D3D12_RESOURCE_DESC *pResourceDesc, D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riidResource, void **ppvResource)</td></tr>
|
||||
<tr class="memdesc:ab45536f92410aedb7be44ea36b1b4717"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new resource in place of an existing allocation. This is useful for memory aliasing. <br /></td></tr>
|
||||
<tr class="separator:ab45536f92410aedb7be44ea36b1b4717"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ad3b83cc5707cb4ed92bc277069c4ddd6" id="r_ad3b83cc5707cb4ed92bc277069c4ddd6"><td class="memItemLeft" align="right" valign="top">HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="#ad3b83cc5707cb4ed92bc277069c4ddd6">CreateAliasingResource1</a> (<a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> *pAllocation, UINT64 AllocationLocalOffset, const D3D12_RESOURCE_DESC1 *pResourceDesc, D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riidResource, void **ppvResource)</td></tr>
|
||||
<tr class="memdesc:ad3b83cc5707cb4ed92bc277069c4ddd6"><td class="mdescLeft"> </td><td class="mdescRight">Similar to <a class="el" href="#ab45536f92410aedb7be44ea36b1b4717" title="Creates a new resource in place of an existing allocation. This is useful for memory aliasing.">Allocator::CreateAliasingResource</a>, but supports new structure <code>D3D12_RESOURCE_DESC1</code>. <br /></td></tr>
|
||||
<tr class="separator:ad3b83cc5707cb4ed92bc277069c4ddd6"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a562cbaa71cbd333cade09cd67ed82453" id="r_a562cbaa71cbd333cade09cd67ed82453"><td class="memItemLeft" align="right" valign="top">HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="#a562cbaa71cbd333cade09cd67ed82453">CreateAliasingResource2</a> (<a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> *pAllocation, UINT64 AllocationLocalOffset, const D3D12_RESOURCE_DESC1 *pResourceDesc, D3D12_BARRIER_LAYOUT InitialLayout, const D3D12_CLEAR_VALUE *pOptimizedClearValue, UINT32 NumCastableFormats, DXGI_FORMAT *pCastableFormats, REFIID riidResource, void **ppvResource)</td></tr>
|
||||
<tr class="memdesc:a562cbaa71cbd333cade09cd67ed82453"><td class="mdescLeft"> </td><td class="mdescRight">Similar to <a class="el" href="#ad3b83cc5707cb4ed92bc277069c4ddd6" title="Similar to Allocator::CreateAliasingResource, but supports new structure D3D12_RESOURCE_DESC1.">Allocator::CreateAliasingResource1</a>, but there are initial layout instead of state and castable formats list. <br /></td></tr>
|
||||
<tr class="separator:a562cbaa71cbd333cade09cd67ed82453"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aac7b1f6bf53cbf4c4ce2264cb72ca515" id="r_aac7b1f6bf53cbf4c4ce2264cb72ca515"><td class="memItemLeft" align="right" valign="top">HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="#aac7b1f6bf53cbf4c4ce2264cb72ca515">CreatePool</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html">POOL_DESC</a> *pPoolDesc, <a class="el" href="class_d3_d12_m_a_1_1_pool.html">Pool</a> **ppPool)</td></tr>
|
||||
<tr class="memdesc:aac7b1f6bf53cbf4c4ce2264cb72ca515"><td class="mdescLeft"> </td><td class="mdescRight">Creates custom pool. <br /></td></tr>
|
||||
<tr class="separator:aac7b1f6bf53cbf4c4ce2264cb72ca515"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a468ba0c93121eaaee402b08775f1dd11" id="r_a468ba0c93121eaaee402b08775f1dd11"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a468ba0c93121eaaee402b08775f1dd11">SetCurrentFrameIndex</a> (UINT frameIndex)</td></tr>
|
||||
<tr class="memdesc:a468ba0c93121eaaee402b08775f1dd11"><td class="mdescLeft"> </td><td class="mdescRight">Sets the index of the current frame. <br /></td></tr>
|
||||
<tr class="separator:a468ba0c93121eaaee402b08775f1dd11"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a1ac113daec5f6ef28ecb1786cf544144" id="r_a1ac113daec5f6ef28ecb1786cf544144"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a1ac113daec5f6ef28ecb1786cf544144">GetBudget</a> (<a class="el" href="struct_d3_d12_m_a_1_1_budget.html">Budget</a> *pLocalBudget, <a class="el" href="struct_d3_d12_m_a_1_1_budget.html">Budget</a> *pNonLocalBudget)</td></tr>
|
||||
<tr class="memdesc:a1ac113daec5f6ef28ecb1786cf544144"><td class="mdescLeft"> </td><td class="mdescRight">Retrieves information about current memory usage and budget. <br /></td></tr>
|
||||
<tr class="separator:a1ac113daec5f6ef28ecb1786cf544144"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a99db00df909963573a976c203b107d22" id="r_a99db00df909963573a976c203b107d22"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a99db00df909963573a976c203b107d22">CalculateStatistics</a> (<a class="el" href="struct_d3_d12_m_a_1_1_total_statistics.html">TotalStatistics</a> *pStats)</td></tr>
|
||||
<tr class="memdesc:a99db00df909963573a976c203b107d22"><td class="mdescLeft"> </td><td class="mdescRight">Retrieves statistics from current state of the allocator. <br /></td></tr>
|
||||
<tr class="separator:a99db00df909963573a976c203b107d22"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a29716b3084916abed7793bf2ec4b65db" id="r_a29716b3084916abed7793bf2ec4b65db"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a29716b3084916abed7793bf2ec4b65db">BuildStatsString</a> (WCHAR **ppStatsString, BOOL DetailedMap) const</td></tr>
|
||||
<tr class="memdesc:a29716b3084916abed7793bf2ec4b65db"><td class="mdescLeft"> </td><td class="mdescRight">Builds and returns statistics as a string in JSON format. <br /></td></tr>
|
||||
<tr class="separator:a29716b3084916abed7793bf2ec4b65db"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a8392663494384c16d8bfa12b827b4f9c" id="r_a8392663494384c16d8bfa12b827b4f9c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a8392663494384c16d8bfa12b827b4f9c">FreeStatsString</a> (WCHAR *pStatsString) const</td></tr>
|
||||
<tr class="memdesc:a8392663494384c16d8bfa12b827b4f9c"><td class="mdescLeft"> </td><td class="mdescRight">Frees memory of a string returned from <a class="el" href="#a29716b3084916abed7793bf2ec4b65db" title="Builds and returns statistics as a string in JSON format.">Allocator::BuildStatsString</a>. <br /></td></tr>
|
||||
<tr class="separator:a8392663494384c16d8bfa12b827b4f9c"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a08e1468f1dbb63ce3bf6680e592b2143" id="r_a08e1468f1dbb63ce3bf6680e592b2143"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a08e1468f1dbb63ce3bf6680e592b2143">BeginDefragmentation</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html">DEFRAGMENTATION_DESC</a> *pDesc, <a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">DefragmentationContext</a> **ppContext)</td></tr>
|
||||
<tr class="memdesc:a08e1468f1dbb63ce3bf6680e592b2143"><td class="mdescLeft"> </td><td class="mdescRight">Begins defragmentation process of the default pools. <br /></td></tr>
|
||||
<tr class="separator:a08e1468f1dbb63ce3bf6680e592b2143"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Represents main object of this library initialized for particular <code>ID3D12Device</code>. </p>
|
||||
<p>Fill structure <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html" title="Parameters of created Allocator object. To be used with CreateAllocator().">D3D12MA::ALLOCATOR_DESC</a> and call function <a class="el" href="#a458f044fdc81e4a0b147e99ffcf73459" title="Creates new main D3D12MA::Allocator object and returns it through ppAllocator.">CreateAllocator()</a> to create it. Call method <code>Release()</code> to destroy it.</p>
|
||||
<p>It is recommended to create just one object of this type per <code>ID3D12Device</code> object, right after Direct3D 12 is initialized and keep it alive until before Direct3D device is destroyed. </p>
|
||||
</div><h2 class="groupheader">Member Function Documentation</h2>
|
||||
<a id="acb8a10a5ea30171ce60128286aec5ee2" name="acb8a10a5ea30171ce60128286aec5ee2"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#acb8a10a5ea30171ce60128286aec5ee2">◆ </a></span>AllocateMemory()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">HRESULT D3D12MA::Allocator::AllocateMemory </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *</td> <td class="paramname"><span class="paramname"><em>pAllocDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_RESOURCE_ALLOCATION_INFO *</td> <td class="paramname"><span class="paramname"><em>pAllocInfo</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **</td> <td class="paramname"><span class="paramname"><em>ppAllocation</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Allocates memory without creating any resource placed in it. </p>
|
||||
<p>This function is similar to <code>ID3D12Device::CreateHeap</code>, but it may really assign part of a larger, existing heap to the allocation.</p>
|
||||
<p><code>pAllocDesc->heapFlags</code> should contain one of these values, depending on type of resources you are going to create in this memory: <code>D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS</code>, <code>D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES</code>, <code>D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES</code>. Except if you validate that ResourceHeapTier = 2 - then <code>heapFlags</code> may be <code>D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES</code> = 0. Additional flags in <code>heapFlags</code> are allowed as well.</p>
|
||||
<p><code>pAllocInfo->SizeInBytes</code> must be multiply of 64KB. <code>pAllocInfo->Alignment</code> must be one of the legal values as described in documentation of <code>D3D12_HEAP_DESC</code>.</p>
|
||||
<p>If you use <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645ea661a5472dba3dcecc5a2cc92afd25675">D3D12MA::ALLOCATION_FLAG_COMMITTED</a> you will get a separate memory block - a heap that always has offset 0. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a08e1468f1dbb63ce3bf6680e592b2143" name="a08e1468f1dbb63ce3bf6680e592b2143"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a08e1468f1dbb63ce3bf6680e592b2143">◆ </a></span>BeginDefragmentation()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::Allocator::BeginDefragmentation </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html">DEFRAGMENTATION_DESC</a> *</td> <td class="paramname"><span class="paramname"><em>pDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">DefragmentationContext</a> **</td> <td class="paramname"><span class="paramname"><em>ppContext</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Begins defragmentation process of the default pools. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir"></td><td class="paramname">pDesc</td><td>Structure filled with parameters of defragmentation. </td></tr>
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">ppContext</td><td>Context object that will manage defragmentation.</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>For more information about defragmentation, see documentation chapter: <a class="el" href="defragmentation.html">Defragmentation</a>. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a29716b3084916abed7793bf2ec4b65db" name="a29716b3084916abed7793bf2ec4b65db"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a29716b3084916abed7793bf2ec4b65db">◆ </a></span>BuildStatsString()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::Allocator::BuildStatsString </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">WCHAR **</td> <td class="paramname"><span class="paramname"><em>ppStatsString</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">BOOL</td> <td class="paramname"><span class="paramname"><em>DetailedMap</em></span> ) const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Builds and returns statistics as a string in JSON format. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">ppStatsString</td><td>Must be freed using <a class="el" href="#a8392663494384c16d8bfa12b827b4f9c" title="Frees memory of a string returned from Allocator::BuildStatsString.">Allocator::FreeStatsString</a>. </td></tr>
|
||||
<tr><td class="paramdir"></td><td class="paramname">DetailedMap</td><td><code>TRUE</code> to include full list of allocations (can make the string quite long), <code>FALSE</code> to only return statistics. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a99db00df909963573a976c203b107d22" name="a99db00df909963573a976c203b107d22"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a99db00df909963573a976c203b107d22">◆ </a></span>CalculateStatistics()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::Allocator::CalculateStatistics </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_total_statistics.html">TotalStatistics</a> *</td> <td class="paramname"><span class="paramname"><em>pStats</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Retrieves statistics from current state of the allocator. </p>
|
||||
<p>This function is called "calculate" not "get" because it has to traverse all internal data structures, so it may be quite slow. Use it for debugging purposes. For faster but more brief statistics suitable to be called every frame or every allocation, use <a class="el" href="#a1ac113daec5f6ef28ecb1786cf544144" title="Retrieves information about current memory usage and budget.">GetBudget()</a>.</p>
|
||||
<p>Note that when using allocator from multiple threads, returned information may immediately become outdated. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ab45536f92410aedb7be44ea36b1b4717" name="ab45536f92410aedb7be44ea36b1b4717"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ab45536f92410aedb7be44ea36b1b4717">◆ </a></span>CreateAliasingResource()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">HRESULT D3D12MA::Allocator::CreateAliasingResource </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> *</td> <td class="paramname"><span class="paramname"><em>pAllocation</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">UINT64</td> <td class="paramname"><span class="paramname"><em>AllocationLocalOffset</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_RESOURCE_DESC *</td> <td class="paramname"><span class="paramname"><em>pResourceDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">D3D12_RESOURCE_STATES</td> <td class="paramname"><span class="paramname"><em>InitialResourceState</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_CLEAR_VALUE *</td> <td class="paramname"><span class="paramname"><em>pOptimizedClearValue</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">REFIID</td> <td class="paramname"><span class="paramname"><em>riidResource</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">void **</td> <td class="paramname"><span class="paramname"><em>ppvResource</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Creates a new resource in place of an existing allocation. This is useful for memory aliasing. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir"></td><td class="paramname">pAllocation</td><td>Existing allocation indicating the memory where the new resource should be created. It can be created using <a class="el" href="#aa37d6b9fe8ea0864f7a35b9d68e8345a" title="Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation functi...">D3D12MA::Allocator::CreateResource</a> and already have a resource bound to it, or can be a raw memory allocated with <a class="el" href="#acb8a10a5ea30171ce60128286aec5ee2" title="Allocates memory without creating any resource placed in it.">D3D12MA::Allocator::AllocateMemory</a>. It must not be created as committed so that <code>ID3D12Heap</code> is available and not implicit. </td></tr>
|
||||
<tr><td class="paramdir"></td><td class="paramname">AllocationLocalOffset</td><td>Additional offset in bytes to be applied when allocating the resource. Local from the start of <code>pAllocation</code>, not the beginning of the whole <code>ID3D12Heap</code>! If the new resource should start from the beginning of the <code>pAllocation</code> it should be 0. </td></tr>
|
||||
<tr><td class="paramdir"></td><td class="paramname">pResourceDesc</td><td>Description of the new resource to be created. </td></tr>
|
||||
<tr><td class="paramdir"></td><td class="paramname">InitialResourceState</td><td></td></tr>
|
||||
<tr><td class="paramdir"></td><td class="paramname">pOptimizedClearValue</td><td></td></tr>
|
||||
<tr><td class="paramdir"></td><td class="paramname">riidResource</td><td></td></tr>
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">ppvResource</td><td>Returns pointer to the new resource. The resource is not bound with <code>pAllocation</code>. This pointer must not be null - you must get the resource pointer and <code>Release</code> it when no longer needed.</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>Memory requirements of the new resource are checked for validation. If its size exceeds the end of <code>pAllocation</code> or required alignment is not fulfilled considering <code>pAllocation->GetOffset() + AllocationLocalOffset</code>, the function returns <code>E_INVALIDARG</code>. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ad3b83cc5707cb4ed92bc277069c4ddd6" name="ad3b83cc5707cb4ed92bc277069c4ddd6"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ad3b83cc5707cb4ed92bc277069c4ddd6">◆ </a></span>CreateAliasingResource1()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">HRESULT D3D12MA::Allocator::CreateAliasingResource1 </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> *</td> <td class="paramname"><span class="paramname"><em>pAllocation</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">UINT64</td> <td class="paramname"><span class="paramname"><em>AllocationLocalOffset</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_RESOURCE_DESC1 *</td> <td class="paramname"><span class="paramname"><em>pResourceDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">D3D12_RESOURCE_STATES</td> <td class="paramname"><span class="paramname"><em>InitialResourceState</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_CLEAR_VALUE *</td> <td class="paramname"><span class="paramname"><em>pOptimizedClearValue</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">REFIID</td> <td class="paramname"><span class="paramname"><em>riidResource</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">void **</td> <td class="paramname"><span class="paramname"><em>ppvResource</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Similar to <a class="el" href="#ab45536f92410aedb7be44ea36b1b4717" title="Creates a new resource in place of an existing allocation. This is useful for memory aliasing.">Allocator::CreateAliasingResource</a>, but supports new structure <code>D3D12_RESOURCE_DESC1</code>. </p>
|
||||
<p>It internally uses <code>ID3D12Device8::CreatePlacedResource1</code>.</p>
|
||||
<p>To work correctly, <code>ID3D12Device8</code> interface must be available in the current system. Otherwise, <code>E_NOINTERFACE</code> is returned. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a562cbaa71cbd333cade09cd67ed82453" name="a562cbaa71cbd333cade09cd67ed82453"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a562cbaa71cbd333cade09cd67ed82453">◆ </a></span>CreateAliasingResource2()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">HRESULT D3D12MA::Allocator::CreateAliasingResource2 </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> *</td> <td class="paramname"><span class="paramname"><em>pAllocation</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">UINT64</td> <td class="paramname"><span class="paramname"><em>AllocationLocalOffset</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_RESOURCE_DESC1 *</td> <td class="paramname"><span class="paramname"><em>pResourceDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">D3D12_BARRIER_LAYOUT</td> <td class="paramname"><span class="paramname"><em>InitialLayout</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_CLEAR_VALUE *</td> <td class="paramname"><span class="paramname"><em>pOptimizedClearValue</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">UINT32</td> <td class="paramname"><span class="paramname"><em>NumCastableFormats</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">DXGI_FORMAT *</td> <td class="paramname"><span class="paramname"><em>pCastableFormats</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">REFIID</td> <td class="paramname"><span class="paramname"><em>riidResource</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">void **</td> <td class="paramname"><span class="paramname"><em>ppvResource</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Similar to <a class="el" href="#ad3b83cc5707cb4ed92bc277069c4ddd6" title="Similar to Allocator::CreateAliasingResource, but supports new structure D3D12_RESOURCE_DESC1.">Allocator::CreateAliasingResource1</a>, but there are initial layout instead of state and castable formats list. </p>
|
||||
<p>It internally uses <code>ID3D12Device10::CreatePlacedResource2</code>.</p>
|
||||
<p>To work correctly, <code>ID3D12Device10</code> interface must be available in the current system. Otherwise, <code>E_NOINTERFACE</code> is returned. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aac7b1f6bf53cbf4c4ce2264cb72ca515" name="aac7b1f6bf53cbf4c4ce2264cb72ca515"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aac7b1f6bf53cbf4c4ce2264cb72ca515">◆ </a></span>CreatePool()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">HRESULT D3D12MA::Allocator::CreatePool </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html">POOL_DESC</a> *</td> <td class="paramname"><span class="paramname"><em>pPoolDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_pool.html">Pool</a> **</td> <td class="paramname"><span class="paramname"><em>ppPool</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Creates custom pool. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aa37d6b9fe8ea0864f7a35b9d68e8345a" name="aa37d6b9fe8ea0864f7a35b9d68e8345a"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aa37d6b9fe8ea0864f7a35b9d68e8345a">◆ </a></span>CreateResource()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">HRESULT D3D12MA::Allocator::CreateResource </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *</td> <td class="paramname"><span class="paramname"><em>pAllocDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_RESOURCE_DESC *</td> <td class="paramname"><span class="paramname"><em>pResourceDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">D3D12_RESOURCE_STATES</td> <td class="paramname"><span class="paramname"><em>InitialResourceState</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_CLEAR_VALUE *</td> <td class="paramname"><span class="paramname"><em>pOptimizedClearValue</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **</td> <td class="paramname"><span class="paramname"><em>ppAllocation</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">REFIID</td> <td class="paramname"><span class="paramname"><em>riidResource</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">void **</td> <td class="paramname"><span class="paramname"><em>ppvResource</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation function. </p>
|
||||
<p>The function is similar to <code>ID3D12Device::CreateCommittedResource</code>, but it may really call <code>ID3D12Device::CreatePlacedResource</code> to assign part of a larger, existing memory heap to the new resource, which is the main purpose of this whole library.</p>
|
||||
<p>If <code>ppvResource</code> is null, you receive only <code>ppAllocation</code> object from this function. It holds pointer to <code>ID3D12Resource</code> that can be queried using function <a class="el" href="class_d3_d12_m_a_1_1_allocation.html#ad00308118252f82d8f803c623c67bf18" title="Returns D3D12 resource associated with this object.">D3D12MA::Allocation::GetResource()</a>. Reference count of the resource object is 1. It is automatically destroyed when you destroy the allocation object.</p>
|
||||
<p>If <code>ppvResource</code> is not null, you receive pointer to the resource next to allocation object. Reference count of the resource object is then increased by calling <code>QueryInterface</code>, so you need to manually <code>Release</code> it along with the allocation.</p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir"></td><td class="paramname">pAllocDesc</td><td>Parameters of the allocation. </td></tr>
|
||||
<tr><td class="paramdir"></td><td class="paramname">pResourceDesc</td><td>Description of created resource. </td></tr>
|
||||
<tr><td class="paramdir"></td><td class="paramname">InitialResourceState</td><td>Initial resource state. </td></tr>
|
||||
<tr><td class="paramdir"></td><td class="paramname">pOptimizedClearValue</td><td>Optional. Either null or optimized clear value. </td></tr>
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">ppAllocation</td><td>Filled with pointer to new allocation object created. </td></tr>
|
||||
<tr><td class="paramdir"></td><td class="paramname">riidResource</td><td>IID of a resource to be returned via <code>ppvResource</code>. </td></tr>
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">ppvResource</td><td>Optional. If not null, filled with pointer to new resouce created.</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section note"><dt>Note</dt><dd>This function creates a new resource. Sub-allocation of parts of one large buffer, although recommended as a good practice, is out of scope of this library and could be implemented by the user as a higher-level logic on top of it, e.g. using the <a class="el" href="virtual_allocator.html">Virtual allocator</a> feature. </dd></dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a7a1c79c79a7a573c438aa45c4a531b96" name="a7a1c79c79a7a573c438aa45c4a531b96"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a7a1c79c79a7a573c438aa45c4a531b96">◆ </a></span>CreateResource2()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">HRESULT D3D12MA::Allocator::CreateResource2 </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *</td> <td class="paramname"><span class="paramname"><em>pAllocDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_RESOURCE_DESC1 *</td> <td class="paramname"><span class="paramname"><em>pResourceDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">D3D12_RESOURCE_STATES</td> <td class="paramname"><span class="paramname"><em>InitialResourceState</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_CLEAR_VALUE *</td> <td class="paramname"><span class="paramname"><em>pOptimizedClearValue</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **</td> <td class="paramname"><span class="paramname"><em>ppAllocation</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">REFIID</td> <td class="paramname"><span class="paramname"><em>riidResource</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">void **</td> <td class="paramname"><span class="paramname"><em>ppvResource</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Similar to <a class="el" href="#aa37d6b9fe8ea0864f7a35b9d68e8345a" title="Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation functi...">Allocator::CreateResource</a>, but supports new structure <code>D3D12_RESOURCE_DESC1</code>. </p>
|
||||
<p>It internally uses <code>ID3D12Device8::CreateCommittedResource2</code> or <code>ID3D12Device8::CreatePlacedResource1</code>.</p>
|
||||
<p>To work correctly, <code>ID3D12Device8</code> interface must be available in the current system. Otherwise, <code>E_NOINTERFACE</code> is returned. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a323b2af320b01d0fdecfc515c75db747" name="a323b2af320b01d0fdecfc515c75db747"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a323b2af320b01d0fdecfc515c75db747">◆ </a></span>CreateResource3()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">HRESULT D3D12MA::Allocator::CreateResource3 </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *</td> <td class="paramname"><span class="paramname"><em>pAllocDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_RESOURCE_DESC1 *</td> <td class="paramname"><span class="paramname"><em>pResourceDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">D3D12_BARRIER_LAYOUT</td> <td class="paramname"><span class="paramname"><em>InitialLayout</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const D3D12_CLEAR_VALUE *</td> <td class="paramname"><span class="paramname"><em>pOptimizedClearValue</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">UINT32</td> <td class="paramname"><span class="paramname"><em>NumCastableFormats</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">DXGI_FORMAT *</td> <td class="paramname"><span class="paramname"><em>pCastableFormats</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **</td> <td class="paramname"><span class="paramname"><em>ppAllocation</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">REFIID</td> <td class="paramname"><span class="paramname"><em>riidResource</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">void **</td> <td class="paramname"><span class="paramname"><em>ppvResource</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Similar to <a class="el" href="#a7a1c79c79a7a573c438aa45c4a531b96" title="Similar to Allocator::CreateResource, but supports new structure D3D12_RESOURCE_DESC1.">Allocator::CreateResource2</a>, but there are initial layout instead of state and castable formats list. </p>
|
||||
<p>It internally uses <code>ID3D12Device10::CreateCommittedResource3</code> or <code>ID3D12Device10::CreatePlacedResource2</code>.</p>
|
||||
<p>To work correctly, <code>ID3D12Device10</code> interface must be available in the current system. Otherwise, <code>E_NOINTERFACE</code> is returned. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a8392663494384c16d8bfa12b827b4f9c" name="a8392663494384c16d8bfa12b827b4f9c"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a8392663494384c16d8bfa12b827b4f9c">◆ </a></span>FreeStatsString()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::Allocator::FreeStatsString </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">WCHAR *</td> <td class="paramname"><span class="paramname"><em>pStatsString</em></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Frees memory of a string returned from <a class="el" href="#a29716b3084916abed7793bf2ec4b65db" title="Builds and returns statistics as a string in JSON format.">Allocator::BuildStatsString</a>. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a1ac113daec5f6ef28ecb1786cf544144" name="a1ac113daec5f6ef28ecb1786cf544144"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a1ac113daec5f6ef28ecb1786cf544144">◆ </a></span>GetBudget()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::Allocator::GetBudget </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_budget.html">Budget</a> *</td> <td class="paramname"><span class="paramname"><em>pLocalBudget</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_budget.html">Budget</a> *</td> <td class="paramname"><span class="paramname"><em>pNonLocalBudget</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Retrieves information about current memory usage and budget. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">pLocalBudget</td><td>Optional, can be null. </td></tr>
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">pNonLocalBudget</td><td>Optional, can be null.</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<ul>
|
||||
<li>When <a class="el" href="#a9e742884bd45dd7f01193d13fcd05af0" title="Returns true if D3D12_FEATURE_DATA_ARCHITECTURE1::UMA was found to be true.">IsUMA()</a> <code>== FALSE</code> (discrete graphics card):<ul>
|
||||
<li><code>pLocalBudget</code> returns the budget of the video memory.</li>
|
||||
<li><code>pNonLocalBudget</code> returns the budget of the system memory available for D3D12 resources.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>When <a class="el" href="#a9e742884bd45dd7f01193d13fcd05af0" title="Returns true if D3D12_FEATURE_DATA_ARCHITECTURE1::UMA was found to be true.">IsUMA()</a> <code>== TRUE</code> (integrated graphics chip):<ul>
|
||||
<li><code>pLocalBudget</code> returns the budget of the shared memory available for all D3D12 resources. All memory is considered "local".</li>
|
||||
<li><code>pNonLocalBudget</code> is not applicable and returns zeros.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>This function is called "get" not "calculate" because it is very fast, suitable to be called every frame or every allocation. For more detailed statistics use <a class="el" href="#a99db00df909963573a976c203b107d22" title="Retrieves statistics from current state of the allocator.">CalculateStatistics()</a>.</p>
|
||||
<p>Note that when using allocator from multiple threads, returned information may immediately become outdated. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae276d2358a58a36f8c6639f837f29be5" name="ae276d2358a58a36f8c6639f837f29be5"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae276d2358a58a36f8c6639f837f29be5">◆ </a></span>GetD3D12Options()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">const D3D12_FEATURE_DATA_D3D12_OPTIONS & D3D12MA::Allocator::GetD3D12Options </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns cached options retrieved from D3D12 device. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a434ae3147209953253da26687bfd62dc" name="a434ae3147209953253da26687bfd62dc"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a434ae3147209953253da26687bfd62dc">◆ </a></span>GetMemoryCapacity()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">UINT64 D3D12MA::Allocator::GetMemoryCapacity </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">UINT</td> <td class="paramname"><span class="paramname"><em>memorySegmentGroup</em></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns total amount of memory of specific segment group, in bytes. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">memorySegmentGroup</td><td>use <code>DXGI_MEMORY_SEGMENT_GROUP_LOCAL</code> or DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL`.</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>This information is taken from <code>DXGI_ADAPTER_DESC</code>. It is not recommended to use this number. You should preferably call <a class="el" href="#a1ac113daec5f6ef28ecb1786cf544144" title="Retrieves information about current memory usage and budget.">GetBudget()</a> and limit memory usage to <a class="el" href="struct_d3_d12_m_a_1_1_budget.html#a326515f08d89ee2e31dcfdd5c1e8ac71" title="Estimated amount of memory available to the program.">D3D12MA::Budget::BudgetBytes</a> instead.</p>
|
||||
<ul>
|
||||
<li>When <a class="el" href="#a9e742884bd45dd7f01193d13fcd05af0" title="Returns true if D3D12_FEATURE_DATA_ARCHITECTURE1::UMA was found to be true.">IsUMA()</a> <code>== FALSE</code> (discrete graphics card):<ul>
|
||||
<li><code>GetMemoryCapacity(DXGI_MEMORY_SEGMENT_GROUP_LOCAL)</code> returns the size of the video memory.</li>
|
||||
<li><code>GetMemoryCapacity(DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL)</code> returns the size of the system memory available for D3D12 resources.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>When <a class="el" href="#a9e742884bd45dd7f01193d13fcd05af0" title="Returns true if D3D12_FEATURE_DATA_ARCHITECTURE1::UMA was found to be true.">IsUMA()</a> <code>== TRUE</code> (integrated graphics chip):<ul>
|
||||
<li><code>GetMemoryCapacity(DXGI_MEMORY_SEGMENT_GROUP_LOCAL)</code> returns the size of the shared memory available for all D3D12 resources. All memory is considered "local".</li>
|
||||
<li><code>GetMemoryCapacity(DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL)</code> is not applicable and returns 0. </li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a08210561b92c4bd7ede9dd7beba4bb80" name="a08210561b92c4bd7ede9dd7beba4bb80"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a08210561b92c4bd7ede9dd7beba4bb80">◆ </a></span>IsCacheCoherentUMA()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">BOOL D3D12MA::Allocator::IsCacheCoherentUMA </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns true if <code>D3D12_FEATURE_DATA_ARCHITECTURE1::CacheCoherentUMA</code> was found to be true. </p>
|
||||
<p>For more information about how to use it, see articles in Microsoft Docs articles:</p>
|
||||
<ul>
|
||||
<li>"UMA Optimizations: CPU Accessible Textures and Standard Swizzle"</li>
|
||||
<li>"D3D12_FEATURE_DATA_ARCHITECTURE structure (d3d12.h)"</li>
|
||||
<li>"ID3D12Device::GetCustomHeapProperties method (d3d12.h)" </li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a9e742884bd45dd7f01193d13fcd05af0" name="a9e742884bd45dd7f01193d13fcd05af0"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a9e742884bd45dd7f01193d13fcd05af0">◆ </a></span>IsUMA()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">BOOL D3D12MA::Allocator::IsUMA </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns true if <code>D3D12_FEATURE_DATA_ARCHITECTURE1::UMA</code> was found to be true. </p>
|
||||
<p>For more information about how to use it, see articles in Microsoft Docs articles:</p>
|
||||
<ul>
|
||||
<li>"UMA Optimizations: CPU Accessible Textures and Standard Swizzle"</li>
|
||||
<li>"D3D12_FEATURE_DATA_ARCHITECTURE structure (d3d12.h)"</li>
|
||||
<li>"ID3D12Device::GetCustomHeapProperties method (d3d12.h)" </li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a468ba0c93121eaaee402b08775f1dd11" name="a468ba0c93121eaaee402b08775f1dd11"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a468ba0c93121eaaee402b08775f1dd11">◆ </a></span>SetCurrentFrameIndex()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::Allocator::SetCurrentFrameIndex </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">UINT</td> <td class="paramname"><span class="paramname"><em>frameIndex</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Sets the index of the current frame. </p>
|
||||
<p>This function is used to set the frame index in the allocator when a new game frame begins. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<hr/>The documentation for this class was generated from the following file:<ul>
|
||||
<li>D:/PROJECTS/D3D12 Memory Allocator/REPO/include/<a class="el" href="_d3_d12_mem_alloc_8h.html">D3D12MemAlloc.h</a></li>
|
||||
</ul>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 488 B |
@@ -0,0 +1,94 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: Member List</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a></li><li class="navelem"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">DefragmentationContext</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="headertitle"><div class="title">D3D12MA::DefragmentationContext Member List</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>This is the complete list of members for <a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">D3D12MA::DefragmentationContext</a>, including all inherited members.</p>
|
||||
<table class="directory">
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#a1606c015d02edc094bb246986159d592">BeginPass</a>(DEFRAGMENTATION_PASS_MOVE_INFO *pPassInfo)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">D3D12MA::DefragmentationContext</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#a968f13f23d03e50cc50b87835b6d5a85">D3D12MA_DELETE</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">D3D12MA::DefragmentationContext</a></td><td class="entry"><span class="mlabel">friend</span></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#aad502ba70d6dadaeee37703fd8bf90ae">EndPass</a>(DEFRAGMENTATION_PASS_MOVE_INFO *pPassInfo)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">D3D12MA::DefragmentationContext</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#a1c21c26f47dcbf8f4e562063a3e25f38">GetStats</a>(DEFRAGMENTATION_STATS *pStats)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">D3D12MA::DefragmentationContext</a></td><td class="entry"></td></tr>
|
||||
</table></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,202 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: D3D12MA::DefragmentationContext Class Reference</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a></li><li class="navelem"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">DefragmentationContext</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#pub-methods">Public Member Functions</a> |
|
||||
<a href="class_d3_d12_m_a_1_1_defragmentation_context-members.html">List of all members</a> </div>
|
||||
<div class="headertitle"><div class="title">D3D12MA::DefragmentationContext Class Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Represents defragmentation process in progress.
|
||||
<a href="#details">More...</a></p>
|
||||
|
||||
<p><code>#include <D3D12MemAlloc.h></code></p>
|
||||
<div class="dynheader">
|
||||
Inheritance diagram for D3D12MA::DefragmentationContext:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center">
|
||||
<img src="class_d3_d12_m_a_1_1_defragmentation_context.png" alt=""/>
|
||||
</div></div>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
|
||||
Public Member Functions</h2></td></tr>
|
||||
<tr class="memitem:a1606c015d02edc094bb246986159d592" id="r_a1606c015d02edc094bb246986159d592"><td class="memItemLeft" align="right" valign="top">HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="#a1606c015d02edc094bb246986159d592">BeginPass</a> (<a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html">DEFRAGMENTATION_PASS_MOVE_INFO</a> *pPassInfo)</td></tr>
|
||||
<tr class="memdesc:a1606c015d02edc094bb246986159d592"><td class="mdescLeft"> </td><td class="mdescRight">Starts single defragmentation pass. <br /></td></tr>
|
||||
<tr class="separator:a1606c015d02edc094bb246986159d592"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aad502ba70d6dadaeee37703fd8bf90ae" id="r_aad502ba70d6dadaeee37703fd8bf90ae"><td class="memItemLeft" align="right" valign="top">HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="#aad502ba70d6dadaeee37703fd8bf90ae">EndPass</a> (<a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html">DEFRAGMENTATION_PASS_MOVE_INFO</a> *pPassInfo)</td></tr>
|
||||
<tr class="memdesc:aad502ba70d6dadaeee37703fd8bf90ae"><td class="mdescLeft"> </td><td class="mdescRight">Ends single defragmentation pass. <br /></td></tr>
|
||||
<tr class="separator:aad502ba70d6dadaeee37703fd8bf90ae"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a1c21c26f47dcbf8f4e562063a3e25f38" id="r_a1c21c26f47dcbf8f4e562063a3e25f38"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a1c21c26f47dcbf8f4e562063a3e25f38">GetStats</a> (<a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___s_t_a_t_s.html">DEFRAGMENTATION_STATS</a> *pStats)</td></tr>
|
||||
<tr class="memdesc:a1c21c26f47dcbf8f4e562063a3e25f38"><td class="mdescLeft"> </td><td class="mdescRight">Returns statistics of the defragmentation performed so far. <br /></td></tr>
|
||||
<tr class="separator:a1c21c26f47dcbf8f4e562063a3e25f38"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Represents defragmentation process in progress. </p>
|
||||
<p>You can create this object using <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a08e1468f1dbb63ce3bf6680e592b2143" title="Begins defragmentation process of the default pools.">Allocator::BeginDefragmentation</a> (for default pools) or <a class="el" href="class_d3_d12_m_a_1_1_pool.html#adc87bb49c192de8f5a9ca0484c499575" title="Begins defragmentation process of the current pool.">Pool::BeginDefragmentation</a> (for a custom pool). </p>
|
||||
</div><h2 class="groupheader">Member Function Documentation</h2>
|
||||
<a id="a1606c015d02edc094bb246986159d592" name="a1606c015d02edc094bb246986159d592"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a1606c015d02edc094bb246986159d592">◆ </a></span>BeginPass()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">HRESULT D3D12MA::DefragmentationContext::BeginPass </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html">DEFRAGMENTATION_PASS_MOVE_INFO</a> *</td> <td class="paramname"><span class="paramname"><em>pPassInfo</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Starts single defragmentation pass. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">pPassInfo</td><td>Computed informations for current pass. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd><ul>
|
||||
<li><code>S_OK</code> if no more moves are possible. Then you can omit call to <a class="el" href="#aad502ba70d6dadaeee37703fd8bf90ae" title="Ends single defragmentation pass.">DefragmentationContext::EndPass()</a> and simply end whole defragmentation.</li>
|
||||
<li><code>S_FALSE</code> if there are pending moves returned in <code>pPassInfo</code>. You need to perform them, call <a class="el" href="#aad502ba70d6dadaeee37703fd8bf90ae" title="Ends single defragmentation pass.">DefragmentationContext::EndPass()</a>, and then preferably try another pass with <a class="el" href="#a1606c015d02edc094bb246986159d592" title="Starts single defragmentation pass.">DefragmentationContext::BeginPass()</a>. </li>
|
||||
</ul>
|
||||
</dd></dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aad502ba70d6dadaeee37703fd8bf90ae" name="aad502ba70d6dadaeee37703fd8bf90ae"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aad502ba70d6dadaeee37703fd8bf90ae">◆ </a></span>EndPass()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">HRESULT D3D12MA::DefragmentationContext::EndPass </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html">DEFRAGMENTATION_PASS_MOVE_INFO</a> *</td> <td class="paramname"><span class="paramname"><em>pPassInfo</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Ends single defragmentation pass. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">pPassInfo</td><td>Computed informations for current pass filled by <a class="el" href="#a1606c015d02edc094bb246986159d592" title="Starts single defragmentation pass.">DefragmentationContext::BeginPass()</a> and possibly modified by you. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>Returns <code>S_OK</code> if no more moves are possible or <code>S_FALSE</code> if more defragmentations are possible.</dd></dl>
|
||||
<p>Ends incremental defragmentation pass and commits all defragmentation moves from <code>pPassInfo</code>. After this call:</p>
|
||||
<ul>
|
||||
<li>Allocation at <code>pPassInfo[i].pSrcAllocation</code> that had <code>pPassInfo[i].Operation ==</code> <a class="el" href="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602a29a5c20322e633f6c34ddebd16bc61ac">DEFRAGMENTATION_MOVE_OPERATION_COPY</a> (which is the default) will be pointing to the new destination place.</li>
|
||||
<li>Allocation at <code>pPassInfo[i].pSrcAllocation</code> that had <code>pPassInfo[i].operation ==</code> <a class="el" href="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602aa2143507d723de458c2ed94e143ac242" title="Set this value if you decide to abandon the allocation and you destroyed the resource....">DEFRAGMENTATION_MOVE_OPERATION_DESTROY</a> will be released.</li>
|
||||
</ul>
|
||||
<p>If no more moves are possible you can end whole defragmentation. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a1c21c26f47dcbf8f4e562063a3e25f38" name="a1c21c26f47dcbf8f4e562063a3e25f38"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a1c21c26f47dcbf8f4e562063a3e25f38">◆ </a></span>GetStats()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::DefragmentationContext::GetStats </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___s_t_a_t_s.html">DEFRAGMENTATION_STATS</a> *</td> <td class="paramname"><span class="paramname"><em>pStats</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns statistics of the defragmentation performed so far. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<hr/>The documentation for this class was generated from the following file:<ul>
|
||||
<li>D:/PROJECTS/D3D12 Memory Allocator/REPO/include/<a class="el" href="_d3_d12_mem_alloc_8h.html">D3D12MemAlloc.h</a></li>
|
||||
</ul>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 719 B |
@@ -0,0 +1,97 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: Member List</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a></li><li class="navelem"><a class="el" href="class_d3_d12_m_a_1_1_pool.html">Pool</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="headertitle"><div class="title">D3D12MA::Pool Member List</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>This is the complete list of members for <a class="el" href="class_d3_d12_m_a_1_1_pool.html">D3D12MA::Pool</a>, including all inherited members.</p>
|
||||
<table class="directory">
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html#adc87bb49c192de8f5a9ca0484c499575">BeginDefragmentation</a>(const DEFRAGMENTATION_DESC *pDesc, DefragmentationContext **ppContext)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html">D3D12MA::Pool</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html#ad07999ac5dc8f0c63187afd45d551910">CalculateStatistics</a>(DetailedStatistics *pStats)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html">D3D12MA::Pool</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html#a968f13f23d03e50cc50b87835b6d5a85">D3D12MA_DELETE</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html">D3D12MA::Pool</a></td><td class="entry"><span class="mlabel">friend</span></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html#aaab59af46d922d6b81fce8d8be987028">GetDesc</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html">D3D12MA::Pool</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html#a63c91d92a9ca48b98866a5cc1aea333b">GetName</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html">D3D12MA::Pool</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html#aa9d849dc4667314b2a53eddf02f5af91">GetStatistics</a>(Statistics *pStats)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html">D3D12MA::Pool</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html#a20617cfec0461cf8c2b92115b5140c5b">SetName</a>(LPCWSTR Name)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_pool.html">D3D12MA::Pool</a></td><td class="entry"></td></tr>
|
||||
</table></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,279 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: D3D12MA::Pool Class Reference</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a></li><li class="navelem"><a class="el" href="class_d3_d12_m_a_1_1_pool.html">Pool</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#pub-methods">Public Member Functions</a> |
|
||||
<a href="class_d3_d12_m_a_1_1_pool-members.html">List of all members</a> </div>
|
||||
<div class="headertitle"><div class="title">D3D12MA::Pool Class Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Custom memory pool.
|
||||
<a href="#details">More...</a></p>
|
||||
|
||||
<p><code>#include <D3D12MemAlloc.h></code></p>
|
||||
<div class="dynheader">
|
||||
Inheritance diagram for D3D12MA::Pool:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center">
|
||||
<img src="class_d3_d12_m_a_1_1_pool.png" alt=""/>
|
||||
</div></div>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
|
||||
Public Member Functions</h2></td></tr>
|
||||
<tr class="memitem:aaab59af46d922d6b81fce8d8be987028" id="r_aaab59af46d922d6b81fce8d8be987028"><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html">POOL_DESC</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#aaab59af46d922d6b81fce8d8be987028">GetDesc</a> () const</td></tr>
|
||||
<tr class="memdesc:aaab59af46d922d6b81fce8d8be987028"><td class="mdescLeft"> </td><td class="mdescRight">Returns copy of parameters of the pool. <br /></td></tr>
|
||||
<tr class="separator:aaab59af46d922d6b81fce8d8be987028"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aa9d849dc4667314b2a53eddf02f5af91" id="r_aa9d849dc4667314b2a53eddf02f5af91"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#aa9d849dc4667314b2a53eddf02f5af91">GetStatistics</a> (<a class="el" href="struct_d3_d12_m_a_1_1_statistics.html">Statistics</a> *pStats)</td></tr>
|
||||
<tr class="memdesc:aa9d849dc4667314b2a53eddf02f5af91"><td class="mdescLeft"> </td><td class="mdescRight">Retrieves basic statistics of the custom pool that are fast to calculate. <br /></td></tr>
|
||||
<tr class="separator:aa9d849dc4667314b2a53eddf02f5af91"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ad07999ac5dc8f0c63187afd45d551910" id="r_ad07999ac5dc8f0c63187afd45d551910"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#ad07999ac5dc8f0c63187afd45d551910">CalculateStatistics</a> (<a class="el" href="struct_d3_d12_m_a_1_1_detailed_statistics.html">DetailedStatistics</a> *pStats)</td></tr>
|
||||
<tr class="memdesc:ad07999ac5dc8f0c63187afd45d551910"><td class="mdescLeft"> </td><td class="mdescRight">Retrieves detailed statistics of the custom pool that are slower to calculate. <br /></td></tr>
|
||||
<tr class="separator:ad07999ac5dc8f0c63187afd45d551910"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a20617cfec0461cf8c2b92115b5140c5b" id="r_a20617cfec0461cf8c2b92115b5140c5b"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a20617cfec0461cf8c2b92115b5140c5b">SetName</a> (LPCWSTR Name)</td></tr>
|
||||
<tr class="memdesc:a20617cfec0461cf8c2b92115b5140c5b"><td class="mdescLeft"> </td><td class="mdescRight">Associates a name with the pool. This name is for use in debug diagnostics and tools. <br /></td></tr>
|
||||
<tr class="separator:a20617cfec0461cf8c2b92115b5140c5b"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a63c91d92a9ca48b98866a5cc1aea333b" id="r_a63c91d92a9ca48b98866a5cc1aea333b"><td class="memItemLeft" align="right" valign="top">LPCWSTR </td><td class="memItemRight" valign="bottom"><a class="el" href="#a63c91d92a9ca48b98866a5cc1aea333b">GetName</a> () const</td></tr>
|
||||
<tr class="memdesc:a63c91d92a9ca48b98866a5cc1aea333b"><td class="mdescLeft"> </td><td class="mdescRight">Returns the name associated with the pool object. <br /></td></tr>
|
||||
<tr class="separator:a63c91d92a9ca48b98866a5cc1aea333b"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:adc87bb49c192de8f5a9ca0484c499575" id="r_adc87bb49c192de8f5a9ca0484c499575"><td class="memItemLeft" align="right" valign="top">HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="#adc87bb49c192de8f5a9ca0484c499575">BeginDefragmentation</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html">DEFRAGMENTATION_DESC</a> *pDesc, <a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">DefragmentationContext</a> **ppContext)</td></tr>
|
||||
<tr class="memdesc:adc87bb49c192de8f5a9ca0484c499575"><td class="mdescLeft"> </td><td class="mdescRight">Begins defragmentation process of the current pool. <br /></td></tr>
|
||||
<tr class="separator:adc87bb49c192de8f5a9ca0484c499575"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Custom memory pool. </p>
|
||||
<p>Represents a separate set of heaps (memory blocks) that can be used to create <a class="el" href="class_d3_d12_m_a_1_1_allocation.html" title="Represents single memory allocation.">D3D12MA::Allocation</a>-s and resources in it. Usually there is no need to create custom pools - creating resources in default pool is sufficient.</p>
|
||||
<p>To create custom pool, fill <a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html" title="Parameters of created D3D12MA::Pool object. To be used with D3D12MA::Allocator::CreatePool.">D3D12MA::POOL_DESC</a> and call <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aac7b1f6bf53cbf4c4ce2264cb72ca515" title="Creates custom pool.">D3D12MA::Allocator::CreatePool</a>. </p>
|
||||
</div><h2 class="groupheader">Member Function Documentation</h2>
|
||||
<a id="adc87bb49c192de8f5a9ca0484c499575" name="adc87bb49c192de8f5a9ca0484c499575"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#adc87bb49c192de8f5a9ca0484c499575">◆ </a></span>BeginDefragmentation()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">HRESULT D3D12MA::Pool::BeginDefragmentation </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html">DEFRAGMENTATION_DESC</a> *</td> <td class="paramname"><span class="paramname"><em>pDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">DefragmentationContext</a> **</td> <td class="paramname"><span class="paramname"><em>ppContext</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Begins defragmentation process of the current pool. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir"></td><td class="paramname">pDesc</td><td>Structure filled with parameters of defragmentation. </td></tr>
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">ppContext</td><td>Context object that will manage defragmentation. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd><ul>
|
||||
<li><code>S_OK</code> if defragmentation can begin.</li>
|
||||
<li><code>E_NOINTERFACE</code> if defragmentation is not supported.</li>
|
||||
</ul>
|
||||
</dd></dl>
|
||||
<p>For more information about defragmentation, see documentation chapter: <a class="el" href="defragmentation.html">Defragmentation</a>. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ad07999ac5dc8f0c63187afd45d551910" name="ad07999ac5dc8f0c63187afd45d551910"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ad07999ac5dc8f0c63187afd45d551910">◆ </a></span>CalculateStatistics()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::Pool::CalculateStatistics </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_detailed_statistics.html">DetailedStatistics</a> *</td> <td class="paramname"><span class="paramname"><em>pStats</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Retrieves detailed statistics of the custom pool that are slower to calculate. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">pStats</td><td>Statistics of the current pool. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aaab59af46d922d6b81fce8d8be987028" name="aaab59af46d922d6b81fce8d8be987028"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aaab59af46d922d6b81fce8d8be987028">◆ </a></span>GetDesc()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname"><a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html">POOL_DESC</a> D3D12MA::Pool::GetDesc </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns copy of parameters of the pool. </p>
|
||||
<p>These are the same parameters as passed to <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aac7b1f6bf53cbf4c4ce2264cb72ca515" title="Creates custom pool.">D3D12MA::Allocator::CreatePool</a>. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a63c91d92a9ca48b98866a5cc1aea333b" name="a63c91d92a9ca48b98866a5cc1aea333b"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a63c91d92a9ca48b98866a5cc1aea333b">◆ </a></span>GetName()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">LPCWSTR D3D12MA::Pool::GetName </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns the name associated with the pool object. </p>
|
||||
<p>Returned string points to an internal copy.</p>
|
||||
<p>If no name was associated with the allocation, returns NULL. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aa9d849dc4667314b2a53eddf02f5af91" name="aa9d849dc4667314b2a53eddf02f5af91"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aa9d849dc4667314b2a53eddf02f5af91">◆ </a></span>GetStatistics()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::Pool::GetStatistics </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_statistics.html">Statistics</a> *</td> <td class="paramname"><span class="paramname"><em>pStats</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Retrieves basic statistics of the custom pool that are fast to calculate. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">pStats</td><td>Statistics of the current pool. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a20617cfec0461cf8c2b92115b5140c5b" name="a20617cfec0461cf8c2b92115b5140c5b"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a20617cfec0461cf8c2b92115b5140c5b">◆ </a></span>SetName()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::Pool::SetName </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">LPCWSTR</td> <td class="paramname"><span class="paramname"><em>Name</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Associates a name with the pool. This name is for use in debug diagnostics and tools. </p>
|
||||
<p>Internal copy of the string is made, so the memory pointed by the argument can be changed of freed immediately after this call.</p>
|
||||
<p><code>Name</code> can be NULL. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<hr/>The documentation for this class was generated from the following file:<ul>
|
||||
<li>D:/PROJECTS/D3D12 Memory Allocator/REPO/include/<a class="el" href="_d3_d12_mem_alloc_8h.html">D3D12MemAlloc.h</a></li>
|
||||
</ul>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 475 B |
@@ -0,0 +1,102 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: Member List</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a></li><li class="navelem"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">VirtualBlock</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="headertitle"><div class="title">D3D12MA::VirtualBlock Member List</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>This is the complete list of members for <a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a>, including all inherited members.</p>
|
||||
<table class="directory">
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#a9281daf76e888ea1bd5247d5732e8179">Allocate</a>(const VIRTUAL_ALLOCATION_DESC *pDesc, VirtualAllocation *pAllocation, UINT64 *pOffset)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#a828a27070bfa762cae796d4c8f2ef703">BuildStatsString</a>(WCHAR **ppStatsString) const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#a614a82247ce6cf29c38895e16eb971d9">CalculateStatistics</a>(DetailedStatistics *pStats) const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#ae22b18c0b7c31b44c1d740f886369189">Clear</a>()</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#a0485028cbe13b5457fe422865f7edf74">CreateVirtualBlock</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td><td class="entry"><span class="mlabel">friend</span></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#a968f13f23d03e50cc50b87835b6d5a85">D3D12MA_DELETE</a></td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td><td class="entry"><span class="mlabel">friend</span></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#aab44e46bd122054c894fc84740f1e8fb">FreeAllocation</a>(VirtualAllocation allocation)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#a6f78ddaa7da194e239089e52093e68a9">FreeStatsString</a>(WCHAR *pStatsString) const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#ac605dce05ca0d411e46079f0bad765d1">GetAllocationInfo</a>(VirtualAllocation allocation, VIRTUAL_ALLOCATION_INFO *pInfo) const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#a0f1dda0e019e218b021f64987a74b110">GetStatistics</a>(Statistics *pStats) const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#a7b23fd2da6f0343095fb14b31395678b">IsEmpty</a>() const</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html#ab96e34500b75a83a09d73b4585669114">SetAllocationPrivateData</a>(VirtualAllocation allocation, void *pPrivateData)</td><td class="entry"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">D3D12MA::VirtualBlock</a></td><td class="entry"></td></tr>
|
||||
</table></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,380 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: D3D12MA::VirtualBlock Class Reference</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a></li><li class="navelem"><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">VirtualBlock</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#pub-methods">Public Member Functions</a> |
|
||||
<a href="class_d3_d12_m_a_1_1_virtual_block-members.html">List of all members</a> </div>
|
||||
<div class="headertitle"><div class="title">D3D12MA::VirtualBlock Class Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Represents pure allocation algorithm and a data structure with allocations in some memory block, without actually allocating any GPU memory.
|
||||
<a href="#details">More...</a></p>
|
||||
|
||||
<p><code>#include <D3D12MemAlloc.h></code></p>
|
||||
<div class="dynheader">
|
||||
Inheritance diagram for D3D12MA::VirtualBlock:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center">
|
||||
<img src="class_d3_d12_m_a_1_1_virtual_block.png" alt=""/>
|
||||
</div></div>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
|
||||
Public Member Functions</h2></td></tr>
|
||||
<tr class="memitem:a7b23fd2da6f0343095fb14b31395678b" id="r_a7b23fd2da6f0343095fb14b31395678b"><td class="memItemLeft" align="right" valign="top">BOOL </td><td class="memItemRight" valign="bottom"><a class="el" href="#a7b23fd2da6f0343095fb14b31395678b">IsEmpty</a> () const</td></tr>
|
||||
<tr class="memdesc:a7b23fd2da6f0343095fb14b31395678b"><td class="mdescLeft"> </td><td class="mdescRight">Returns true if the block is empty - contains 0 allocations. <br /></td></tr>
|
||||
<tr class="separator:a7b23fd2da6f0343095fb14b31395678b"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ac605dce05ca0d411e46079f0bad765d1" id="r_ac605dce05ca0d411e46079f0bad765d1"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#ac605dce05ca0d411e46079f0bad765d1">GetAllocationInfo</a> (<a class="el" href="struct_d3_d12_m_a_1_1_virtual_allocation.html">VirtualAllocation</a> allocation, <a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___a_l_l_o_c_a_t_i_o_n___i_n_f_o.html">VIRTUAL_ALLOCATION_INFO</a> *pInfo) const</td></tr>
|
||||
<tr class="memdesc:ac605dce05ca0d411e46079f0bad765d1"><td class="mdescLeft"> </td><td class="mdescRight">Returns information about an allocation - its offset, size and custom pointer. <br /></td></tr>
|
||||
<tr class="separator:ac605dce05ca0d411e46079f0bad765d1"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a9281daf76e888ea1bd5247d5732e8179" id="r_a9281daf76e888ea1bd5247d5732e8179"><td class="memItemLeft" align="right" valign="top">HRESULT </td><td class="memItemRight" valign="bottom"><a class="el" href="#a9281daf76e888ea1bd5247d5732e8179">Allocate</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">VIRTUAL_ALLOCATION_DESC</a> *pDesc, <a class="el" href="struct_d3_d12_m_a_1_1_virtual_allocation.html">VirtualAllocation</a> *pAllocation, UINT64 *pOffset)</td></tr>
|
||||
<tr class="memdesc:a9281daf76e888ea1bd5247d5732e8179"><td class="mdescLeft"> </td><td class="mdescRight">Creates new allocation. <br /></td></tr>
|
||||
<tr class="separator:a9281daf76e888ea1bd5247d5732e8179"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aab44e46bd122054c894fc84740f1e8fb" id="r_aab44e46bd122054c894fc84740f1e8fb"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#aab44e46bd122054c894fc84740f1e8fb">FreeAllocation</a> (<a class="el" href="struct_d3_d12_m_a_1_1_virtual_allocation.html">VirtualAllocation</a> allocation)</td></tr>
|
||||
<tr class="memdesc:aab44e46bd122054c894fc84740f1e8fb"><td class="mdescLeft"> </td><td class="mdescRight">Frees the allocation. <br /></td></tr>
|
||||
<tr class="separator:aab44e46bd122054c894fc84740f1e8fb"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ae22b18c0b7c31b44c1d740f886369189" id="r_ae22b18c0b7c31b44c1d740f886369189"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae22b18c0b7c31b44c1d740f886369189">Clear</a> ()</td></tr>
|
||||
<tr class="memdesc:ae22b18c0b7c31b44c1d740f886369189"><td class="mdescLeft"> </td><td class="mdescRight">Frees all the allocations. <br /></td></tr>
|
||||
<tr class="separator:ae22b18c0b7c31b44c1d740f886369189"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ab96e34500b75a83a09d73b4585669114" id="r_ab96e34500b75a83a09d73b4585669114"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#ab96e34500b75a83a09d73b4585669114">SetAllocationPrivateData</a> (<a class="el" href="struct_d3_d12_m_a_1_1_virtual_allocation.html">VirtualAllocation</a> allocation, void *pPrivateData)</td></tr>
|
||||
<tr class="memdesc:ab96e34500b75a83a09d73b4585669114"><td class="mdescLeft"> </td><td class="mdescRight">Changes custom pointer for an allocation to a new value. <br /></td></tr>
|
||||
<tr class="separator:ab96e34500b75a83a09d73b4585669114"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a0f1dda0e019e218b021f64987a74b110" id="r_a0f1dda0e019e218b021f64987a74b110"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a0f1dda0e019e218b021f64987a74b110">GetStatistics</a> (<a class="el" href="struct_d3_d12_m_a_1_1_statistics.html">Statistics</a> *pStats) const</td></tr>
|
||||
<tr class="memdesc:a0f1dda0e019e218b021f64987a74b110"><td class="mdescLeft"> </td><td class="mdescRight">Retrieves basic statistics of the virtual block that are fast to calculate. <br /></td></tr>
|
||||
<tr class="separator:a0f1dda0e019e218b021f64987a74b110"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a614a82247ce6cf29c38895e16eb971d9" id="r_a614a82247ce6cf29c38895e16eb971d9"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a614a82247ce6cf29c38895e16eb971d9">CalculateStatistics</a> (<a class="el" href="struct_d3_d12_m_a_1_1_detailed_statistics.html">DetailedStatistics</a> *pStats) const</td></tr>
|
||||
<tr class="memdesc:a614a82247ce6cf29c38895e16eb971d9"><td class="mdescLeft"> </td><td class="mdescRight">Retrieves detailed statistics of the virtual block that are slower to calculate. <br /></td></tr>
|
||||
<tr class="separator:a614a82247ce6cf29c38895e16eb971d9"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a828a27070bfa762cae796d4c8f2ef703" id="r_a828a27070bfa762cae796d4c8f2ef703"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a828a27070bfa762cae796d4c8f2ef703">BuildStatsString</a> (WCHAR **ppStatsString) const</td></tr>
|
||||
<tr class="memdesc:a828a27070bfa762cae796d4c8f2ef703"><td class="mdescLeft"> </td><td class="mdescRight">Builds and returns statistics as a string in JSON format, including the list of allocations with their parameters. <br /></td></tr>
|
||||
<tr class="separator:a828a27070bfa762cae796d4c8f2ef703"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a6f78ddaa7da194e239089e52093e68a9" id="r_a6f78ddaa7da194e239089e52093e68a9"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a6f78ddaa7da194e239089e52093e68a9">FreeStatsString</a> (WCHAR *pStatsString) const</td></tr>
|
||||
<tr class="memdesc:a6f78ddaa7da194e239089e52093e68a9"><td class="mdescLeft"> </td><td class="mdescRight">Frees memory of a string returned from <a class="el" href="#a828a27070bfa762cae796d4c8f2ef703" title="Builds and returns statistics as a string in JSON format, including the list of allocations with thei...">VirtualBlock::BuildStatsString</a>. <br /></td></tr>
|
||||
<tr class="separator:a6f78ddaa7da194e239089e52093e68a9"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Represents pure allocation algorithm and a data structure with allocations in some memory block, without actually allocating any GPU memory. </p>
|
||||
<p>This class allows to use the core algorithm of the library custom allocations e.g. CPU memory or sub-allocation regions inside a single GPU buffer.</p>
|
||||
<p>To create this object, fill in <a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___b_l_o_c_k___d_e_s_c.html" title="Parameters of created D3D12MA::VirtualBlock object to be passed to CreateVirtualBlock().">D3D12MA::VIRTUAL_BLOCK_DESC</a> and call <a class="el" href="#a0485028cbe13b5457fe422865f7edf74" title="Creates new D3D12MA::VirtualBlock object and returns it through ppVirtualBlock.">CreateVirtualBlock()</a>. To destroy it, call its method <code>VirtualBlock::Release()</code>. You need to free all the allocations within this block or call <a class="el" href="#ae22b18c0b7c31b44c1d740f886369189" title="Frees all the allocations.">Clear()</a> before destroying it.</p>
|
||||
<p>This object is not thread-safe - should not be used from multiple threads simultaneously, must be synchronized externally. </p>
|
||||
</div><h2 class="groupheader">Member Function Documentation</h2>
|
||||
<a id="a9281daf76e888ea1bd5247d5732e8179" name="a9281daf76e888ea1bd5247d5732e8179"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a9281daf76e888ea1bd5247d5732e8179">◆ </a></span>Allocate()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">HRESULT D3D12MA::VirtualBlock::Allocate </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">VIRTUAL_ALLOCATION_DESC</a> *</td> <td class="paramname"><span class="paramname"><em>pDesc</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_virtual_allocation.html">VirtualAllocation</a> *</td> <td class="paramname"><span class="paramname"><em>pAllocation</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">UINT64 *</td> <td class="paramname"><span class="paramname"><em>pOffset</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Creates new allocation. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir"></td><td class="paramname">pDesc</td><td></td></tr>
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocation</td><td>Unique indentifier of the new allocation within single block. </td></tr>
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">pOffset</td><td>Returned offset of the new allocation. Optional, can be null. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd><code>S_OK</code> if allocation succeeded, <code>E_OUTOFMEMORY</code> if it failed.</dd></dl>
|
||||
<p>If the allocation failed, <code>pAllocation->AllocHandle</code> is set to 0 and <code>pOffset</code>, if not null, is set to <code>UINT64_MAX</code>. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a828a27070bfa762cae796d4c8f2ef703" name="a828a27070bfa762cae796d4c8f2ef703"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a828a27070bfa762cae796d4c8f2ef703">◆ </a></span>BuildStatsString()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::VirtualBlock::BuildStatsString </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">WCHAR **</td> <td class="paramname"><span class="paramname"><em>ppStatsString</em></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Builds and returns statistics as a string in JSON format, including the list of allocations with their parameters. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">ppStatsString</td><td>Must be freed using <a class="el" href="#a6f78ddaa7da194e239089e52093e68a9" title="Frees memory of a string returned from VirtualBlock::BuildStatsString.">VirtualBlock::FreeStatsString</a>. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a614a82247ce6cf29c38895e16eb971d9" name="a614a82247ce6cf29c38895e16eb971d9"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a614a82247ce6cf29c38895e16eb971d9">◆ </a></span>CalculateStatistics()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::VirtualBlock::CalculateStatistics </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_detailed_statistics.html">DetailedStatistics</a> *</td> <td class="paramname"><span class="paramname"><em>pStats</em></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Retrieves detailed statistics of the virtual block that are slower to calculate. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">pStats</td><td>Statistics of the virtual block. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae22b18c0b7c31b44c1d740f886369189" name="ae22b18c0b7c31b44c1d740f886369189"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae22b18c0b7c31b44c1d740f886369189">◆ </a></span>Clear()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::VirtualBlock::Clear </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Frees all the allocations. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aab44e46bd122054c894fc84740f1e8fb" name="aab44e46bd122054c894fc84740f1e8fb"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aab44e46bd122054c894fc84740f1e8fb">◆ </a></span>FreeAllocation()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::VirtualBlock::FreeAllocation </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_virtual_allocation.html">VirtualAllocation</a></td> <td class="paramname"><span class="paramname"><em>allocation</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Frees the allocation. </p>
|
||||
<p>Calling this function with <code>allocation.AllocHandle == 0</code> is correct and does nothing. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a6f78ddaa7da194e239089e52093e68a9" name="a6f78ddaa7da194e239089e52093e68a9"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a6f78ddaa7da194e239089e52093e68a9">◆ </a></span>FreeStatsString()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::VirtualBlock::FreeStatsString </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">WCHAR *</td> <td class="paramname"><span class="paramname"><em>pStatsString</em></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Frees memory of a string returned from <a class="el" href="#a828a27070bfa762cae796d4c8f2ef703" title="Builds and returns statistics as a string in JSON format, including the list of allocations with thei...">VirtualBlock::BuildStatsString</a>. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ac605dce05ca0d411e46079f0bad765d1" name="ac605dce05ca0d411e46079f0bad765d1"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ac605dce05ca0d411e46079f0bad765d1">◆ </a></span>GetAllocationInfo()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::VirtualBlock::GetAllocationInfo </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_virtual_allocation.html">VirtualAllocation</a></td> <td class="paramname"><span class="paramname"><em>allocation</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___a_l_l_o_c_a_t_i_o_n___i_n_f_o.html">VIRTUAL_ALLOCATION_INFO</a> *</td> <td class="paramname"><span class="paramname"><em>pInfo</em></span> ) const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns information about an allocation - its offset, size and custom pointer. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a0f1dda0e019e218b021f64987a74b110" name="a0f1dda0e019e218b021f64987a74b110"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a0f1dda0e019e218b021f64987a74b110">◆ </a></span>GetStatistics()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::VirtualBlock::GetStatistics </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_statistics.html">Statistics</a> *</td> <td class="paramname"><span class="paramname"><em>pStats</em></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Retrieves basic statistics of the virtual block that are fast to calculate. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[out]</td><td class="paramname">pStats</td><td>Statistics of the virtual block. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a7b23fd2da6f0343095fb14b31395678b" name="a7b23fd2da6f0343095fb14b31395678b"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a7b23fd2da6f0343095fb14b31395678b">◆ </a></span>IsEmpty()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">BOOL D3D12MA::VirtualBlock::IsEmpty </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td> const</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Returns true if the block is empty - contains 0 allocations. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ab96e34500b75a83a09d73b4585669114" name="ab96e34500b75a83a09d73b4585669114"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ab96e34500b75a83a09d73b4585669114">◆ </a></span>SetAllocationPrivateData()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void D3D12MA::VirtualBlock::SetAllocationPrivateData </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_virtual_allocation.html">VirtualAllocation</a></td> <td class="paramname"><span class="paramname"><em>allocation</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">void *</td> <td class="paramname"><span class="paramname"><em>pPrivateData</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Changes custom pointer for an allocation to a new value. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<hr/>The documentation for this class was generated from the following file:<ul>
|
||||
<li>D:/PROJECTS/D3D12 Memory Allocator/REPO/include/<a class="el" href="_d3_d12_mem_alloc_8h.html">D3D12MemAlloc.h</a></li>
|
||||
</ul>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 594 B |
@@ -0,0 +1,107 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: Class Index</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle"><div class="title">Class Index</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="qindex"><a class="qindex" href="#letter_A">A</a> | <a class="qindex" href="#letter_B">B</a> | <a class="qindex" href="#letter_D">D</a> | <a class="qindex" href="#letter_P">P</a> | <a class="qindex" href="#letter_S">S</a> | <a class="qindex" href="#letter_T">T</a> | <a class="qindex" href="#letter_V">V</a></div>
|
||||
<div class="classindex">
|
||||
<dl class="classindex even">
|
||||
<dt class="alphachar"><a id="letter_A" name="letter_A">A</a></dt>
|
||||
<dd><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s.html">ALLOCATION_CALLBACKS</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">Allocator</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html">ALLOCATOR_DESC</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd></dl>
|
||||
<dl class="classindex odd">
|
||||
<dt class="alphachar"><a id="letter_B" name="letter_B">B</a></dt>
|
||||
<dd><a class="el" href="struct_d3_d12_m_a_1_1_budget.html">Budget</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd></dl>
|
||||
<dl class="classindex even">
|
||||
<dt class="alphachar"><a id="letter_D" name="letter_D">D</a></dt>
|
||||
<dd><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html">DEFRAGMENTATION_DESC</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e.html">DEFRAGMENTATION_MOVE</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html">DEFRAGMENTATION_PASS_MOVE_INFO</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___s_t_a_t_s.html">DEFRAGMENTATION_STATS</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">DefragmentationContext</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="struct_d3_d12_m_a_1_1_detailed_statistics.html">DetailedStatistics</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd></dl>
|
||||
<dl class="classindex odd">
|
||||
<dt class="alphachar"><a id="letter_P" name="letter_P">P</a></dt>
|
||||
<dd><a class="el" href="class_d3_d12_m_a_1_1_pool.html">Pool</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html">POOL_DESC</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd></dl>
|
||||
<dl class="classindex even">
|
||||
<dt class="alphachar"><a id="letter_S" name="letter_S">S</a></dt>
|
||||
<dd><a class="el" href="struct_d3_d12_m_a_1_1_statistics.html">Statistics</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd></dl>
|
||||
<dl class="classindex odd">
|
||||
<dt class="alphachar"><a id="letter_T" name="letter_T">T</a></dt>
|
||||
<dd><a class="el" href="struct_d3_d12_m_a_1_1_total_statistics.html">TotalStatistics</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd></dl>
|
||||
<dl class="classindex even">
|
||||
<dt class="alphachar"><a id="letter_V" name="letter_V">V</a></dt>
|
||||
<dd><a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">VIRTUAL_ALLOCATION_DESC</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___a_l_l_o_c_a_t_i_o_n___i_n_f_o.html">VIRTUAL_ALLOCATION_INFO</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="struct_d3_d12_m_a_1_1_v_i_r_t_u_a_l___b_l_o_c_k___d_e_s_c.html">VIRTUAL_BLOCK_DESC</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="struct_d3_d12_m_a_1_1_virtual_allocation.html">VirtualAllocation</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd><dd><a class="el" href="class_d3_d12_m_a_1_1_virtual_block.html">VirtualBlock</a> (<a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a>)</dd></dl>
|
||||
</div>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
|
||||
The code below is based on the Doxygen Awesome project, see
|
||||
https://github.com/jothepro/doxygen-awesome-css
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 - 2022 jothepro
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
let clipboard_title = "Copy to clipboard"
|
||||
let clipboard_icon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>`
|
||||
let clipboard_successIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/></svg>`
|
||||
let clipboard_successDuration = 1000
|
||||
|
||||
$(function() {
|
||||
if(navigator.clipboard) {
|
||||
const fragments = document.getElementsByClassName("fragment")
|
||||
for(const fragment of fragments) {
|
||||
const clipboard_div = document.createElement("div")
|
||||
clipboard_div.classList.add("clipboard")
|
||||
clipboard_div.innerHTML = clipboard_icon
|
||||
clipboard_div.title = clipboard_title
|
||||
$(clipboard_div).click(function() {
|
||||
const content = this.parentNode.cloneNode(true)
|
||||
// filter out line number and folded fragments from file listings
|
||||
content.querySelectorAll(".lineno, .ttc, .foldclosed").forEach((node) => { node.remove() })
|
||||
let text = content.textContent
|
||||
// remove trailing newlines and trailing spaces from empty lines
|
||||
text = text.replace(/^\s*\n/gm,'\n').replace(/\n*$/,'')
|
||||
navigator.clipboard.writeText(text);
|
||||
this.classList.add("success")
|
||||
this.innerHTML = clipboard_successIcon
|
||||
window.setTimeout(() => { // switch back to normal icon after timeout
|
||||
this.classList.remove("success")
|
||||
this.innerHTML = clipboard_icon
|
||||
}, clipboard_successDuration);
|
||||
})
|
||||
fragment.insertBefore(clipboard_div, fragment.firstChild)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
After Width: | Height: | Size: 132 B |
@@ -0,0 +1,141 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: Configuration</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="index.html">D3D12 Memory Allocator</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div><div class="header">
|
||||
<div class="headertitle"><div class="title">Configuration</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>Please check file <code>D3D12MemAlloc.cpp</code> lines between "Configuration Begin" and "Configuration End" to find macros that you can define to change the behavior of the library, primarily for debugging purposes.</p>
|
||||
<h1><a class="anchor" id="custom_memory_allocator"></a>
|
||||
Custom CPU memory allocator</h1>
|
||||
<p>If you use custom allocator for CPU memory rather than default C++ operator <code>new</code> and <code>delete</code> or <code>malloc</code> and <code>free</code> functions, you can make this library using your allocator as well by filling structure <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s.html" title="Custom callbacks to CPU memory allocation functions.">D3D12MA::ALLOCATION_CALLBACKS</a> and passing it as optional member <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html#a773ecc1945eb47c20e06455c3759e4ef" title="Custom CPU memory allocation callbacks. Optional.">D3D12MA::ALLOCATOR_DESC::pAllocationCallbacks</a>. Functions pointed there will be used by the library to make any CPU-side allocations. Example:</p>
|
||||
<div class="fragment"><div class="line"><span class="preprocessor">#include <malloc.h></span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="keywordtype">void</span>* CustomAllocate(<span class="keywordtype">size_t</span> Size, <span class="keywordtype">size_t</span> Alignment, <span class="keywordtype">void</span>* pPrivateData)</div>
|
||||
<div class="line">{</div>
|
||||
<div class="line"> <span class="keywordtype">void</span>* memory = _aligned_malloc(Size, Alignment);</div>
|
||||
<div class="line"> <span class="comment">// Your extra bookkeeping here...</span></div>
|
||||
<div class="line"> <span class="keywordflow">return</span> memory;</div>
|
||||
<div class="line">}</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="keywordtype">void</span> CustomFree(<span class="keywordtype">void</span>* pMemory, <span class="keywordtype">void</span>* pPrivateData)</div>
|
||||
<div class="line">{</div>
|
||||
<div class="line"> <span class="comment">// Your extra bookkeeping here...</span></div>
|
||||
<div class="line"> _aligned_free(pMemory);</div>
|
||||
<div class="line">}</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">(...)</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><a class="code hl_struct" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s.html">D3D12MA::ALLOCATION_CALLBACKS</a> allocationCallbacks = {};</div>
|
||||
<div class="line">allocationCallbacks.<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s.html#af4d6436455728696fefd503869226436">pAllocate</a> = &CustomAllocate;</div>
|
||||
<div class="line">allocationCallbacks.<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s.html#a114e6c4d63d6b020e01f526a975d6849">pFree</a> = &CustomFree;</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><a class="code hl_struct" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html">D3D12MA::ALLOCATOR_DESC</a> allocatorDesc = {};</div>
|
||||
<div class="line">allocatorDesc.<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html#ada1bf21205065b3aa0284b5a9ee1cb3c">pDevice</a> = device;</div>
|
||||
<div class="line">allocatorDesc.<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html#abf9a9f87f0ffea52816efd363c5fcd7b">pAdapter</a> = adapter;</div>
|
||||
<div class="line">allocatorDesc.<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html#a773ecc1945eb47c20e06455c3759e4ef">pAllocationCallbacks</a> = &allocationCallbacks;</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><a class="code hl_class" href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a>* allocator;</div>
|
||||
<div class="line">HRESULT hr = <a class="code hl_function" href="namespace_d3_d12_m_a.html#ab7a1cd1683986d75ce1488b0920f4cb0">D3D12MA::CreateAllocator</a>(&allocatorDesc, &allocator);</div>
|
||||
<div class="ttc" id="aclass_d3_d12_m_a_1_1_allocator_html"><div class="ttname"><a href="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></div><div class="ttdoc">Represents main object of this library initialized for particular ID3D12Device.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:1121</div></div>
|
||||
<div class="ttc" id="anamespace_d3_d12_m_a_html_ab7a1cd1683986d75ce1488b0920f4cb0"><div class="ttname"><a href="namespace_d3_d12_m_a.html#ab7a1cd1683986d75ce1488b0920f4cb0">D3D12MA::CreateAllocator</a></div><div class="ttdeci">D3D12MA_API HRESULT CreateAllocator(const ALLOCATOR_DESC *pDesc, Allocator **ppAllocator)</div><div class="ttdoc">Creates new main D3D12MA::Allocator object and returns it through ppAllocator.</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s_html"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s.html">D3D12MA::ALLOCATION_CALLBACKS</a></div><div class="ttdoc">Custom callbacks to CPU memory allocation functions.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:209</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s_html_a114e6c4d63d6b020e01f526a975d6849"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s.html#a114e6c4d63d6b020e01f526a975d6849">D3D12MA::ALLOCATION_CALLBACKS::pFree</a></div><div class="ttdeci">FREE_FUNC_PTR pFree</div><div class="ttdoc">Dellocation function.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:213</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s_html_af4d6436455728696fefd503869226436"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s.html#af4d6436455728696fefd503869226436">D3D12MA::ALLOCATION_CALLBACKS::pAllocate</a></div><div class="ttdeci">ALLOCATE_FUNC_PTR pAllocate</div><div class="ttdoc">Allocation function.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:211</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c_html"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html">D3D12MA::ALLOCATOR_DESC</a></div><div class="ttdoc">Parameters of created Allocator object. To be used with CreateAllocator().</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:1082</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c_html_a773ecc1945eb47c20e06455c3759e4ef"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html#a773ecc1945eb47c20e06455c3759e4ef">D3D12MA::ALLOCATOR_DESC::pAllocationCallbacks</a></div><div class="ttdeci">const ALLOCATION_CALLBACKS * pAllocationCallbacks</div><div class="ttdoc">Custom CPU memory allocation callbacks. Optional.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:1102</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c_html_abf9a9f87f0ffea52816efd363c5fcd7b"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html#abf9a9f87f0ffea52816efd363c5fcd7b">D3D12MA::ALLOCATOR_DESC::pAdapter</a></div><div class="ttdeci">IDXGIAdapter * pAdapter</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:1108</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c_html_ada1bf21205065b3aa0284b5a9ee1cb3c"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html#ada1bf21205065b3aa0284b5a9ee1cb3c">D3D12MA::ALLOCATOR_DESC::pDevice</a></div><div class="ttdeci">ID3D12Device * pDevice</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:1090</div></div>
|
||||
</div><!-- fragment --><h1><a class="anchor" id="debug_margins"></a>
|
||||
Debug margins</h1>
|
||||
<p>By default, allocations are laid out in memory blocks next to each other if possible (considering required alignment returned by <code>ID3D12Device::GetResourceAllocationInfo</code>).</p>
|
||||
<p><img src="../gfx/Margins_1.png" alt="Allocations without margin" class="inline"/></p>
|
||||
<p>Define macro <code>D3D12MA_DEBUG_MARGIN</code> to some non-zero value (e.g. 16) inside "D3D12MemAlloc.cpp" to enforce specified number of bytes as a margin after every allocation.</p>
|
||||
<p><img src="../gfx/Margins_2.png" alt="Allocations with margin" class="inline"/></p>
|
||||
<p>If your bug goes away after enabling margins, it means it may be caused by memory being overwritten outside of allocation boundaries. It is not 100% certain though. Change in application behavior may also be caused by different order and distribution of allocations across memory blocks after margins are applied.</p>
|
||||
<p>Margins work with all memory heap types.</p>
|
||||
<p>Margin is applied only to placed allocations made out of memory heaps and not to committed allocations, which have their own, implicit memory heap of specific size. It is thus not applied to allocations made using <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645ea661a5472dba3dcecc5a2cc92afd25675">D3D12MA::ALLOCATION_FLAG_COMMITTED</a> flag or those automatically decided to put into committed allocations, e.g. due to its large size.</p>
|
||||
<p>Margins appear in <a class="el" href="statistics.html#statistics_json_dump">JSON dump</a> as part of free space.</p>
|
||||
<p>Note that enabling margins increases memory usage and fragmentation.</p>
|
||||
<p>Margins do not apply to <a class="el" href="virtual_allocator.html">Virtual allocator</a>. </p>
|
||||
</div></div><!-- contents -->
|
||||
</div><!-- PageDoc -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,58 @@
|
||||
/*!
|
||||
Cookie helper functions
|
||||
Copyright (c) 2023 Dimitri van Heesch
|
||||
Released under MIT license.
|
||||
*/
|
||||
let Cookie = {
|
||||
cookie_namespace: 'doxygen_',
|
||||
|
||||
readSetting(cookie,defVal) {
|
||||
if (window.chrome) {
|
||||
const val = localStorage.getItem(this.cookie_namespace+cookie) ||
|
||||
sessionStorage.getItem(this.cookie_namespace+cookie);
|
||||
if (val) return val;
|
||||
} else {
|
||||
let myCookie = this.cookie_namespace+cookie+"=";
|
||||
if (document.cookie) {
|
||||
const index = document.cookie.indexOf(myCookie);
|
||||
if (index != -1) {
|
||||
const valStart = index + myCookie.length;
|
||||
let valEnd = document.cookie.indexOf(";", valStart);
|
||||
if (valEnd == -1) {
|
||||
valEnd = document.cookie.length;
|
||||
}
|
||||
return document.cookie.substring(valStart, valEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
return defVal;
|
||||
},
|
||||
|
||||
writeSetting(cookie,val,days=10*365) { // default days='forever', 0=session cookie, -1=delete
|
||||
if (window.chrome) {
|
||||
if (days==0) {
|
||||
sessionStorage.setItem(this.cookie_namespace+cookie,val);
|
||||
} else {
|
||||
localStorage.setItem(this.cookie_namespace+cookie,val);
|
||||
}
|
||||
} else {
|
||||
let date = new Date();
|
||||
date.setTime(date.getTime()+(days*24*60*60*1000));
|
||||
const expiration = days!=0 ? "expires="+date.toGMTString()+";" : "";
|
||||
document.cookie = this.cookie_namespace + cookie + "=" +
|
||||
val + "; SameSite=Lax;" + expiration + "path=/";
|
||||
}
|
||||
},
|
||||
|
||||
eraseSetting(cookie) {
|
||||
if (window.chrome) {
|
||||
if (localStorage.getItem(this.cookie_namespace+cookie)) {
|
||||
localStorage.removeItem(this.cookie_namespace+cookie);
|
||||
} else if (sessionStorage.getItem(this.cookie_namespace+cookie)) {
|
||||
sessionStorage.removeItem(this.cookie_namespace+cookie);
|
||||
}
|
||||
} else {
|
||||
this.writeSetting(cookie,'',-1);
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: Custom memory pools</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="index.html">D3D12 Memory Allocator</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div><div class="header">
|
||||
<div class="headertitle"><div class="title">Custom memory pools</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>A "pool" is a collection of memory blocks that share certain properties. Allocator creates 3 default pools: for <code>D3D12_HEAP_TYPE_DEFAULT</code>, <code>UPLOAD</code>, <code>READBACK</code>. A default pool automatically grows in size. Size of allocated blocks is also variable and managed automatically. Typical allocations are created in these pools. You can also create custom pools.</p>
|
||||
<h1><a class="anchor" id="custom_pools_usage"></a>
|
||||
Usage</h1>
|
||||
<p>To create a custom pool, fill in structure <a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html" title="Parameters of created D3D12MA::Pool object. To be used with D3D12MA::Allocator::CreatePool.">D3D12MA::POOL_DESC</a> and call function <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aac7b1f6bf53cbf4c4ce2264cb72ca515" title="Creates custom pool.">D3D12MA::Allocator::CreatePool</a> to obtain object <a class="el" href="class_d3_d12_m_a_1_1_pool.html" title="Custom memory pool.">D3D12MA::Pool</a>. Example:</p>
|
||||
<div class="fragment"><div class="line">POOL_DESC poolDesc = {};</div>
|
||||
<div class="line">poolDesc.HeapProperties.Type = D3D12_HEAP_TYPE_DEFAULT;</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">Pool* pool;</div>
|
||||
<div class="line">HRESULT hr = allocator->CreatePool(&poolDesc, &pool);</div>
|
||||
</div><!-- fragment --><p>To allocate resources out of a custom pool, only set member <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html#ab06b85f3cf3254f855b29264477e3934" title="Custom pool to place the new resource in. Optional.">D3D12MA::ALLOCATION_DESC::CustomPool</a>. Example:</p>
|
||||
<div class="fragment"><div class="line">ALLOCATION_DESC allocDesc = {};</div>
|
||||
<div class="line">allocDesc.CustomPool = pool;</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">D3D12_RESOURCE_DESC resDesc = ...</div>
|
||||
<div class="line">Allocation* alloc;</div>
|
||||
<div class="line">hr = allocator->CreateResource(&allocDesc, &resDesc,</div>
|
||||
<div class="line"> D3D12_RESOURCE_STATE_GENERIC_READ, NULL, &alloc, IID_NULL, NULL);</div>
|
||||
</div><!-- fragment --><p>All allocations must be released before releasing the pool. The pool must be released before relasing the allocator.</p>
|
||||
<div class="fragment"><div class="line">alloc->Release();</div>
|
||||
<div class="line">pool->Release();</div>
|
||||
</div><!-- fragment --><h1><a class="anchor" id="custom_pools_features_and_benefits"></a>
|
||||
Features and benefits</h1>
|
||||
<p>While it is recommended to use default pools whenever possible for simplicity and to give the allocator more opportunities for internal optimizations, custom pools may be useful in following cases:</p>
|
||||
<ul>
|
||||
<li>To keep some resources separate from others in memory.</li>
|
||||
<li>To keep track of memory usage of just a specific group of resources. Statistics can be queried using <a class="el" href="class_d3_d12_m_a_1_1_pool.html#ad07999ac5dc8f0c63187afd45d551910" title="Retrieves detailed statistics of the custom pool that are slower to calculate.">D3D12MA::Pool::CalculateStatistics</a>.</li>
|
||||
<li>To use specific size of a memory block (<code>ID3D12Heap</code>). To set it, use member <a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#af7284cc51a8ed5b551075584256de23c" title="Size of a single heap (memory block) to be allocated as part of this pool, in bytes....">D3D12MA::POOL_DESC::BlockSize</a>. When set to 0, the library uses automatically determined, variable block sizes.</li>
|
||||
<li>To reserve some minimum amount of memory allocated. To use it, set member <a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#a6f10db3911a3bea1becfc9a0dfa5bac8" title="Minimum number of heaps (memory blocks) to be always allocated in this pool, even if they stay empty....">D3D12MA::POOL_DESC::MinBlockCount</a>.</li>
|
||||
<li>To limit maximum amount of memory allocated. To use it, set member <a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#abbce3a99f253928f9c3c09fa16015f9e" title="Maximum number of heaps (memory blocks) that can be allocated in this pool. Optional.">D3D12MA::POOL_DESC::MaxBlockCount</a>.</li>
|
||||
<li>To use extended parameters of the D3D12 memory allocation. While resources created from default pools can only specify <code>D3D12_HEAP_TYPE_DEFAULT</code>, <code>UPLOAD</code>, <code>READBACK</code>, a custom pool may use non-standard <code>D3D12_HEAP_PROPERTIES</code> (member <a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#a06e06813bcb5206e9f7a8b0564bf1d6a" title="The parameters of memory heap where allocations of this pool should be placed.">D3D12MA::POOL_DESC::HeapProperties</a>) and <code>D3D12_HEAP_FLAGS</code> (<a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#a3795956e4fbfe7c3a23546e02e5d28dc" title="Heap flags to be used when allocating heaps of this pool.">D3D12MA::POOL_DESC::HeapFlags</a>), which is useful e.g. for cross-adapter sharing or UMA (see also <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a9e742884bd45dd7f01193d13fcd05af0" title="Returns true if D3D12_FEATURE_DATA_ARCHITECTURE1::UMA was found to be true.">D3D12MA::Allocator::IsUMA</a>).</li>
|
||||
</ul>
|
||||
<p>New versions of this library support creating <b>committed allocations in custom pools</b>. It is supported only when <a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#af7284cc51a8ed5b551075584256de23c" title="Size of a single heap (memory block) to be allocated as part of this pool, in bytes....">D3D12MA::POOL_DESC::BlockSize</a> = 0. To use this feature, set <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html#ab06b85f3cf3254f855b29264477e3934" title="Custom pool to place the new resource in. Optional.">D3D12MA::ALLOCATION_DESC::CustomPool</a> to the pointer to your custom pool and <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html#a92dec49b788a334fc91c55340dfbace6" title="Flags.">D3D12MA::ALLOCATION_DESC::Flags</a> to <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645ea661a5472dba3dcecc5a2cc92afd25675">D3D12MA::ALLOCATION_FLAG_COMMITTED</a>. Example:</p>
|
||||
<div class="fragment"><div class="line">ALLOCATION_DESC allocDesc = {};</div>
|
||||
<div class="line">allocDesc.CustomPool = pool;</div>
|
||||
<div class="line">allocDesc.Flags = ALLOCATION_FLAG_COMMITTED;</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">D3D12_RESOURCE_DESC resDesc = ...</div>
|
||||
<div class="line">Allocation* alloc;</div>
|
||||
<div class="line">ID3D12Resource* res;</div>
|
||||
<div class="line">hr = allocator->CreateResource(&allocDesc, &resDesc,</div>
|
||||
<div class="line"> D3D12_RESOURCE_STATE_GENERIC_READ, NULL, &alloc, IID_PPV_ARGS(&res));</div>
|
||||
</div><!-- fragment --><p>This feature may seem unnecessary, but creating committed allocations from custom pools may be useful in some cases, e.g. to have separate memory usage statistics for some group of resources or to use extended allocation parameters, like custom <code>D3D12_HEAP_PROPERTIES</code>, which are available only in custom pools. </p>
|
||||
</div></div><!-- contents -->
|
||||
</div><!-- PageDoc -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,205 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: Defragmentation</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="index.html">D3D12 Memory Allocator</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div><div class="header">
|
||||
<div class="headertitle"><div class="title">Defragmentation</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>Interleaved allocations and deallocations of many objects of varying size can cause fragmentation over time, which can lead to a situation where the library is unable to find a continuous range of free memory for a new allocation despite there is enough free space, just scattered across many small free ranges between existing allocations.</p>
|
||||
<p>To mitigate this problem, you can use defragmentation feature. It doesn't happen automatically though and needs your cooperation, because D3D12MA is a low level library that only allocates memory. It cannot recreate buffers and textures in a new place as it doesn't remember the contents of <code>D3D12_RESOURCE_DESC</code> structure. It cannot copy their contents as it doesn't record any commands to a command list.</p>
|
||||
<p>Example:</p>
|
||||
<div class="fragment"><div class="line"><a class="code hl_struct" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html">D3D12MA::DEFRAGMENTATION_DESC</a> defragDesc = {};</div>
|
||||
<div class="line">defragDesc.<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html#aac9a357e679a0afa9ab84cd06057630b">Flags</a> = <a class="code hl_enumvalue" href="namespace_d3_d12_m_a.html#ab433989212ee6736bf9d63c5bc565df4a9d0301a81136ca79e3ba52542c6d2e13">D3D12MA::DEFRAGMENTATION_FLAG_ALGORITHM_FAST</a>;</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><a class="code hl_class" href="class_d3_d12_m_a_1_1_defragmentation_context.html">D3D12MA::DefragmentationContext</a>* defragCtx;</div>
|
||||
<div class="line">allocator->BeginDefragmentation(&defragDesc, &defragCtx);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="keywordflow">for</span>(;;)</div>
|
||||
<div class="line">{</div>
|
||||
<div class="line"> <a class="code hl_struct" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html">D3D12MA::DEFRAGMENTATION_PASS_MOVE_INFO</a> pass;</div>
|
||||
<div class="line"> HRESULT hr = defragCtx-><a class="code hl_function" href="class_d3_d12_m_a_1_1_defragmentation_context.html#a1606c015d02edc094bb246986159d592">BeginPass</a>(&pass);</div>
|
||||
<div class="line"> <span class="keywordflow">if</span>(hr == S_OK)</div>
|
||||
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span>(hr != S_FALSE)</div>
|
||||
<div class="line"> <span class="comment">// Handle error...</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="keywordflow">for</span>(UINT i = 0; i < pass.<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html#a8df22d990c318d82fe9fcc5f04132c04">MoveCount</a>; ++i)</div>
|
||||
<div class="line"> {</div>
|
||||
<div class="line"> <span class="comment">// Inspect pass.pMoves[i].pSrcAllocation, identify what buffer/texture it represents.</span></div>
|
||||
<div class="line"> MyEngineResourceData* resData = (MyEngineResourceData*)pMoves[i].pSrcAllocation->GetPrivateData();</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// Recreate this buffer/texture as placed at pass.pMoves[i].pDstTmpAllocation.</span></div>
|
||||
<div class="line"> D3D12_RESOURCE_DESC resDesc = ...</div>
|
||||
<div class="line"> ID3D12Resource* newRes;</div>
|
||||
<div class="line"> hr = device->CreatePlacedResource(</div>
|
||||
<div class="line"> pass.<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html#a719fbdaae54251759605c41baeb24dc4">pMoves</a>[i].<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e.html#aec0c7f51ccc870c6a88af7c7390d8eda">pDstTmpAllocation</a>-><a class="code hl_function" href="class_d3_d12_m_a_1_1_allocation.html#adca8d5a82bed492fe7265fcda6e53da2">GetHeap</a>(),</div>
|
||||
<div class="line"> pass.<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html#a719fbdaae54251759605c41baeb24dc4">pMoves</a>[i].<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e.html#aec0c7f51ccc870c6a88af7c7390d8eda">pDstTmpAllocation</a>-><a class="code hl_function" href="class_d3_d12_m_a_1_1_allocation.html#a47be9557d441797b65de177a3d5cdf60">GetOffset</a>(), &resDesc,</div>
|
||||
<div class="line"> D3D12_RESOURCE_STATE_COPY_DEST, NULL, IID_PPV_ARGS(&newRes));</div>
|
||||
<div class="line"> <span class="comment">// Check hr...</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// Store new resource in the pDstTmpAllocation.</span></div>
|
||||
<div class="line"> pass.<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html#a719fbdaae54251759605c41baeb24dc4">pMoves</a>[i].<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e.html#aec0c7f51ccc870c6a88af7c7390d8eda">pDstTmpAllocation</a>-><a class="code hl_function" href="class_d3_d12_m_a_1_1_allocation.html#a414a088c22bae0f29b1038f5f9346d14">SetResource</a>(newRes);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// Copy its content to the new place.</span></div>
|
||||
<div class="line"> cmdList->CopyResource(</div>
|
||||
<div class="line"> pass.<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html#a719fbdaae54251759605c41baeb24dc4">pMoves</a>[i].<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e.html#aec0c7f51ccc870c6a88af7c7390d8eda">pDstTmpAllocation</a>-><a class="code hl_function" href="class_d3_d12_m_a_1_1_allocation.html#ad00308118252f82d8f803c623c67bf18">GetResource</a>(),</div>
|
||||
<div class="line"> pass.<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html#a719fbdaae54251759605c41baeb24dc4">pMoves</a>[i].<a class="code hl_variable" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e.html#a4946b874c958a71c21fac25b515cf5f7">pSrcAllocation</a>-><a class="code hl_function" href="class_d3_d12_m_a_1_1_allocation.html#ad00308118252f82d8f803c623c67bf18">GetResource</a>());</div>
|
||||
<div class="line"> }</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// Make sure the copy commands finished executing.</span></div>
|
||||
<div class="line"> cmdQueue->ExecuteCommandLists(...);</div>
|
||||
<div class="line"> <span class="comment">// ...</span></div>
|
||||
<div class="line"> WaitForSingleObject(fenceEvent, INFINITE);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="comment">// Update appropriate descriptors to point to the new places...</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> hr = defragCtx-><a class="code hl_function" href="class_d3_d12_m_a_1_1_defragmentation_context.html#aad502ba70d6dadaeee37703fd8bf90ae">EndPass</a>(&pass);</div>
|
||||
<div class="line"> <span class="keywordflow">if</span>(hr == S_OK)</div>
|
||||
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span>(hr != S_FALSE)</div>
|
||||
<div class="line"> <span class="comment">// Handle error...</span></div>
|
||||
<div class="line">}</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">defragCtx->Release();</div>
|
||||
<div class="ttc" id="aclass_d3_d12_m_a_1_1_allocation_html_a414a088c22bae0f29b1038f5f9346d14"><div class="ttname"><a href="class_d3_d12_m_a_1_1_allocation.html#a414a088c22bae0f29b1038f5f9346d14">D3D12MA::Allocation::SetResource</a></div><div class="ttdeci">void SetResource(ID3D12Resource *pResource)</div><div class="ttdoc">Releases the resource currently pointed by the allocation (if any), sets it to new one,...</div></div>
|
||||
<div class="ttc" id="aclass_d3_d12_m_a_1_1_allocation_html_a47be9557d441797b65de177a3d5cdf60"><div class="ttname"><a href="class_d3_d12_m_a_1_1_allocation.html#a47be9557d441797b65de177a3d5cdf60">D3D12MA::Allocation::GetOffset</a></div><div class="ttdeci">UINT64 GetOffset() const</div><div class="ttdoc">Returns offset in bytes from the start of memory heap.</div></div>
|
||||
<div class="ttc" id="aclass_d3_d12_m_a_1_1_allocation_html_ad00308118252f82d8f803c623c67bf18"><div class="ttname"><a href="class_d3_d12_m_a_1_1_allocation.html#ad00308118252f82d8f803c623c67bf18">D3D12MA::Allocation::GetResource</a></div><div class="ttdeci">ID3D12Resource * GetResource() const</div><div class="ttdoc">Returns D3D12 resource associated with this object.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:511</div></div>
|
||||
<div class="ttc" id="aclass_d3_d12_m_a_1_1_allocation_html_adca8d5a82bed492fe7265fcda6e53da2"><div class="ttname"><a href="class_d3_d12_m_a_1_1_allocation.html#adca8d5a82bed492fe7265fcda6e53da2">D3D12MA::Allocation::GetHeap</a></div><div class="ttdeci">ID3D12Heap * GetHeap() const</div><div class="ttdoc">Returns memory heap that the resource is created in.</div></div>
|
||||
<div class="ttc" id="aclass_d3_d12_m_a_1_1_defragmentation_context_html"><div class="ttname"><a href="class_d3_d12_m_a_1_1_defragmentation_context.html">D3D12MA::DefragmentationContext</a></div><div class="ttdoc">Represents defragmentation process in progress.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:790</div></div>
|
||||
<div class="ttc" id="aclass_d3_d12_m_a_1_1_defragmentation_context_html_a1606c015d02edc094bb246986159d592"><div class="ttname"><a href="class_d3_d12_m_a_1_1_defragmentation_context.html#a1606c015d02edc094bb246986159d592">D3D12MA::DefragmentationContext::BeginPass</a></div><div class="ttdeci">HRESULT BeginPass(DEFRAGMENTATION_PASS_MOVE_INFO *pPassInfo)</div><div class="ttdoc">Starts single defragmentation pass.</div></div>
|
||||
<div class="ttc" id="aclass_d3_d12_m_a_1_1_defragmentation_context_html_aad502ba70d6dadaeee37703fd8bf90ae"><div class="ttname"><a href="class_d3_d12_m_a_1_1_defragmentation_context.html#aad502ba70d6dadaeee37703fd8bf90ae">D3D12MA::DefragmentationContext::EndPass</a></div><div class="ttdeci">HRESULT EndPass(DEFRAGMENTATION_PASS_MOVE_INFO *pPassInfo)</div><div class="ttdoc">Ends single defragmentation pass.</div></div>
|
||||
<div class="ttc" id="anamespace_d3_d12_m_a_html_ab433989212ee6736bf9d63c5bc565df4a9d0301a81136ca79e3ba52542c6d2e13"><div class="ttname"><a href="namespace_d3_d12_m_a.html#ab433989212ee6736bf9d63c5bc565df4a9d0301a81136ca79e3ba52542c6d2e13">D3D12MA::DEFRAGMENTATION_FLAG_ALGORITHM_FAST</a></div><div class="ttdeci">@ DEFRAGMENTATION_FLAG_ALGORITHM_FAST</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:670</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c_html"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html">D3D12MA::DEFRAGMENTATION_DESC</a></div><div class="ttdoc">Parameters for defragmentation.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:692</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c_html_aac9a357e679a0afa9ab84cd06057630b"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html#aac9a357e679a0afa9ab84cd06057630b">D3D12MA::DEFRAGMENTATION_DESC::Flags</a></div><div class="ttdeci">DEFRAGMENTATION_FLAGS Flags</div><div class="ttdoc">Flags.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:694</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e_html_a4946b874c958a71c21fac25b515cf5f7"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e.html#a4946b874c958a71c21fac25b515cf5f7">D3D12MA::DEFRAGMENTATION_MOVE::pSrcAllocation</a></div><div class="ttdeci">Allocation * pSrcAllocation</div><div class="ttdoc">Allocation that should be moved.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:728</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e_html_aec0c7f51ccc870c6a88af7c7390d8eda"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___m_o_v_e.html#aec0c7f51ccc870c6a88af7c7390d8eda">D3D12MA::DEFRAGMENTATION_MOVE::pDstTmpAllocation</a></div><div class="ttdeci">Allocation * pDstTmpAllocation</div><div class="ttdoc">Temporary allocation pointing to destination memory that will replace pSrcAllocation.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:736</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o_html"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html">D3D12MA::DEFRAGMENTATION_PASS_MOVE_INFO</a></div><div class="ttdoc">Parameters for incremental defragmentation steps.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:744</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o_html_a719fbdaae54251759605c41baeb24dc4"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html#a719fbdaae54251759605c41baeb24dc4">D3D12MA::DEFRAGMENTATION_PASS_MOVE_INFO::pMoves</a></div><div class="ttdeci">DEFRAGMENTATION_MOVE * pMoves</div><div class="ttdoc">Array of moves to be performed by the user in the current defragmentation pass.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:768</div></div>
|
||||
<div class="ttc" id="astruct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o_html_a8df22d990c318d82fe9fcc5f04132c04"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html#a8df22d990c318d82fe9fcc5f04132c04">D3D12MA::DEFRAGMENTATION_PASS_MOVE_INFO::MoveCount</a></div><div class="ttdeci">UINT32 MoveCount</div><div class="ttdoc">Number of elements in the pMoves array.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:746</div></div>
|
||||
</div><!-- fragment --><p>Although functions like <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#aa37d6b9fe8ea0864f7a35b9d68e8345a" title="Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation functi...">D3D12MA::Allocator::CreateResource()</a> create an allocation and a buffer/texture at once, these are just a shortcut for allocating memory and creating a placed resource. Defragmentation works on memory allocations only. You must handle the rest manually. Defragmentation is an iterative process that should repreat "passes" as long as related functions return <code>S_FALSE</code> not <code>S_OK</code>. In each pass:</p>
|
||||
<ol type="1">
|
||||
<li><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#a1606c015d02edc094bb246986159d592" title="Starts single defragmentation pass.">D3D12MA::DefragmentationContext::BeginPass()</a> function call:<ul>
|
||||
<li>Calculates and returns the list of allocations to be moved in this pass. Note this can be a time-consuming process.</li>
|
||||
<li>Reserves destination memory for them by creating temporary destination allocations that you can query for their <code>ID3D12Heap</code> + offset using methods like <a class="el" href="class_d3_d12_m_a_1_1_allocation.html#adca8d5a82bed492fe7265fcda6e53da2" title="Returns memory heap that the resource is created in.">D3D12MA::Allocation::GetHeap()</a>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Inside the pass, <b>you should</b>:<ul>
|
||||
<li>Inspect the returned list of allocations to be moved.</li>
|
||||
<li>Create new buffers/textures as placed at the returned destination temporary allocations.</li>
|
||||
<li>Copy data from source to destination resources if necessary.</li>
|
||||
<li>Store the pointer to the new resource in the temporary destination allocation.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#aad502ba70d6dadaeee37703fd8bf90ae" title="Ends single defragmentation pass.">D3D12MA::DefragmentationContext::EndPass()</a> function call:<ul>
|
||||
<li>Frees the source memory reserved for the allocations that are moved.</li>
|
||||
<li>Modifies source <a class="el" href="class_d3_d12_m_a_1_1_allocation.html" title="Represents single memory allocation.">D3D12MA::Allocation</a> objects that are moved to point to the destination reserved memory and destination resource, while source resource is released.</li>
|
||||
<li>Frees <code>ID3D12Heap</code> blocks that became empty.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
<p>Defragmentation algorithm tries to move all suitable allocations. You can, however, refuse to move some of them inside a defragmentation pass, by setting <code>pass.pMoves[i].Operation</code> to <a class="el" href="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602abefe270a1803998dda3f8e01ec3a4ad6" title="Set this value if you cannot move the allocation. New place reserved at pDstTmpAllocation will be fre...">D3D12MA::DEFRAGMENTATION_MOVE_OPERATION_IGNORE</a>. This is not recommended and may result in suboptimal packing of the allocations after defragmentation. If you cannot ensure any allocation can be moved, it is better to keep movable allocations separate in a custom pool.</p>
|
||||
<p>Inside a pass, for each allocation that should be moved:</p>
|
||||
<ul>
|
||||
<li>You should copy its data from the source to the destination place by calling e.g. <code>CopyResource()</code>.<ul>
|
||||
<li>You need to make sure these commands finished executing before the source buffers/textures are released by <a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#aad502ba70d6dadaeee37703fd8bf90ae" title="Ends single defragmentation pass.">D3D12MA::DefragmentationContext::EndPass()</a>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>If a resource doesn't contain any meaningful data, e.g. it is a transient render-target texture to be cleared, filled, and used temporarily in each rendering frame, you can just recreate this texture without copying its data.</li>
|
||||
<li>If the resource is in <code>D3D12_HEAP_TYPE_READBACK</code> memory, you can copy its data on the CPU using <code>memcpy()</code>.</li>
|
||||
<li>If you cannot move the allocation, you can set <code>pass.pMoves[i].Operation</code> to <a class="el" href="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602abefe270a1803998dda3f8e01ec3a4ad6" title="Set this value if you cannot move the allocation. New place reserved at pDstTmpAllocation will be fre...">D3D12MA::DEFRAGMENTATION_MOVE_OPERATION_IGNORE</a>. This will cancel the move.<ul>
|
||||
<li><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#aad502ba70d6dadaeee37703fd8bf90ae" title="Ends single defragmentation pass.">D3D12MA::DefragmentationContext::EndPass()</a> will then free the destination memory not the source memory of the allocation, leaving it unchanged.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>If you decide the allocation is unimportant and can be destroyed instead of moved (e.g. it wasn't used for long time), you can set <code>pass.pMoves[i].Operation</code> to <a class="el" href="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602aa2143507d723de458c2ed94e143ac242" title="Set this value if you decide to abandon the allocation and you destroyed the resource....">D3D12MA::DEFRAGMENTATION_MOVE_OPERATION_DESTROY</a>.<ul>
|
||||
<li><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#aad502ba70d6dadaeee37703fd8bf90ae" title="Ends single defragmentation pass.">D3D12MA::DefragmentationContext::EndPass()</a> will then free both source and destination memory, and will destroy the source <a class="el" href="class_d3_d12_m_a_1_1_allocation.html" title="Represents single memory allocation.">D3D12MA::Allocation</a> object.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>You can defragment a specific custom pool by calling <a class="el" href="class_d3_d12_m_a_1_1_pool.html#adc87bb49c192de8f5a9ca0484c499575" title="Begins defragmentation process of the current pool.">D3D12MA::Pool::BeginDefragmentation</a> or all the default pools by calling <a class="el" href="class_d3_d12_m_a_1_1_allocator.html#a08e1468f1dbb63ce3bf6680e592b2143" title="Begins defragmentation process of the default pools.">D3D12MA::Allocator::BeginDefragmentation</a> (like in the example above).</p>
|
||||
<p>Defragmentation is always performed in each pool separately. Allocations are never moved between different heap types. The size of the destination memory reserved for a moved allocation is the same as the original one. Alignment of an allocation as it was determined using <code>GetResourceAllocationInfo()</code> is also respected after defragmentation. Buffers/textures should be recreated with the same <code>D3D12_RESOURCE_DESC</code> parameters as the original ones.</p>
|
||||
<p>You can perform the defragmentation incrementally to limit the number of allocations and bytes to be moved in each pass, e.g. to call it in sync with render frames and not to experience too big hitches. See members: <a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html#ad8d224e0687a35898970d0a5688c6343" title="Maximum numbers of bytes that can be copied during single pass, while moving allocations to different...">D3D12MA::DEFRAGMENTATION_DESC::MaxBytesPerPass</a>, <a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html#a83bfb404f387863eafdd6703483aed89" title="Maximum number of allocations that can be moved during single pass to a different place.">D3D12MA::DEFRAGMENTATION_DESC::MaxAllocationsPerPass</a>.</p>
|
||||
<p><b>Thread safety:</b> It is safe to perform the defragmentation asynchronously to render frames and other Direct3D 12 and D3D12MA usage, possibly from multiple threads, with the exception that allocations returned in <a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html#a719fbdaae54251759605c41baeb24dc4" title="Array of moves to be performed by the user in the current defragmentation pass.">D3D12MA::DEFRAGMENTATION_PASS_MOVE_INFO::pMoves</a> shouldn't be released until the defragmentation pass is ended. During the call to <a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#a1606c015d02edc094bb246986159d592" title="Starts single defragmentation pass.">D3D12MA::DefragmentationContext::BeginPass()</a>, any operations on the memory pool affected by the defragmentation are blocked by a mutex.</p>
|
||||
<p>What it means in practice is that you shouldn't free any allocations from the defragmented pool since the moment a call to <code>BeginPass</code> begins. Otherwise, a thread performing the <code>allocation->Release()</code> would block for the time <code>BeginPass</code> executes and then free the allocation when it finishes, while the allocation could have ended up on the list of allocations to move. A solution to freeing allocations during defragmentation is to find such allocation on the list <code>pass.pMoves[i]</code> and set its operation to <a class="el" href="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602aa2143507d723de458c2ed94e143ac242" title="Set this value if you decide to abandon the allocation and you destroyed the resource....">D3D12MA::DEFRAGMENTATION_MOVE_OPERATION_DESTROY</a> instead of calling <code>allocation->Release()</code>, or simply deferring the release to the time after defragmentation finished.</p>
|
||||
<p><b>Mapping</b> is out of scope of this library and so it is not preserved after an allocation is moved during defragmentation. You need to map the new resource yourself if needed.</p>
|
||||
<dl class="section note"><dt>Note</dt><dd>Defragmentation is not supported in custom pools created with <a class="el" href="namespace_d3_d12_m_a.html#a919d8545365d6b7209a964f2b99936d1aa37a0103f511954ea42a1d0bba286b6a" title="Enables alternative, linear allocation algorithm in this pool.">D3D12MA::POOL_FLAG_ALGORITHM_LINEAR</a>. </dd></dl>
|
||||
</div></div><!-- contents -->
|
||||
</div><!-- PageDoc -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Direct3D 12 Memory Allocator: D:/PROJECTS/D3D12 Memory Allocator/REPO/include Directory Reference</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Direct3D 12 Memory Allocator
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="headertitle"><div class="title">include Directory Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="files" name="files"></a>
|
||||
Files</h2></td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top"><span class="icondoc"></span> </td><td class="memItemRight" valign="bottom"><a class="el" href="_d3_d12_mem_alloc_8h.html">D3D12MemAlloc.h</a></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||