Compare commits

..

37 Commits

Author SHA1 Message Date
Zangetsu38 ac30c27c3f Debug 2017-03-23 02:28:34 +01:00
Zangetsu38 105c3ad9af d3d12: Update minidx12 SDK on build 14.393. 2017-03-23 02:28:34 +01:00
Zangetsu38 25fb362c8b Update Submodule GSL 2017-03-23 02:28:34 +01:00
Zangetsu38 54b3673488 Some Change in Gui. 2017-03-23 02:28:34 +01:00
Zangetsu38 3e8b3b5f7c Registers more functions missing.
Implement stub for cell_FreeType.
2017-03-23 02:28:34 +01:00
Zangetsu38 3319192abc Update Project to Visual Studio 2017. 2017-03-23 02:28:34 +01:00
kd-11 423f41d7d3 rsx: Skip unknown/invalid commands in cb 2017-03-23 02:28:34 +01:00
kd-11 c27283c0d8 rsx/fp: src3 workaround 2017-03-23 02:28:34 +01:00
kd-11 58816f0f3a gl/vk: Fix projected coordinate lookup on a cubemap sampler 2017-03-23 02:28:34 +01:00
kd-11 b79742b222 fix false alphakill flags when texture fetch is optimized away 2017-03-23 02:28:34 +01:00
Jake b8c8161d58 Xinput/MMjoy: Fix connection status 2017-03-23 02:28:34 +01:00
Jake 2621d6a3e0 Crypto: fix sprx/self check in npDrm and edata fixes 2017-03-23 02:28:34 +01:00
clienthax 742cee9108 Fixs for klics 2017-03-23 02:28:34 +01:00
kd-11 9f07674dfa accelerate all copies to local RSX memory; Clipping fixes 2017-03-23 01:21:17 +03:00
kd-11 a08a768f50 gl/rsx/blit: Resolve clipping validation a different way. Hopefully no regressions this time 2017-03-23 01:21:17 +03:00
kd-11 cfcb5684a0 Revert "gl: Fix clip offsets in nv3089::image_in (accelerated path only)"
This reverts commit a784ef5ee4a04870cb461b00284a954b1ed0a833.
2017-03-23 01:21:17 +03:00
kd-11 0f121bdf37 gl: Fix clip offsets in nv3089::image_in (accelerated path only) 2017-03-23 01:21:17 +03:00
kd-11 3231f0aad0 Use sampler objects for all sampler state parameters 2017-03-23 01:21:17 +03:00
kd-11 fe0600866c Improve scaling and separate sampler state from texture state 2017-03-23 01:21:17 +03:00
kd-11 604e42bde8 Revert "gl: Fix vertical blit scaling factor"
This reverts commit d64334b02dcc5ae3fea70e25b0e7bdb5e656448b.
2017-03-23 01:21:17 +03:00
kd-11 7a02d6e4ed gl: Fix vertical blit scaling factor 2017-03-23 01:21:17 +03:00
kd-11 bcc79b38b8 gl:Use proper upscaling filter for final present 2017-03-23 01:21:17 +03:00
kd-11 26d36e28fa do not force swizzled surfaces to use slow cpu path 2017-03-23 01:21:17 +03:00
kd-11 ccdd55a607 Properly perform clipping stage using an inverse transform 2017-03-23 01:21:17 +03:00
kd-11 06da2071b4 use the cpu to do memcpy trivial clipping operations 2017-03-23 01:21:17 +03:00
kd-11 7f804cd8c8 debug: Re-enable c++ optimizations 2017-03-23 01:21:17 +03:00
kd-11 ffd9ab12c6 rsx/gl/scaling: Fixes 2017-03-23 01:21:17 +03:00
kd-11 5928b78c45 rsx/gl: Accelerate blit using texture cache for storage 2017-03-23 01:21:17 +03:00
kd-11 85f80cfbd1 gl/debug: More fixes 2017-03-23 01:21:17 +03:00
kd-11 e7271179f7 Fixes 2017-03-23 01:21:17 +03:00
kd-11 b6fd878834 gl/debug: Fix protection for debug 2017-03-23 01:21:17 +03:00
kd-11 508cf11b88 gl: Get scaling basics working 2017-03-23 01:21:17 +03:00
kd-11 25bdc076cd gl: Add surface offset calculations (broken atm/ WIP) 2017-03-23 01:21:17 +03:00
kd-11 30d45356a3 gl: Debugging argb8 hw scale (broken atm/ WIP) 2017-03-23 01:21:17 +03:00
kd-11 585a66ba21 gl: Beginnings of hw blit 2017-03-23 01:21:17 +03:00
kd-11 a2f6c27221 gl: Prep for hw blit 2017-03-23 01:21:17 +03:00
kd-11 a892a990f7 rsx: Set up hw accelerated blit 2017-03-23 01:21:17 +03:00
839 changed files with 45284 additions and 101076 deletions
-24
View File
@@ -1,24 +0,0 @@
<!---
THIS IS NOT A SUPPORT FORUM, FOR SUPPORT GO TO:
https://forums.rpcs3.net
or our discord:
https://discord.me/RPCS3
PLEASE READ THE GUIDELINES BEFORE OPENING AN ISSUE:
https://github.com/RPCS3/rpcs3/blob/master/CONTRIBUTING.md
====================================================
When submitting an issue, please check the following:
- You have read the above.
- You have provided the version (commit hash) of RPCS3 you are using.
- You have provided sufficient detail for the issue to be reproduced.
- You have provided system specs.
- Please also provide:
- For crashes, a backtrace.
- For graphical issues, comparison screenshots with real hardware.
Remember that the GitHub Issue Tracker is not the place to ask for support or to submit Game Compatibility reports. You must use our forums for that.
--->
+2 -13
View File
@@ -41,10 +41,7 @@
/Vulkan/Vulkan-build
/Vulkan/glslang-build
# Themes
!/bin/GuiConfigs/
/bin/GuiConfigs/*.ini
/wxWidgets/lib
/bin/rpcs3.ini
/bin/rpcs3.ipdb
/bin/rpcs3.iobj
@@ -58,11 +55,10 @@
rpcs3/git-version.h
# Visual Studio Files
.vs/*
*.ipch
*.vspx
*.psess
*.VC.*
*.vcxproj.user
# Copyrighted files
/bin/data/
@@ -74,7 +70,6 @@ rpcs3/git-version.h
!/bin/dev_hdd0/game/
/bin/dev_hdd0/game/*
!/bin/dev_hdd0/game/TEST12345/
/bin/dev_hdd0/disc/*
# Ignore other system generated files
bin/dev_hdd0/*.txt
@@ -91,9 +86,3 @@ CMakeCache.txt
# cotire
rpcs3/cotire/*
rpcs3/rpcs3_*_cotire.cmake
# Qt
moc_*.cpp
qrc_resources.cpp
rpcs3_automoc.cpp
ui_*.h
+15 -16
View File
@@ -1,3 +1,7 @@
[submodule "wxWidgets"]
path = wxWidgets
url = https://github.com/wxWidgets/wxWidgets
ignore = dirty
[submodule "rpcs3-ffmpeg"]
path = 3rdparty/ffmpeg
url = https://github.com/hrydgard/ppsspp-ffmpeg
@@ -7,8 +11,11 @@
ignore = dirty
[submodule "llvm"]
path = llvm
url = https://github.com/RPCS3/llvm
branch = release_60
url = https://github.com/llvm-mirror/llvm
branch = release_40
[submodule "rsx_program_decompiler"]
path = rsx_program_decompiler
url = https://github.com/Zangetsu38/rsx_program_decompiler
[submodule "GSL"]
path = 3rdparty/GSL
url = https://github.com/Microsoft/GSL.git
@@ -25,20 +32,12 @@
[submodule "Utilities/yaml-cpp"]
path = Utilities/yaml-cpp
url = https://github.com/RPCS3/yaml-cpp
[submodule "3rdparty/pugixml"]
path = 3rdparty/pugixml
url = https://github.com/RPCS3/pugixml
[submodule "3rdparty/cereal"]
path = 3rdparty/cereal
url = https://github.com/USCiLab/cereal.git
[submodule "3rdparty/zlib"]
path = 3rdparty/zlib
url = https://github.com/madler/zlib
[submodule "3rdparty/hidapi"]
path = 3rdparty/hidapi
url = https://github.com/RPCS3/hidapi
branch = master
ignore = dirty
[submodule "3rdparty/Optional"]
path = 3rdparty/Optional
url = https://github.com/akrzemi1/Optional.git
[submodule "3rdparty/pugixml"]
path = 3rdparty/pugixml
url = https://github.com/zeux/pugixml
[submodule "rsx-debugger"]
path = rsx-debugger
url = https://github.com/RPCS3/rsx-debugger.git
+31 -64
View File
@@ -1,11 +1,12 @@
language: cpp
sudo: required
sudo: false
dist: trusty
os:
- linux
#- osx
# osx_image: xcode6.4
osx_image: xcode6.4
compiler:
- clang
@@ -16,109 +17,75 @@ cache:
directories:
- $HOME/hombebrew_cache
env:
global:
- secure: "Vf+FY48nip9JppMnq11105NealdErSWsoUhHo63/V3V+LKfA9guenxCp93/qoSIdSGC/sJwb0yIIMGvkTT/rxDJNh6Z+BWUTb2E0WEIIQbvTJNOSUzoq7dfF1LT61XjVjByFzcbC2xjtaBowmcAYEs1jGUUuEjYVCMmD5lY8hUg="
# Which Travis environment to run Coverity on
- coverity_scan_run_condition='"$TRAVIS_OS_NAME" = linux -a "$CC" = gcc'
# Test mode is for testing if it's working with Coverity. Change to true if testing, to avoid reaching the quota.
- coverity_scan_script_test_mode=false
matrix:
exclude:
- os: osx
compiler: gcc
git:
depth: false # Unshallow clone to obtain proper GIT_VERSION
submodules: false
before_install:
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$CXX" = "g++" ]; then
export CXX="g++-5" CC="gcc-5" CXXFLAGS="-Wno-format-security";
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01';
fi;
# Add coverall for C++ so coverall.io could be triggered. Even it should be --coverage and gcov.
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
wget http://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run ;
chmod a+x ./qt-unified-linux-x64-online.run ;
export QT_QPA_PLATFORM=minimal ;
travis_wait 60 ./qt-unified-linux-x64-online.run --script qt-installer-noninteractive.qs --no-force-installations --verbose ;
fi;
# Install updated libglew-dev since the version provided by trusty is outdated
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
wget https://mirrors.kernel.org/ubuntu/pool/universe/g/glew/libglew-dev_2.0.0-5_amd64.deb;
wget https://mirrors.kernel.org/ubuntu/pool/universe/g/glew/libglew2.0_2.0.0-5_amd64.deb;
wget https://mirrors.kernel.org/ubuntu/pool/universe/v/vulkan/libvulkan1_1.0.61.1+dfsg1-1ubuntu1~16.04.1_amd64.deb;
wget https://mirrors.kernel.org/ubuntu/pool/universe/v/vulkan/libvulkan-dev_1.0.61.1+dfsg1-1ubuntu1~16.04.1_amd64.deb;
sudo dpkg -i libglew2.0_2.0.0-5_amd64.deb libglew-dev_2.0.0-5_amd64.deb libvulkan1_1.0.61.1+dfsg1-1ubuntu1~16.04.1_amd64.deb libvulkan-dev_1.0.61.1+dfsg1-1ubuntu1~16.04.1_amd64.deb;
pip install --user cpp-coveralls requests[security];
else
brew update;
brew install ccache glew llvm40;
brew update; brew update;
brew install ccache glew wxwidgets llvm40;
fi;
before_script:
- git submodule update --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng Utilities/yaml-cpp 3rdparty/cereal 3rdparty/hidapi 3rdparty/Optional Vulkan/glslang Vulkan/Vulkan-LoaderAndValidationLayers
- git submodule update --init rsx_program_decompiler asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng Utilities/yaml-cpp 3rdparty/cereal
- mkdir build
- cd build
- export CMAKE_PREFIX_PATH=~/Qt/5.10.0/gcc_64/lib/cmake
- export CXXFLAGS="$CXXFLAGS -DTRAVIS=true";
- if [ "$TRAVIS_PULL_REQUEST" = false ]; then
export CXXFLAGS="$CXXFLAGS -DBRANCH=$TRAVIS_REPO_SLUG/$TRAVIS_BRANCH";
else
export CXXFLAGS="$CXXFLAGS -DBRANCH=$TRAVIS_REPO_SLUG/$TRAVIS_BRANCH/#$TRAVIS_PULL_REQUEST";
fi;
- cmake .. -DCMAKE_INSTALL_PREFIX=/usr -G Ninja;
- ninja
- # AppImage generation
- if [ -n "$UPLOAD_URL" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$CC" = "clang" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then
export LD_LIBRARY_PATH=~/Qt/5.10.0/gcc_64/lib;
DESTDIR=appdir ninja install ; find appdir/ ;
find ../bin ;
wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" ;
chmod a+x linuxdeployqt*.AppImage ;
export PATH=~/Qt/5.10.0/gcc_64/bin/:${PATH} ;
./linuxdeployqt*.AppImage --appimage-extract ;
./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs ;
mkdir ./appdir/usr/plugins/xcbglintegrations/ ;
mkdir ./appdir/usr/plugins/imageformats/ ;
cp ~/Qt/5.10.0/gcc_64/lib/libQt5Svg.so.5 ./appdir/usr/lib/ ;
cp ~/Qt/5.10.0/gcc_64/plugins/xcbglintegrations/* ./appdir/usr/plugins/xcbglintegrations/ ;
cp ~/Qt/5.10.0/gcc_64/plugins/imageformats/* ./appdir/usr/plugins/imageformats/ ;
cp ~/Qt/5.10.0/gcc_64/plugins/platforms/* ./appdir/usr/plugins/platforms/ ;
rm ./appdir/usr/lib/libfreetype.so.6 ;
export PATH=${TRAVIS_BUILD_DIR}/build/squashfs-root/usr/bin/:${PATH} ;
./squashfs-root/usr/bin/appimagetool ${TRAVIS_BUILD_DIR}/build/appdir ;
find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq ;
curl ${UPLOAD_URL}${TRAVIS_COMMIT:0:7}-${TRAVIS_BUILD_NUMBER}_linux64 --upload-file ./RPCS3*.AppImage;
fi;
- cmake ..
script:
# Add a command to show all the variables. May be useful for debugging Travis.
#- echo "--Shell Export Lists START--" ; export -p; echo "--Shell Export Lists STOP--";
# And to ensure the versions of toolchain
- echo "--CXX version?"; "$CXX" --version; echo "--CXX version confirmed";
- if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then make -j 3; fi
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- sourceline: 'ppa:jonathonf/binutils' # We need to update binutils to a newer version to link against the ffmpeg libs on.
packages:
- binutils
- cmake
- ninja-build
- libasound2-dev
- libopenal-dev
- freeglut3-dev
#- libglew-dev
#- libvulkan1
#- libvulkan-dev
- libglew-dev
- libc6-dev
- llvm-4.0
- llvm-4.0-dev
# Clang 5.0 is now bundled in travis, so we no longer need the ppa version.
#- clang-4.0
- libedit-dev
- g++-5
- gcc-5
- libstdc++-5-dev
- lib32stdc++6
- zlib1g-dev
# We need to install qt 5.10.0 manually because the version trusty provides is too old.
#- qtbase5-dev
- libudev-dev
- libevdev-dev
- libpulse-dev
- libwxgtk3.0-dev
coverity_scan:
project:
name: $TRAVIS_REPO_SLUG
description: "PS3 emulator/debugger"
notification_email: nekotekina@gmail.com
build_command: "make -j 3"
branch_pattern: coverity_scan
after_success:
- if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "$TRAVIS_OS_NAME" = linux ]; then coveralls --extension .c --extension .cpp --extension .h; fi
+406 -12
View File
@@ -6,7 +6,7 @@ extern "C" {
#endif
/*
** Copyright (c) 2013-2014 The Khronos Group Inc.
** Copyright (c) 2013-2017 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
@@ -31,9 +31,7 @@ extern "C" {
** This header is generated from the Khronos OpenGL / OpenGL ES XML
** API Registry. The current version of the Registry, generator scripts
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision: 31191 $ on $Date: 2015-05-14 06:31:39 -0400 (Thu, 14 May 2015) $
** https://github.com/KhronosGroup/OpenGL-Registry
*/
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
@@ -53,7 +51,7 @@ extern "C" {
#define GLAPI extern
#endif
#define GL_GLEXT_VERSION 20150514
#define GL_GLEXT_VERSION 20170305
/* Generated C header for:
* API: gl
@@ -2654,7 +2652,7 @@ typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC) (GLuint fram
typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value);
typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value);
typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value);
typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, const GLfloat depth, GLint stencil);
typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
typedef void (APIENTRYP PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint framebuffer, GLenum target);
typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC) (GLuint framebuffer, GLenum pname, GLint *param);
@@ -2777,7 +2775,7 @@ GLAPI void APIENTRY glInvalidateNamedFramebufferSubData (GLuint framebuffer, GLs
GLAPI void APIENTRY glClearNamedFramebufferiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value);
GLAPI void APIENTRY glClearNamedFramebufferuiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value);
GLAPI void APIENTRY glClearNamedFramebufferfv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value);
GLAPI void APIENTRY glClearNamedFramebufferfi (GLuint framebuffer, GLenum buffer, const GLfloat depth, GLint stencil);
GLAPI void APIENTRY glClearNamedFramebufferfi (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
GLAPI void APIENTRY glBlitNamedFramebuffer (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
GLAPI GLenum APIENTRY glCheckNamedFramebufferStatus (GLuint framebuffer, GLenum target);
GLAPI void APIENTRY glGetNamedFramebufferParameteriv (GLuint framebuffer, GLenum pname, GLint *param);
@@ -2875,6 +2873,17 @@ GLAPI void APIENTRY glTextureBarrier (void);
#define GL_ARB_ES3_1_compatibility 1
#endif /* GL_ARB_ES3_1_compatibility */
#ifndef GL_ARB_ES3_2_compatibility
#define GL_ARB_ES3_2_compatibility 1
#define GL_PRIMITIVE_BOUNDING_BOX_ARB 0x92BE
#define GL_MULTISAMPLE_LINE_WIDTH_RANGE_ARB 0x9381
#define GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB 0x9382
typedef void (APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXARBPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glPrimitiveBoundingBoxARB (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
#endif
#endif /* GL_ARB_ES3_2_compatibility */
#ifndef GL_ARB_ES3_compatibility
#define GL_ARB_ES3_compatibility 1
#endif /* GL_ARB_ES3_compatibility */
@@ -3288,6 +3297,10 @@ GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program);
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
#endif /* GL_ARB_fragment_shader */
#ifndef GL_ARB_fragment_shader_interlock
#define GL_ARB_fragment_shader_interlock 1
#endif /* GL_ARB_fragment_shader_interlock */
#ifndef GL_ARB_framebuffer_no_attachments
#define GL_ARB_framebuffer_no_attachments 1
#endif /* GL_ARB_framebuffer_no_attachments */
@@ -3340,6 +3353,16 @@ GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachmen
#define GL_ARB_get_texture_sub_image 1
#endif /* GL_ARB_get_texture_sub_image */
#ifndef GL_ARB_gl_spirv
#define GL_ARB_gl_spirv 1
#define GL_SHADER_BINARY_FORMAT_SPIR_V_ARB 0x9551
#define GL_SPIR_V_BINARY_ARB 0x9552
typedef void (APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glSpecializeShaderARB (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);
#endif
#endif /* GL_ARB_gl_spirv */
#ifndef GL_ARB_gpu_shader5
#define GL_ARB_gpu_shader5 1
#endif /* GL_ARB_gpu_shader5 */
@@ -3348,6 +3371,91 @@ GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachmen
#define GL_ARB_gpu_shader_fp64 1
#endif /* GL_ARB_gpu_shader_fp64 */
#ifndef GL_ARB_gpu_shader_int64
#define GL_ARB_gpu_shader_int64 1
#define GL_INT64_ARB 0x140E
#define GL_INT64_VEC2_ARB 0x8FE9
#define GL_INT64_VEC3_ARB 0x8FEA
#define GL_INT64_VEC4_ARB 0x8FEB
#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FF5
#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6
#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7
typedef void (APIENTRYP PFNGLUNIFORM1I64ARBPROC) (GLint location, GLint64 x);
typedef void (APIENTRYP PFNGLUNIFORM2I64ARBPROC) (GLint location, GLint64 x, GLint64 y);
typedef void (APIENTRYP PFNGLUNIFORM3I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z);
typedef void (APIENTRYP PFNGLUNIFORM4I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);
typedef void (APIENTRYP PFNGLUNIFORM1I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value);
typedef void (APIENTRYP PFNGLUNIFORM2I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value);
typedef void (APIENTRYP PFNGLUNIFORM3I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value);
typedef void (APIENTRYP PFNGLUNIFORM4I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value);
typedef void (APIENTRYP PFNGLUNIFORM1UI64ARBPROC) (GLint location, GLuint64 x);
typedef void (APIENTRYP PFNGLUNIFORM2UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y);
typedef void (APIENTRYP PFNGLUNIFORM3UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z);
typedef void (APIENTRYP PFNGLUNIFORM4UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);
typedef void (APIENTRYP PFNGLUNIFORM1UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
typedef void (APIENTRYP PFNGLUNIFORM2UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
typedef void (APIENTRYP PFNGLUNIFORM3UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
typedef void (APIENTRYP PFNGLUNIFORM4UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
typedef void (APIENTRYP PFNGLGETUNIFORMI64VARBPROC) (GLuint program, GLint location, GLint64 *params);
typedef void (APIENTRYP PFNGLGETUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLuint64 *params);
typedef void (APIENTRYP PFNGLGETNUNIFORMI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint64 *params);
typedef void (APIENTRYP PFNGLGETNUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64ARBPROC) (GLuint program, GLint location, GLint64 x);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64ARBPROC) (GLuint program, GLint location, GLuint64 x);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glUniform1i64ARB (GLint location, GLint64 x);
GLAPI void APIENTRY glUniform2i64ARB (GLint location, GLint64 x, GLint64 y);
GLAPI void APIENTRY glUniform3i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z);
GLAPI void APIENTRY glUniform4i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);
GLAPI void APIENTRY glUniform1i64vARB (GLint location, GLsizei count, const GLint64 *value);
GLAPI void APIENTRY glUniform2i64vARB (GLint location, GLsizei count, const GLint64 *value);
GLAPI void APIENTRY glUniform3i64vARB (GLint location, GLsizei count, const GLint64 *value);
GLAPI void APIENTRY glUniform4i64vARB (GLint location, GLsizei count, const GLint64 *value);
GLAPI void APIENTRY glUniform1ui64ARB (GLint location, GLuint64 x);
GLAPI void APIENTRY glUniform2ui64ARB (GLint location, GLuint64 x, GLuint64 y);
GLAPI void APIENTRY glUniform3ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z);
GLAPI void APIENTRY glUniform4ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);
GLAPI void APIENTRY glUniform1ui64vARB (GLint location, GLsizei count, const GLuint64 *value);
GLAPI void APIENTRY glUniform2ui64vARB (GLint location, GLsizei count, const GLuint64 *value);
GLAPI void APIENTRY glUniform3ui64vARB (GLint location, GLsizei count, const GLuint64 *value);
GLAPI void APIENTRY glUniform4ui64vARB (GLint location, GLsizei count, const GLuint64 *value);
GLAPI void APIENTRY glGetUniformi64vARB (GLuint program, GLint location, GLint64 *params);
GLAPI void APIENTRY glGetUniformui64vARB (GLuint program, GLint location, GLuint64 *params);
GLAPI void APIENTRY glGetnUniformi64vARB (GLuint program, GLint location, GLsizei bufSize, GLint64 *params);
GLAPI void APIENTRY glGetnUniformui64vARB (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params);
GLAPI void APIENTRY glProgramUniform1i64ARB (GLuint program, GLint location, GLint64 x);
GLAPI void APIENTRY glProgramUniform2i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y);
GLAPI void APIENTRY glProgramUniform3i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z);
GLAPI void APIENTRY glProgramUniform4i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);
GLAPI void APIENTRY glProgramUniform1i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value);
GLAPI void APIENTRY glProgramUniform2i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value);
GLAPI void APIENTRY glProgramUniform3i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value);
GLAPI void APIENTRY glProgramUniform4i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value);
GLAPI void APIENTRY glProgramUniform1ui64ARB (GLuint program, GLint location, GLuint64 x);
GLAPI void APIENTRY glProgramUniform2ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y);
GLAPI void APIENTRY glProgramUniform3ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z);
GLAPI void APIENTRY glProgramUniform4ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);
GLAPI void APIENTRY glProgramUniform1ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
GLAPI void APIENTRY glProgramUniform2ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
GLAPI void APIENTRY glProgramUniform3ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
GLAPI void APIENTRY glProgramUniform4ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
#endif
#endif /* GL_ARB_gpu_shader_int64 */
#ifndef GL_ARB_half_float_pixel
#define GL_ARB_half_float_pixel 1
typedef unsigned short GLhalfARB;
@@ -3727,6 +3835,16 @@ GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *par
#define GL_ARB_occlusion_query2 1
#endif /* GL_ARB_occlusion_query2 */
#ifndef GL_ARB_parallel_shader_compile
#define GL_ARB_parallel_shader_compile 1
#define GL_MAX_SHADER_COMPILER_THREADS_ARB 0x91B0
#define GL_COMPLETION_STATUS_ARB 0x91B1
typedef void (APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSARBPROC) (GLuint count);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glMaxShaderCompilerThreadsARB (GLuint count);
#endif
#endif /* GL_ARB_parallel_shader_compile */
#ifndef GL_ARB_pipeline_statistics_query
#define GL_ARB_pipeline_statistics_query 1
#define GL_VERTICES_SUBMITTED_ARB 0x82EE
@@ -3769,6 +3887,10 @@ GLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params);
#define GL_COORD_REPLACE_ARB 0x8862
#endif /* GL_ARB_point_sprite */
#ifndef GL_ARB_post_depth_coverage
#define GL_ARB_post_depth_coverage 1
#endif /* GL_ARB_post_depth_coverage */
#ifndef GL_ARB_program_interface_query
#define GL_ARB_program_interface_query 1
#endif /* GL_ARB_program_interface_query */
@@ -3842,6 +3964,26 @@ GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum form
#define GL_ARB_robustness_isolation 1
#endif /* GL_ARB_robustness_isolation */
#ifndef GL_ARB_sample_locations
#define GL_ARB_sample_locations 1
#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_ARB 0x933D
#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_ARB 0x933E
#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_ARB 0x933F
#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_ARB 0x9340
#define GL_SAMPLE_LOCATION_ARB 0x8E50
#define GL_PROGRAMMABLE_SAMPLE_LOCATION_ARB 0x9341
#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_ARB 0x9342
#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_ARB 0x9343
typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
typedef void (APIENTRYP PFNGLEVALUATEDEPTHVALUESARBPROC) (void);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glFramebufferSampleLocationsfvARB (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvARB (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
GLAPI void APIENTRY glEvaluateDepthValuesARB (void);
#endif
#endif /* GL_ARB_sample_locations */
#ifndef GL_ARB_sample_shading
#define GL_ARB_sample_shading 1
#define GL_SAMPLE_SHADING_ARB 0x8C36
@@ -3868,14 +4010,26 @@ GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value);
#define GL_ARB_separate_shader_objects 1
#endif /* GL_ARB_separate_shader_objects */
#ifndef GL_ARB_shader_atomic_counter_ops
#define GL_ARB_shader_atomic_counter_ops 1
#endif /* GL_ARB_shader_atomic_counter_ops */
#ifndef GL_ARB_shader_atomic_counters
#define GL_ARB_shader_atomic_counters 1
#endif /* GL_ARB_shader_atomic_counters */
#ifndef GL_ARB_shader_ballot
#define GL_ARB_shader_ballot 1
#endif /* GL_ARB_shader_ballot */
#ifndef GL_ARB_shader_bit_encoding
#define GL_ARB_shader_bit_encoding 1
#endif /* GL_ARB_shader_bit_encoding */
#ifndef GL_ARB_shader_clock
#define GL_ARB_shader_clock 1
#endif /* GL_ARB_shader_clock */
#ifndef GL_ARB_shader_draw_parameters
#define GL_ARB_shader_draw_parameters 1
#endif /* GL_ARB_shader_draw_parameters */
@@ -4040,6 +4194,10 @@ GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GL
#define GL_ARB_shader_texture_lod 1
#endif /* GL_ARB_shader_texture_lod */
#ifndef GL_ARB_shader_viewport_layer_array
#define GL_ARB_shader_viewport_layer_array 1
#endif /* GL_ARB_shader_viewport_layer_array */
#ifndef GL_ARB_shading_language_100
#define GL_ARB_shading_language_100 1
#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
@@ -4119,6 +4277,14 @@ GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xo
#endif
#endif /* GL_ARB_sparse_texture */
#ifndef GL_ARB_sparse_texture2
#define GL_ARB_sparse_texture2 1
#endif /* GL_ARB_sparse_texture2 */
#ifndef GL_ARB_sparse_texture_clamp
#define GL_ARB_sparse_texture_clamp 1
#endif /* GL_ARB_sparse_texture_clamp */
#ifndef GL_ARB_stencil_texturing
#define GL_ARB_stencil_texturing 1
#endif /* GL_ARB_stencil_texturing */
@@ -4271,6 +4437,12 @@ GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void
#define GL_DOT3_RGBA_ARB 0x86AF
#endif /* GL_ARB_texture_env_dot3 */
#ifndef GL_ARB_texture_filter_minmax
#define GL_ARB_texture_filter_minmax 1
#define GL_TEXTURE_REDUCTION_MODE_ARB 0x9366
#define GL_WEIGHTED_AVERAGE_ARB 0x9367
#endif /* GL_ARB_texture_filter_minmax */
#ifndef GL_ARB_texture_float
#define GL_ARB_texture_float 1
#define GL_TEXTURE_RED_TYPE_ARB 0x8C10
@@ -4815,6 +4987,10 @@ GLAPI void APIENTRY glBlendBarrierKHR (void);
#define GL_KHR_texture_compression_astc_ldr 1
#endif /* GL_KHR_texture_compression_astc_ldr */
#ifndef GL_KHR_texture_compression_astc_sliced_3d
#define GL_KHR_texture_compression_astc_sliced_3d 1
#endif /* GL_KHR_texture_compression_astc_sliced_3d */
#ifndef GL_OES_byte_coordinates
#define GL_OES_byte_coordinates 1
typedef void (APIENTRYP PFNGLMULTITEXCOORD1BOESPROC) (GLenum texture, GLbyte s);
@@ -5206,10 +5382,45 @@ GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRG
#endif
#endif /* GL_AMD_draw_buffers_blend */
#ifndef GL_AMD_framebuffer_sample_positions
#define GL_AMD_framebuffer_sample_positions 1
#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F
#define GL_PIXELS_PER_SAMPLE_PATTERN_X_AMD 0x91AE
#define GL_PIXELS_PER_SAMPLE_PATTERN_Y_AMD 0x91AF
#define GL_ALL_PIXELS_AMD 0xFFFFFFFF
typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLEPOSITIONSFVAMDPROC) (GLenum target, GLuint numsamples, GLuint pixelindex, const GLfloat *values);
typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLEPOSITIONSFVAMDPROC) (GLuint framebuffer, GLuint numsamples, GLuint pixelindex, const GLfloat *values);
typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERFVAMDPROC) (GLenum target, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values);
typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERFVAMDPROC) (GLuint framebuffer, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glFramebufferSamplePositionsfvAMD (GLenum target, GLuint numsamples, GLuint pixelindex, const GLfloat *values);
GLAPI void APIENTRY glNamedFramebufferSamplePositionsfvAMD (GLuint framebuffer, GLuint numsamples, GLuint pixelindex, const GLfloat *values);
GLAPI void APIENTRY glGetFramebufferParameterfvAMD (GLenum target, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values);
GLAPI void APIENTRY glGetNamedFramebufferParameterfvAMD (GLuint framebuffer, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values);
#endif
#endif /* GL_AMD_framebuffer_sample_positions */
#ifndef GL_AMD_gcn_shader
#define GL_AMD_gcn_shader 1
#endif /* GL_AMD_gcn_shader */
#ifndef GL_AMD_gpu_shader_half_float
#define GL_AMD_gpu_shader_half_float 1
#define GL_FLOAT16_NV 0x8FF8
#define GL_FLOAT16_VEC2_NV 0x8FF9
#define GL_FLOAT16_VEC3_NV 0x8FFA
#define GL_FLOAT16_VEC4_NV 0x8FFB
#define GL_FLOAT16_MAT2_AMD 0x91C5
#define GL_FLOAT16_MAT3_AMD 0x91C6
#define GL_FLOAT16_MAT4_AMD 0x91C7
#define GL_FLOAT16_MAT2x3_AMD 0x91C8
#define GL_FLOAT16_MAT2x4_AMD 0x91C9
#define GL_FLOAT16_MAT3x2_AMD 0x91CA
#define GL_FLOAT16_MAT3x4_AMD 0x91CB
#define GL_FLOAT16_MAT4x2_AMD 0x91CC
#define GL_FLOAT16_MAT4x3_AMD 0x91CD
#endif /* GL_AMD_gpu_shader_half_float */
#ifndef GL_AMD_gpu_shader_int64
#define GL_AMD_gpu_shader_int64 1
typedef int64_t GLint64EXT;
@@ -5237,10 +5448,6 @@ typedef int64_t GLint64EXT;
#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5
#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6
#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7
#define GL_FLOAT16_NV 0x8FF8
#define GL_FLOAT16_VEC2_NV 0x8FF9
#define GL_FLOAT16_VEC3_NV 0x8FFA
#define GL_FLOAT16_VEC4_NV 0x8FFB
typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);
typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);
typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
@@ -5413,7 +5620,6 @@ GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname
#ifndef GL_AMD_sample_positions
#define GL_AMD_sample_positions 1
#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F
typedef void (APIENTRYP PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat *val);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLfloat *val);
@@ -5428,6 +5634,14 @@ GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLf
#define GL_AMD_shader_atomic_counter_ops 1
#endif /* GL_AMD_shader_atomic_counter_ops */
#ifndef GL_AMD_shader_ballot
#define GL_AMD_shader_ballot 1
#endif /* GL_AMD_shader_ballot */
#ifndef GL_AMD_shader_explicit_vertex_parameter
#define GL_AMD_shader_explicit_vertex_parameter 1
#endif /* GL_AMD_shader_explicit_vertex_parameter */
#ifndef GL_AMD_shader_stencil_export
#define GL_AMD_shader_stencil_export 1
#endif /* GL_AMD_shader_stencil_export */
@@ -8468,6 +8682,20 @@ GLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei s
#endif
#endif /* GL_EXT_vertex_weighting */
#ifndef GL_EXT_window_rectangles
#define GL_EXT_window_rectangles 1
#define GL_INCLUSIVE_EXT 0x8F10
#define GL_EXCLUSIVE_EXT 0x8F11
#define GL_WINDOW_RECTANGLE_EXT 0x8F12
#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13
#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14
#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15
typedef void (APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box);
#endif
#endif /* GL_EXT_window_rectangles */
#ifndef GL_EXT_x11_sync_object
#define GL_EXT_x11_sync_object 1
#define GL_SYNC_X11_FENCE_EXT 0x90E1
@@ -8645,10 +8873,23 @@ GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRG
#define GL_INTERLACE_READ_INGR 0x8568
#endif /* GL_INGR_interlace_read */
#ifndef GL_INTEL_conservative_rasterization
#define GL_INTEL_conservative_rasterization 1
#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE
#endif /* GL_INTEL_conservative_rasterization */
#ifndef GL_INTEL_fragment_shader_ordering
#define GL_INTEL_fragment_shader_ordering 1
#endif /* GL_INTEL_fragment_shader_ordering */
#ifndef GL_INTEL_framebuffer_CMAA
#define GL_INTEL_framebuffer_CMAA 1
typedef void (APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void);
#endif
#endif /* GL_INTEL_framebuffer_CMAA */
#ifndef GL_INTEL_map_texture
#define GL_INTEL_map_texture 1
#define GL_TEXTURE_MEMORY_LAYOUT_INTEL 0x83FF
@@ -8753,6 +8994,10 @@ GLAPI void APIENTRY glResizeBuffersMESA (void);
#endif
#endif /* GL_MESA_resize_buffers */
#ifndef GL_MESA_shader_integer_functions
#define GL_MESA_shader_integer_functions 1
#endif /* GL_MESA_shader_integer_functions */
#ifndef GL_MESA_window_pos
#define GL_MESA_window_pos 1
typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y);
@@ -8814,6 +9059,10 @@ GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *v);
#define GL_YCBCR_MESA 0x8757
#endif /* GL_MESA_ycbcr_texture */
#ifndef GL_NVX_blend_equation_advanced_multi_draw_buffers
#define GL_NVX_blend_equation_advanced_multi_draw_buffers 1
#endif /* GL_NVX_blend_equation_advanced_multi_draw_buffers */
#ifndef GL_NVX_conditional_render
#define GL_NVX_conditional_render 1
typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVXPROC) (GLuint id);
@@ -8833,6 +9082,32 @@ GLAPI void APIENTRY glEndConditionalRenderNVX (void);
#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
#endif /* GL_NVX_gpu_memory_info */
#ifndef GL_NVX_linked_gpu_multicast
#define GL_NVX_linked_gpu_multicast 1
#define GL_LGPU_SEPARATE_STORAGE_BIT_NVX 0x0800
#define GL_MAX_LGPU_GPUS_NVX 0x92BA
typedef void (APIENTRYP PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
typedef void (APIENTRYP PFNGLLGPUCOPYIMAGESUBDATANVXPROC) (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
typedef void (APIENTRYP PFNGLLGPUINTERLOCKNVXPROC) (void);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glLGPUNamedBufferSubDataNVX (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
GLAPI void APIENTRY glLGPUCopyImageSubDataNVX (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
GLAPI void APIENTRY glLGPUInterlockNVX (void);
#endif
#endif /* GL_NVX_linked_gpu_multicast */
#ifndef GL_NV_alpha_to_coverage_dither_control
#define GL_NV_alpha_to_coverage_dither_control 1
#define GL_ALPHA_TO_COVERAGE_DITHER_DEFAULT_NV 0x934D
#define GL_ALPHA_TO_COVERAGE_DITHER_ENABLE_NV 0x934E
#define GL_ALPHA_TO_COVERAGE_DITHER_DISABLE_NV 0x934F
#define GL_ALPHA_TO_COVERAGE_DITHER_MODE_NV 0x92BF
typedef void (APIENTRYP PFNGLALPHATOCOVERAGEDITHERCONTROLNVPROC) (GLenum mode);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glAlphaToCoverageDitherControlNV (GLenum mode);
#endif
#endif /* GL_NV_alpha_to_coverage_dither_control */
#ifndef GL_NV_bindless_multi_draw_indirect
#define GL_NV_bindless_multi_draw_indirect 1
typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
@@ -8953,6 +9228,17 @@ GLAPI void APIENTRY glBlendBarrierNV (void);
#define GL_NV_blend_square 1
#endif /* GL_NV_blend_square */
#ifndef GL_NV_clip_space_w_scaling
#define GL_NV_clip_space_w_scaling 1
#define GL_VIEWPORT_POSITION_W_SCALE_NV 0x937C
#define GL_VIEWPORT_POSITION_W_SCALE_X_COEFF_NV 0x937D
#define GL_VIEWPORT_POSITION_W_SCALE_Y_COEFF_NV 0x937E
typedef void (APIENTRYP PFNGLVIEWPORTPOSITIONWSCALENVPROC) (GLuint index, GLfloat xcoeff, GLfloat ycoeff);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glViewportPositionWScaleNV (GLuint index, GLfloat xcoeff, GLfloat ycoeff);
#endif
#endif /* GL_NV_clip_space_w_scaling */
#ifndef GL_NV_command_list
#define GL_NV_command_list 1
#define GL_TERMINATE_SEQUENCE_COMMAND_NV 0x0000
@@ -9044,6 +9330,28 @@ GLAPI void APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits);
#endif
#endif /* GL_NV_conservative_raster */
#ifndef GL_NV_conservative_raster_dilate
#define GL_NV_conservative_raster_dilate 1
#define GL_CONSERVATIVE_RASTER_DILATE_NV 0x9379
#define GL_CONSERVATIVE_RASTER_DILATE_RANGE_NV 0x937A
#define GL_CONSERVATIVE_RASTER_DILATE_GRANULARITY_NV 0x937B
typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERFNVPROC) (GLenum pname, GLfloat value);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glConservativeRasterParameterfNV (GLenum pname, GLfloat value);
#endif
#endif /* GL_NV_conservative_raster_dilate */
#ifndef GL_NV_conservative_raster_pre_snap_triangles
#define GL_NV_conservative_raster_pre_snap_triangles 1
#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D
#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E
#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F
typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param);
#endif
#endif /* GL_NV_conservative_raster_pre_snap_triangles */
#ifndef GL_NV_copy_depth_to_color
#define GL_NV_copy_depth_to_color 1
#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E
@@ -9093,6 +9401,23 @@ GLAPI void APIENTRY glDrawTextureNV (GLuint texture, GLuint sampler, GLfloat x0,
#endif
#endif /* GL_NV_draw_texture */
#ifndef GL_NV_draw_vulkan_image
#define GL_NV_draw_vulkan_image 1
typedef void (APIENTRY *GLVULKANPROCNV)(void);
typedef void (APIENTRYP PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
typedef GLVULKANPROCNV (APIENTRYP PFNGLGETVKPROCADDRNVPROC) (const GLchar *name);
typedef void (APIENTRYP PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
typedef void (APIENTRYP PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
typedef void (APIENTRYP PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glDrawVkImageNV (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
GLAPI GLVULKANPROCNV APIENTRY glGetVkProcAddrNV (const GLchar *name);
GLAPI void APIENTRY glWaitVkSemaphoreNV (GLuint64 vkSemaphore);
GLAPI void APIENTRY glSignalVkSemaphoreNV (GLuint64 vkSemaphore);
GLAPI void APIENTRY glSignalVkFenceNV (GLuint64 vkFence);
#endif
#endif /* GL_NV_draw_vulkan_image */
#ifndef GL_NV_evaluators
#define GL_NV_evaluators 1
#define GL_EVAL_2D_NV 0x86C0
@@ -9327,6 +9652,41 @@ GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachmen
#define GL_NV_geometry_shader_passthrough 1
#endif /* GL_NV_geometry_shader_passthrough */
#ifndef GL_NV_gpu_multicast
#define GL_NV_gpu_multicast 1
#define GL_PER_GPU_STORAGE_BIT_NV 0x0800
#define GL_MULTICAST_GPUS_NV 0x92BA
#define GL_RENDER_GPU_MASK_NV 0x9558
#define GL_PER_GPU_STORAGE_NV 0x9548
#define GL_MULTICAST_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9549
typedef void (APIENTRYP PFNGLRENDERGPUMASKNVPROC) (GLbitfield mask);
typedef void (APIENTRYP PFNGLMULTICASTBUFFERSUBDATANVPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data);
typedef void (APIENTRYP PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC) (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
typedef void (APIENTRYP PFNGLMULTICASTCOPYIMAGESUBDATANVPROC) (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
typedef void (APIENTRYP PFNGLMULTICASTBLITFRAMEBUFFERNVPROC) (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef void (APIENTRYP PFNGLMULTICASTFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
typedef void (APIENTRYP PFNGLMULTICASTBARRIERNVPROC) (void);
typedef void (APIENTRYP PFNGLMULTICASTWAITSYNCNVPROC) (GLuint signalGpu, GLbitfield waitGpuMask);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint *params);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint64 *params);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint64 *params);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glRenderGpuMaskNV (GLbitfield mask);
GLAPI void APIENTRY glMulticastBufferSubDataNV (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data);
GLAPI void APIENTRY glMulticastCopyBufferSubDataNV (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
GLAPI void APIENTRY glMulticastCopyImageSubDataNV (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
GLAPI void APIENTRY glMulticastBlitFramebufferNV (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
GLAPI void APIENTRY glMulticastFramebufferSampleLocationsfvNV (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
GLAPI void APIENTRY glMulticastBarrierNV (void);
GLAPI void APIENTRY glMulticastWaitSyncNV (GLuint signalGpu, GLbitfield waitGpuMask);
GLAPI void APIENTRY glMulticastGetQueryObjectivNV (GLuint gpu, GLuint id, GLenum pname, GLint *params);
GLAPI void APIENTRY glMulticastGetQueryObjectuivNV (GLuint gpu, GLuint id, GLenum pname, GLuint *params);
GLAPI void APIENTRY glMulticastGetQueryObjecti64vNV (GLuint gpu, GLuint id, GLenum pname, GLint64 *params);
GLAPI void APIENTRY glMulticastGetQueryObjectui64vNV (GLuint gpu, GLuint id, GLenum pname, GLuint64 *params);
#endif
#endif /* GL_NV_gpu_multicast */
#ifndef GL_NV_gpu_program4
#define GL_NV_gpu_program4 1
#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904
@@ -10036,6 +10396,11 @@ GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname,
#endif
#endif /* GL_NV_register_combiners2 */
#ifndef GL_NV_robustness_video_memory_purge
#define GL_NV_robustness_video_memory_purge 1
#define GL_PURGED_CONTEXT_RESET_NV 0x92BB
#endif /* GL_NV_robustness_video_memory_purge */
#ifndef GL_NV_sample_locations
#define GL_NV_sample_locations 1
#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D
@@ -10068,6 +10433,10 @@ GLAPI void APIENTRY glResolveDepthValuesNV (void);
#define GL_NV_shader_atomic_float 1
#endif /* GL_NV_shader_atomic_float */
#ifndef GL_NV_shader_atomic_float64
#define GL_NV_shader_atomic_float64 1
#endif /* GL_NV_shader_atomic_float64 */
#ifndef GL_NV_shader_atomic_fp16_vector
#define GL_NV_shader_atomic_fp16_vector 1
#endif /* GL_NV_shader_atomic_fp16_vector */
@@ -10131,6 +10500,10 @@ GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLs
#define GL_NV_shader_thread_shuffle 1
#endif /* GL_NV_shader_thread_shuffle */
#ifndef GL_NV_stereo_view_rendering
#define GL_NV_stereo_view_rendering 1
#endif /* GL_NV_stereo_view_rendering */
#ifndef GL_NV_tessellation_program5
#define GL_NV_tessellation_program5 1
#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8
@@ -10901,6 +11274,26 @@ GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot
#define GL_NV_viewport_array2 1
#endif /* GL_NV_viewport_array2 */
#ifndef GL_NV_viewport_swizzle
#define GL_NV_viewport_swizzle 1
#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350
#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351
#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352
#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353
#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354
#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355
#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356
#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357
#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358
#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359
#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A
#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B
typedef void (APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
#endif
#endif /* GL_NV_viewport_swizzle */
#ifndef GL_OML_interlace
#define GL_OML_interlace 1
#define GL_INTERLACE_OML 0x8980
@@ -10928,6 +11321,7 @@ GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632
#define GL_MAX_VIEWS_OVR 0x9631
#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
+1 -1
Submodule 3rdparty/Optional deleted from f27e79084a
-1
Submodule 3rdparty/hidapi deleted from ca39ce8939
+1156 -4571
View File
File diff suppressed because it is too large Load Diff
+777 -3138
View File
File diff suppressed because it is too large Load Diff
+46 -651
View File
@@ -33,20 +33,14 @@ typedef interface ID2D1Device1 ID2D1Device1;
#endif
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_RENDERING_PRIORITY
//
// Synopsis:
// Specifies the extent to which D2D will throttle work sent to the GPU.
//
//------------------------------------------------------------------------------
/// <summary>
/// Specifies the extent to which D2D will throttle work sent to the GPU.
/// </summary>
typedef enum D2D1_RENDERING_PRIORITY
{
D2D1_RENDERING_PRIORITY_NORMAL = 0,
D2D1_RENDERING_PRIORITY_LOW = 1,
D2D1_RENDERING_PRIORITY_FORCE_DWORD = 0xffffffff
D2D1_RENDERING_PRIORITY_NORMAL = 0,
D2D1_RENDERING_PRIORITY_LOW = 1,
D2D1_RENDERING_PRIORITY_FORCE_DWORD = 0xffffffff
} D2D1_RENDERING_PRIORITY;
@@ -54,32 +48,25 @@ typedef enum D2D1_RENDERING_PRIORITY
#ifndef D2D_USE_C_DEFINITIONS
//+-----------------------------------------------------------------------------
//
// Interface:
// ID2D1GeometryRealization
//
//------------------------------------------------------------------------------
/// <summary>
/// Encapsulates a device- and transform-dependent representation of a filled or
/// stroked geometry.
/// </summary>
interface DX_DECLARE_INTERFACE("a16907d7-bc02-4801-99e8-8cf7f485f774") ID2D1GeometryRealization : public ID2D1Resource
{
}; // interface ID2D1GeometryRealization
//+-----------------------------------------------------------------------------
//
// Interface:
// ID2D1DeviceContext1
//
//------------------------------------------------------------------------------
/// <summary>
/// Enables creation and drawing of geometry realization objects.
/// </summary>
interface DX_DECLARE_INTERFACE("d37f57e4-6908-459f-a199-e72f24f79987") ID2D1DeviceContext1 : public ID2D1DeviceContext
{
STDMETHOD(CreateFilledGeometryRealization)(
_In_ ID2D1Geometry *geometry,
FLOAT flatteningTolerance,
_Outptr_ ID2D1GeometryRealization **geometryRealization
_COM_Outptr_ ID2D1GeometryRealization **geometryRealization
) PURE;
STDMETHOD(CreateStrokedGeometryRealization)(
@@ -87,7 +74,7 @@ interface DX_DECLARE_INTERFACE("d37f57e4-6908-459f-a199-e72f24f79987") ID2D1Devi
FLOAT flatteningTolerance,
FLOAT strokeWidth,
_In_opt_ ID2D1StrokeStyle *strokeStyle,
_Outptr_ ID2D1GeometryRealization **geometryRealization
_COM_Outptr_ ID2D1GeometryRealization **geometryRealization
) PURE;
STDMETHOD_(void, DrawGeometryRealization)(
@@ -97,82 +84,69 @@ interface DX_DECLARE_INTERFACE("d37f57e4-6908-459f-a199-e72f24f79987") ID2D1Devi
}; // interface ID2D1DeviceContext1
//+-----------------------------------------------------------------------------
//
// Interface:
// ID2D1Device1
//
//------------------------------------------------------------------------------
/// <summary>
/// Represents a resource domain whose objects and device contexts can be used
/// together.
/// </summary>
interface DX_DECLARE_INTERFACE("d21768e1-23a4-4823-a14b-7c3eba85d658") ID2D1Device1 : public ID2D1Device
{
//
// Retrieves the rendering priority currently set on the device.
//
/// <summary>
/// Retrieves the rendering priority currently set on the device.
/// </summary>
STDMETHOD_(D2D1_RENDERING_PRIORITY, GetRenderingPriority)(
) PURE;
//
// Sets the rendering priority of the device.
//
/// <summary>
/// Sets the rendering priority of the device.
/// </summary>
STDMETHOD_(void, SetRenderingPriority)(
D2D1_RENDERING_PRIORITY renderingPriority
) PURE;
//
// Creates a new device context with no initially assigned target.
//
/// <summary>
/// Creates a new device context with no initially assigned target.
/// </summary>
STDMETHOD(CreateDeviceContext)(
D2D1_DEVICE_CONTEXT_OPTIONS options,
_Outptr_ ID2D1DeviceContext1 **deviceContext1
_COM_Outptr_ ID2D1DeviceContext1 **deviceContext1
) PURE;
using ID2D1Device::CreateDeviceContext;
}; // interface ID2D1Device1
//+-----------------------------------------------------------------------------
//
// Interface:
// ID2D1Factory2
//
//------------------------------------------------------------------------------
/// <summary>
/// Creates Direct2D resources. This interface also enables the creation of
/// ID2D1Device1 objects.
/// </summary>
interface DX_DECLARE_INTERFACE("94f81a73-9212-4376-9c58-b16a3a0d3992") ID2D1Factory2 : public ID2D1Factory1
{
//
// This creates a new Direct2D device from the given IDXGIDevice.
//
/// <summary>
/// This creates a new Direct2D device from the given IDXGIDevice.
/// </summary>
STDMETHOD(CreateDevice)(
_In_ IDXGIDevice *dxgiDevice,
_Outptr_ ID2D1Device1 **d2dDevice1
_COM_Outptr_ ID2D1Device1 **d2dDevice1
) PURE;
using ID2D1Factory1::CreateDevice;
}; // interface ID2D1Factory2
//+-----------------------------------------------------------------------------
//
// Interface:
// ID2D1CommandSink1
//
//------------------------------------------------------------------------------
/// <summary>
/// This interface performs all the same functions as the existing ID2D1CommandSink
/// interface. It also enables access to the new primitive blend modes, MIN and ADD,
/// through its SetPrimitiveBlend1 method.
/// </summary>
interface DX_DECLARE_INTERFACE("9eb767fd-4269-4467-b8c2-eb30cb305743") ID2D1CommandSink1 : public ID2D1CommandSink
{
//
// This method is called if primitiveBlend value was added after Windows 8.
// SetPrimitiveBlend method is used for Win8 values (_SOURCE_OVER and _COPY).
//
/// <summary>
/// This method is called if primitiveBlend value was added after Windows 8.
/// SetPrimitiveBlend method is used for Win8 values (_SOURCE_OVER and _COPY).
/// </summary>
STDMETHOD(SetPrimitiveBlend1)(
D2D1_PRIMITIVE_BLEND primitiveBlend
) PURE;
@@ -195,593 +169,14 @@ EXTERN_C CONST IID IID_ID2D1CommandSink1;
typedef interface ID2D1GeometryRealization ID2D1GeometryRealization;
typedef struct ID2D1GeometryRealizationVtbl
{
ID2D1ResourceVtbl Base;
} ID2D1GeometryRealizationVtbl;
interface ID2D1GeometryRealization
{
CONST struct ID2D1GeometryRealizationVtbl *lpVtbl;
};
#define ID2D1GeometryRealization_QueryInterface(This, riid, ppv) \
((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
#define ID2D1GeometryRealization_AddRef(This) \
((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This))
#define ID2D1GeometryRealization_Release(This) \
((This)->lpVtbl->Base.Base.Release((IUnknown *)This))
#define ID2D1GeometryRealization_GetFactory(This, factory) \
((This)->lpVtbl->Base.GetFactory((ID2D1Resource *)This, factory))
typedef interface ID2D1DeviceContext1 ID2D1DeviceContext1;
typedef struct ID2D1DeviceContext1Vtbl
{
ID2D1DeviceContextVtbl Base;
STDMETHOD(CreateFilledGeometryRealization)(
ID2D1DeviceContext1 *This,
_In_ ID2D1Geometry *geometry,
FLOAT flatteningTolerance,
_Outptr_ ID2D1GeometryRealization **geometryRealization
) PURE;
STDMETHOD(CreateStrokedGeometryRealization)(
ID2D1DeviceContext1 *This,
_In_ ID2D1Geometry *geometry,
FLOAT flatteningTolerance,
FLOAT strokeWidth,
_In_opt_ ID2D1StrokeStyle *strokeStyle,
_Outptr_ ID2D1GeometryRealization **geometryRealization
) PURE;
STDMETHOD_(void, DrawGeometryRealization)(
ID2D1DeviceContext1 *This,
_In_ ID2D1GeometryRealization *geometryRealization,
_In_ ID2D1Brush *brush
) PURE;
} ID2D1DeviceContext1Vtbl;
interface ID2D1DeviceContext1
{
CONST struct ID2D1DeviceContext1Vtbl *lpVtbl;
};
#define ID2D1DeviceContext1_QueryInterface(This, riid, ppv) \
((This)->lpVtbl->Base.Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
#define ID2D1DeviceContext1_AddRef(This) \
((This)->lpVtbl->Base.Base.Base.Base.AddRef((IUnknown *)This))
#define ID2D1DeviceContext1_Release(This) \
((This)->lpVtbl->Base.Base.Base.Base.Release((IUnknown *)This))
#define ID2D1DeviceContext1_GetFactory(This, factory) \
((This)->lpVtbl->Base.Base.Base.GetFactory((ID2D1Resource *)This, factory))
#define ID2D1DeviceContext1_CreateSharedBitmap(This, riid, data, bitmapProperties, bitmap) \
((This)->lpVtbl->Base.Base.CreateSharedBitmap((ID2D1RenderTarget *)This, riid, data, bitmapProperties, bitmap))
#define ID2D1DeviceContext1_CreateSolidColorBrush(This, color, brushProperties, solidColorBrush) \
((This)->lpVtbl->Base.Base.CreateSolidColorBrush((ID2D1RenderTarget *)This, color, brushProperties, solidColorBrush))
#define ID2D1DeviceContext1_CreateLinearGradientBrush(This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush) \
((This)->lpVtbl->Base.Base.CreateLinearGradientBrush((ID2D1RenderTarget *)This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush))
#define ID2D1DeviceContext1_CreateRadialGradientBrush(This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush) \
((This)->lpVtbl->Base.Base.CreateRadialGradientBrush((ID2D1RenderTarget *)This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush))
#define ID2D1DeviceContext1_CreateCompatibleRenderTarget(This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget) \
((This)->lpVtbl->Base.Base.CreateCompatibleRenderTarget((ID2D1RenderTarget *)This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget))
#define ID2D1DeviceContext1_CreateLayer(This, size, layer) \
((This)->lpVtbl->Base.Base.CreateLayer((ID2D1RenderTarget *)This, size, layer))
#define ID2D1DeviceContext1_CreateMesh(This, mesh) \
((This)->lpVtbl->Base.Base.CreateMesh((ID2D1RenderTarget *)This, mesh))
#define ID2D1DeviceContext1_DrawLine(This, point0, point1, brush, strokeWidth, strokeStyle) \
((This)->lpVtbl->Base.Base.DrawLine((ID2D1RenderTarget *)This, point0, point1, brush, strokeWidth, strokeStyle))
#define ID2D1DeviceContext1_DrawRectangle(This, rect, brush, strokeWidth, strokeStyle) \
((This)->lpVtbl->Base.Base.DrawRectangle((ID2D1RenderTarget *)This, rect, brush, strokeWidth, strokeStyle))
#define ID2D1DeviceContext1_FillRectangle(This, rect, brush) \
((This)->lpVtbl->Base.Base.FillRectangle((ID2D1RenderTarget *)This, rect, brush))
#define ID2D1DeviceContext1_DrawRoundedRectangle(This, roundedRect, brush, strokeWidth, strokeStyle) \
((This)->lpVtbl->Base.Base.DrawRoundedRectangle((ID2D1RenderTarget *)This, roundedRect, brush, strokeWidth, strokeStyle))
#define ID2D1DeviceContext1_FillRoundedRectangle(This, roundedRect, brush) \
((This)->lpVtbl->Base.Base.FillRoundedRectangle((ID2D1RenderTarget *)This, roundedRect, brush))
#define ID2D1DeviceContext1_DrawEllipse(This, ellipse, brush, strokeWidth, strokeStyle) \
((This)->lpVtbl->Base.Base.DrawEllipse((ID2D1RenderTarget *)This, ellipse, brush, strokeWidth, strokeStyle))
#define ID2D1DeviceContext1_FillEllipse(This, ellipse, brush) \
((This)->lpVtbl->Base.Base.FillEllipse((ID2D1RenderTarget *)This, ellipse, brush))
#define ID2D1DeviceContext1_DrawGeometry(This, geometry, brush, strokeWidth, strokeStyle) \
((This)->lpVtbl->Base.Base.DrawGeometry((ID2D1RenderTarget *)This, geometry, brush, strokeWidth, strokeStyle))
#define ID2D1DeviceContext1_FillGeometry(This, geometry, brush, opacityBrush) \
((This)->lpVtbl->Base.Base.FillGeometry((ID2D1RenderTarget *)This, geometry, brush, opacityBrush))
#define ID2D1DeviceContext1_FillMesh(This, mesh, brush) \
((This)->lpVtbl->Base.Base.FillMesh((ID2D1RenderTarget *)This, mesh, brush))
#define ID2D1DeviceContext1_DrawText(This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode) \
((This)->lpVtbl->Base.Base.DrawText((ID2D1RenderTarget *)This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode))
#define ID2D1DeviceContext1_DrawTextLayout(This, origin, textLayout, defaultForegroundBrush, options) \
((This)->lpVtbl->Base.Base.DrawTextLayout((ID2D1RenderTarget *)This, origin, textLayout, defaultForegroundBrush, options))
#define ID2D1DeviceContext1_SetTransform(This, transform) \
((This)->lpVtbl->Base.Base.SetTransform((ID2D1RenderTarget *)This, transform))
#define ID2D1DeviceContext1_GetTransform(This, transform) \
((This)->lpVtbl->Base.Base.GetTransform((ID2D1RenderTarget *)This, transform))
#define ID2D1DeviceContext1_SetAntialiasMode(This, antialiasMode) \
((This)->lpVtbl->Base.Base.SetAntialiasMode((ID2D1RenderTarget *)This, antialiasMode))
#define ID2D1DeviceContext1_GetAntialiasMode(This) \
((This)->lpVtbl->Base.Base.GetAntialiasMode((ID2D1RenderTarget *)This))
#define ID2D1DeviceContext1_SetTextAntialiasMode(This, textAntialiasMode) \
((This)->lpVtbl->Base.Base.SetTextAntialiasMode((ID2D1RenderTarget *)This, textAntialiasMode))
#define ID2D1DeviceContext1_GetTextAntialiasMode(This) \
((This)->lpVtbl->Base.Base.GetTextAntialiasMode((ID2D1RenderTarget *)This))
#define ID2D1DeviceContext1_SetTextRenderingParams(This, textRenderingParams) \
((This)->lpVtbl->Base.Base.SetTextRenderingParams((ID2D1RenderTarget *)This, textRenderingParams))
#define ID2D1DeviceContext1_GetTextRenderingParams(This, textRenderingParams) \
((This)->lpVtbl->Base.Base.GetTextRenderingParams((ID2D1RenderTarget *)This, textRenderingParams))
#define ID2D1DeviceContext1_SetTags(This, tag1, tag2) \
((This)->lpVtbl->Base.Base.SetTags((ID2D1RenderTarget *)This, tag1, tag2))
#define ID2D1DeviceContext1_GetTags(This, tag1, tag2) \
((This)->lpVtbl->Base.Base.GetTags((ID2D1RenderTarget *)This, tag1, tag2))
#define ID2D1DeviceContext1_PopLayer(This) \
((This)->lpVtbl->Base.Base.PopLayer((ID2D1RenderTarget *)This))
#define ID2D1DeviceContext1_Flush(This, tag1, tag2) \
((This)->lpVtbl->Base.Base.Flush((ID2D1RenderTarget *)This, tag1, tag2))
#define ID2D1DeviceContext1_SaveDrawingState(This, drawingStateBlock) \
((This)->lpVtbl->Base.Base.SaveDrawingState((ID2D1RenderTarget *)This, drawingStateBlock))
#define ID2D1DeviceContext1_RestoreDrawingState(This, drawingStateBlock) \
((This)->lpVtbl->Base.Base.RestoreDrawingState((ID2D1RenderTarget *)This, drawingStateBlock))
#define ID2D1DeviceContext1_PushAxisAlignedClip(This, clipRect, antialiasMode) \
((This)->lpVtbl->Base.Base.PushAxisAlignedClip((ID2D1RenderTarget *)This, clipRect, antialiasMode))
#define ID2D1DeviceContext1_PopAxisAlignedClip(This) \
((This)->lpVtbl->Base.Base.PopAxisAlignedClip((ID2D1RenderTarget *)This))
#define ID2D1DeviceContext1_Clear(This, clearColor) \
((This)->lpVtbl->Base.Base.Clear((ID2D1RenderTarget *)This, clearColor))
#define ID2D1DeviceContext1_BeginDraw(This) \
((This)->lpVtbl->Base.Base.BeginDraw((ID2D1RenderTarget *)This))
#define ID2D1DeviceContext1_EndDraw(This, tag1, tag2) \
((This)->lpVtbl->Base.Base.EndDraw((ID2D1RenderTarget *)This, tag1, tag2))
#define ID2D1DeviceContext1_GetPixelFormat(This) \
((This)->lpVtbl->Base.Base.GetPixelFormat((ID2D1RenderTarget *)This))
#define ID2D1DeviceContext1_SetDpi(This, dpiX, dpiY) \
((This)->lpVtbl->Base.Base.SetDpi((ID2D1RenderTarget *)This, dpiX, dpiY))
#define ID2D1DeviceContext1_GetDpi(This, dpiX, dpiY) \
((This)->lpVtbl->Base.Base.GetDpi((ID2D1RenderTarget *)This, dpiX, dpiY))
#define ID2D1DeviceContext1_GetSize(This) \
((This)->lpVtbl->Base.Base.GetSize((ID2D1RenderTarget *)This))
#define ID2D1DeviceContext1_GetPixelSize(This) \
((This)->lpVtbl->Base.Base.GetPixelSize((ID2D1RenderTarget *)This))
#define ID2D1DeviceContext1_GetMaximumBitmapSize(This) \
((This)->lpVtbl->Base.Base.GetMaximumBitmapSize((ID2D1RenderTarget *)This))
#define ID2D1DeviceContext1_IsSupported(This, renderTargetProperties) \
((This)->lpVtbl->Base.Base.IsSupported((ID2D1RenderTarget *)This, renderTargetProperties))
#define ID2D1DeviceContext1_CreateBitmap(This, size, sourceData, pitch, bitmapProperties, bitmap) \
((This)->lpVtbl->Base.CreateBitmap((ID2D1DeviceContext *)This, size, sourceData, pitch, bitmapProperties, bitmap))
#define ID2D1DeviceContext1_CreateBitmapFromWicBitmap(This, wicBitmapSource, bitmapProperties, bitmap) \
((This)->lpVtbl->Base.CreateBitmapFromWicBitmap((ID2D1DeviceContext *)This, wicBitmapSource, bitmapProperties, bitmap))
#define ID2D1DeviceContext1_CreateColorContext(This, space, profile, profileSize, colorContext) \
((This)->lpVtbl->Base.CreateColorContext((ID2D1DeviceContext *)This, space, profile, profileSize, colorContext))
#define ID2D1DeviceContext1_CreateColorContextFromFilename(This, filename, colorContext) \
((This)->lpVtbl->Base.CreateColorContextFromFilename((ID2D1DeviceContext *)This, filename, colorContext))
#define ID2D1DeviceContext1_CreateColorContextFromWicColorContext(This, wicColorContext, colorContext) \
((This)->lpVtbl->Base.CreateColorContextFromWicColorContext((ID2D1DeviceContext *)This, wicColorContext, colorContext))
#define ID2D1DeviceContext1_CreateBitmapFromDxgiSurface(This, surface, bitmapProperties, bitmap) \
((This)->lpVtbl->Base.CreateBitmapFromDxgiSurface((ID2D1DeviceContext *)This, surface, bitmapProperties, bitmap))
#define ID2D1DeviceContext1_CreateEffect(This, effectId, effect) \
((This)->lpVtbl->Base.CreateEffect((ID2D1DeviceContext *)This, effectId, effect))
#define ID2D1DeviceContext1_CreateGradientStopCollection(This, straightAlphaGradientStops, straightAlphaGradientStopsCount, preInterpolationSpace, postInterpolationSpace, bufferPrecision, extendMode, colorInterpolationMode, gradientStopCollection1) \
((This)->lpVtbl->Base.CreateGradientStopCollection((ID2D1DeviceContext *)This, straightAlphaGradientStops, straightAlphaGradientStopsCount, preInterpolationSpace, postInterpolationSpace, bufferPrecision, extendMode, colorInterpolationMode, gradientStopCollection1))
#define ID2D1DeviceContext1_CreateImageBrush(This, image, imageBrushProperties, brushProperties, imageBrush) \
((This)->lpVtbl->Base.CreateImageBrush((ID2D1DeviceContext *)This, image, imageBrushProperties, brushProperties, imageBrush))
#define ID2D1DeviceContext1_CreateBitmapBrush(This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush) \
((This)->lpVtbl->Base.CreateBitmapBrush((ID2D1DeviceContext *)This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush))
#define ID2D1DeviceContext1_CreateCommandList(This, commandList) \
((This)->lpVtbl->Base.CreateCommandList((ID2D1DeviceContext *)This, commandList))
#define ID2D1DeviceContext1_IsDxgiFormatSupported(This, format) \
((This)->lpVtbl->Base.IsDxgiFormatSupported((ID2D1DeviceContext *)This, format))
#define ID2D1DeviceContext1_IsBufferPrecisionSupported(This, bufferPrecision) \
((This)->lpVtbl->Base.IsBufferPrecisionSupported((ID2D1DeviceContext *)This, bufferPrecision))
#define ID2D1DeviceContext1_GetImageLocalBounds(This, image, localBounds) \
((This)->lpVtbl->Base.GetImageLocalBounds((ID2D1DeviceContext *)This, image, localBounds))
#define ID2D1DeviceContext1_GetImageWorldBounds(This, image, worldBounds) \
((This)->lpVtbl->Base.GetImageWorldBounds((ID2D1DeviceContext *)This, image, worldBounds))
#define ID2D1DeviceContext1_GetGlyphRunWorldBounds(This, baselineOrigin, glyphRun, measuringMode, bounds) \
((This)->lpVtbl->Base.GetGlyphRunWorldBounds((ID2D1DeviceContext *)This, baselineOrigin, glyphRun, measuringMode, bounds))
#define ID2D1DeviceContext1_GetDevice(This, device) \
((This)->lpVtbl->Base.GetDevice((ID2D1DeviceContext *)This, device))
#define ID2D1DeviceContext1_SetTarget(This, image) \
((This)->lpVtbl->Base.SetTarget((ID2D1DeviceContext *)This, image))
#define ID2D1DeviceContext1_GetTarget(This, image) \
((This)->lpVtbl->Base.GetTarget((ID2D1DeviceContext *)This, image))
#define ID2D1DeviceContext1_SetRenderingControls(This, renderingControls) \
((This)->lpVtbl->Base.SetRenderingControls((ID2D1DeviceContext *)This, renderingControls))
#define ID2D1DeviceContext1_GetRenderingControls(This, renderingControls) \
((This)->lpVtbl->Base.GetRenderingControls((ID2D1DeviceContext *)This, renderingControls))
#define ID2D1DeviceContext1_SetPrimitiveBlend(This, primitiveBlend) \
((This)->lpVtbl->Base.SetPrimitiveBlend((ID2D1DeviceContext *)This, primitiveBlend))
#define ID2D1DeviceContext1_GetPrimitiveBlend(This) \
((This)->lpVtbl->Base.GetPrimitiveBlend((ID2D1DeviceContext *)This))
#define ID2D1DeviceContext1_SetUnitMode(This, unitMode) \
((This)->lpVtbl->Base.SetUnitMode((ID2D1DeviceContext *)This, unitMode))
#define ID2D1DeviceContext1_GetUnitMode(This) \
((This)->lpVtbl->Base.GetUnitMode((ID2D1DeviceContext *)This))
#define ID2D1DeviceContext1_DrawGlyphRun(This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode) \
((This)->lpVtbl->Base.DrawGlyphRun((ID2D1DeviceContext *)This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode))
#define ID2D1DeviceContext1_DrawImage(This, image, targetOffset, imageRectangle, interpolationMode, compositeMode) \
((This)->lpVtbl->Base.DrawImage((ID2D1DeviceContext *)This, image, targetOffset, imageRectangle, interpolationMode, compositeMode))
#define ID2D1DeviceContext1_DrawGdiMetafile(This, gdiMetafile, targetOffset) \
((This)->lpVtbl->Base.DrawGdiMetafile((ID2D1DeviceContext *)This, gdiMetafile, targetOffset))
#define ID2D1DeviceContext1_DrawBitmap(This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform) \
((This)->lpVtbl->Base.DrawBitmap((ID2D1DeviceContext *)This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform))
#define ID2D1DeviceContext1_PushLayer(This, layerParameters, layer) \
((This)->lpVtbl->Base.PushLayer((ID2D1DeviceContext *)This, layerParameters, layer))
#define ID2D1DeviceContext1_InvalidateEffectInputRectangle(This, effect, input, inputRectangle) \
((This)->lpVtbl->Base.InvalidateEffectInputRectangle((ID2D1DeviceContext *)This, effect, input, inputRectangle))
#define ID2D1DeviceContext1_GetEffectInvalidRectangleCount(This, effect, rectangleCount) \
((This)->lpVtbl->Base.GetEffectInvalidRectangleCount((ID2D1DeviceContext *)This, effect, rectangleCount))
#define ID2D1DeviceContext1_GetEffectInvalidRectangles(This, effect, rectangles, rectanglesCount) \
((This)->lpVtbl->Base.GetEffectInvalidRectangles((ID2D1DeviceContext *)This, effect, rectangles, rectanglesCount))
#define ID2D1DeviceContext1_GetEffectRequiredInputRectangles(This, renderEffect, renderImageRectangle, inputDescriptions, requiredInputRects, inputCount) \
((This)->lpVtbl->Base.GetEffectRequiredInputRectangles((ID2D1DeviceContext *)This, renderEffect, renderImageRectangle, inputDescriptions, requiredInputRects, inputCount))
#define ID2D1DeviceContext1_FillOpacityMask(This, opacityMask, brush, destinationRectangle, sourceRectangle) \
((This)->lpVtbl->Base.FillOpacityMask((ID2D1DeviceContext *)This, opacityMask, brush, destinationRectangle, sourceRectangle))
#define ID2D1DeviceContext1_CreateFilledGeometryRealization(This, geometry, flatteningTolerance, geometryRealization) \
((This)->lpVtbl->CreateFilledGeometryRealization(This, geometry, flatteningTolerance, geometryRealization))
#define ID2D1DeviceContext1_CreateStrokedGeometryRealization(This, geometry, flatteningTolerance, strokeWidth, strokeStyle, geometryRealization) \
((This)->lpVtbl->CreateStrokedGeometryRealization(This, geometry, flatteningTolerance, strokeWidth, strokeStyle, geometryRealization))
#define ID2D1DeviceContext1_DrawGeometryRealization(This, geometryRealization, brush) \
((This)->lpVtbl->DrawGeometryRealization(This, geometryRealization, brush))
typedef interface ID2D1Device1 ID2D1Device1;
typedef struct ID2D1Device1Vtbl
{
ID2D1DeviceVtbl Base;
STDMETHOD_(D2D1_RENDERING_PRIORITY, GetRenderingPriority)(
ID2D1Device1 *This
) PURE;
STDMETHOD_(void, SetRenderingPriority)(
ID2D1Device1 *This,
D2D1_RENDERING_PRIORITY renderingPriority
) PURE;
STDMETHOD(CreateDeviceContext)(
ID2D1Device1 *This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
_Outptr_ ID2D1DeviceContext1 **deviceContext1
) PURE;
} ID2D1Device1Vtbl;
interface ID2D1Device1
{
CONST struct ID2D1Device1Vtbl *lpVtbl;
};
#define ID2D1Device1_QueryInterface(This, riid, ppv) \
((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
#define ID2D1Device1_AddRef(This) \
((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This))
#define ID2D1Device1_Release(This) \
((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This))
#define ID2D1Device1_GetFactory(This, factory) \
((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory))
#define ID2D1Device1_CreatePrintControl(This, wicFactory, documentTarget, printControlProperties, printControl) \
((This)->lpVtbl->Base.CreatePrintControl((ID2D1Device *)This, wicFactory, documentTarget, printControlProperties, printControl))
#define ID2D1Device1_SetMaximumTextureMemory(This, maximumInBytes) \
((This)->lpVtbl->Base.SetMaximumTextureMemory((ID2D1Device *)This, maximumInBytes))
#define ID2D1Device1_GetMaximumTextureMemory(This) \
((This)->lpVtbl->Base.GetMaximumTextureMemory((ID2D1Device *)This))
#define ID2D1Device1_ClearResources(This, millisecondsSinceUse) \
((This)->lpVtbl->Base.ClearResources((ID2D1Device *)This, millisecondsSinceUse))
#define ID2D1Device1_GetRenderingPriority(This) \
((This)->lpVtbl->GetRenderingPriority(This))
#define ID2D1Device1_SetRenderingPriority(This, renderingPriority) \
((This)->lpVtbl->SetRenderingPriority(This, renderingPriority))
#define ID2D1Device1_CreateDeviceContext(This, options, deviceContext1) \
((This)->lpVtbl->CreateDeviceContext(This, options, deviceContext1))
typedef interface ID2D1Factory2 ID2D1Factory2;
typedef struct ID2D1Factory2Vtbl
{
ID2D1Factory1Vtbl Base;
STDMETHOD(CreateDevice)(
ID2D1Factory2 *This,
_In_ IDXGIDevice *dxgiDevice,
_Outptr_ ID2D1Device1 **d2dDevice1
) PURE;
} ID2D1Factory2Vtbl;
interface ID2D1Factory2
{
CONST struct ID2D1Factory2Vtbl *lpVtbl;
};
#define ID2D1Factory2_QueryInterface(This, riid, ppv) \
((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
#define ID2D1Factory2_AddRef(This) \
((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This))
#define ID2D1Factory2_Release(This) \
((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This))
#define ID2D1Factory2_ReloadSystemMetrics(This) \
((This)->lpVtbl->Base.Base.ReloadSystemMetrics((ID2D1Factory *)This))
#define ID2D1Factory2_GetDesktopDpi(This, dpiX, dpiY) \
((This)->lpVtbl->Base.Base.GetDesktopDpi((ID2D1Factory *)This, dpiX, dpiY))
#define ID2D1Factory2_CreateRectangleGeometry(This, rectangle, rectangleGeometry) \
((This)->lpVtbl->Base.Base.CreateRectangleGeometry((ID2D1Factory *)This, rectangle, rectangleGeometry))
#define ID2D1Factory2_CreateRoundedRectangleGeometry(This, roundedRectangle, roundedRectangleGeometry) \
((This)->lpVtbl->Base.Base.CreateRoundedRectangleGeometry((ID2D1Factory *)This, roundedRectangle, roundedRectangleGeometry))
#define ID2D1Factory2_CreateEllipseGeometry(This, ellipse, ellipseGeometry) \
((This)->lpVtbl->Base.Base.CreateEllipseGeometry((ID2D1Factory *)This, ellipse, ellipseGeometry))
#define ID2D1Factory2_CreateGeometryGroup(This, fillMode, geometries, geometriesCount, geometryGroup) \
((This)->lpVtbl->Base.Base.CreateGeometryGroup((ID2D1Factory *)This, fillMode, geometries, geometriesCount, geometryGroup))
#define ID2D1Factory2_CreateTransformedGeometry(This, sourceGeometry, transform, transformedGeometry) \
((This)->lpVtbl->Base.Base.CreateTransformedGeometry((ID2D1Factory *)This, sourceGeometry, transform, transformedGeometry))
#define ID2D1Factory2_CreateWicBitmapRenderTarget(This, target, renderTargetProperties, renderTarget) \
((This)->lpVtbl->Base.Base.CreateWicBitmapRenderTarget((ID2D1Factory *)This, target, renderTargetProperties, renderTarget))
#define ID2D1Factory2_CreateHwndRenderTarget(This, renderTargetProperties, hwndRenderTargetProperties, hwndRenderTarget) \
((This)->lpVtbl->Base.Base.CreateHwndRenderTarget((ID2D1Factory *)This, renderTargetProperties, hwndRenderTargetProperties, hwndRenderTarget))
#define ID2D1Factory2_CreateDxgiSurfaceRenderTarget(This, dxgiSurface, renderTargetProperties, renderTarget) \
((This)->lpVtbl->Base.Base.CreateDxgiSurfaceRenderTarget((ID2D1Factory *)This, dxgiSurface, renderTargetProperties, renderTarget))
#define ID2D1Factory2_CreateDCRenderTarget(This, renderTargetProperties, dcRenderTarget) \
((This)->lpVtbl->Base.Base.CreateDCRenderTarget((ID2D1Factory *)This, renderTargetProperties, dcRenderTarget))
#define ID2D1Factory2_CreateStrokeStyle(This, strokeStyleProperties, dashes, dashesCount, strokeStyle) \
((This)->lpVtbl->Base.CreateStrokeStyle((ID2D1Factory1 *)This, strokeStyleProperties, dashes, dashesCount, strokeStyle))
#define ID2D1Factory2_CreatePathGeometry(This, pathGeometry) \
((This)->lpVtbl->Base.CreatePathGeometry((ID2D1Factory1 *)This, pathGeometry))
#define ID2D1Factory2_CreateDrawingStateBlock(This, drawingStateDescription, textRenderingParams, drawingStateBlock) \
((This)->lpVtbl->Base.CreateDrawingStateBlock((ID2D1Factory1 *)This, drawingStateDescription, textRenderingParams, drawingStateBlock))
#define ID2D1Factory2_CreateGdiMetafile(This, metafileStream, metafile) \
((This)->lpVtbl->Base.CreateGdiMetafile((ID2D1Factory1 *)This, metafileStream, metafile))
#define ID2D1Factory2_RegisterEffectFromStream(This, classId, propertyXml, bindings, bindingsCount, effectFactory) \
((This)->lpVtbl->Base.RegisterEffectFromStream((ID2D1Factory1 *)This, classId, propertyXml, bindings, bindingsCount, effectFactory))
#define ID2D1Factory2_RegisterEffectFromString(This, classId, propertyXml, bindings, bindingsCount, effectFactory) \
((This)->lpVtbl->Base.RegisterEffectFromString((ID2D1Factory1 *)This, classId, propertyXml, bindings, bindingsCount, effectFactory))
#define ID2D1Factory2_UnregisterEffect(This, classId) \
((This)->lpVtbl->Base.UnregisterEffect((ID2D1Factory1 *)This, classId))
#define ID2D1Factory2_GetRegisteredEffects(This, effects, effectsCount, effectsReturned, effectsRegistered) \
((This)->lpVtbl->Base.GetRegisteredEffects((ID2D1Factory1 *)This, effects, effectsCount, effectsReturned, effectsRegistered))
#define ID2D1Factory2_GetEffectProperties(This, effectId, properties) \
((This)->lpVtbl->Base.GetEffectProperties((ID2D1Factory1 *)This, effectId, properties))
#define ID2D1Factory2_CreateDevice(This, dxgiDevice, d2dDevice1) \
((This)->lpVtbl->CreateDevice(This, dxgiDevice, d2dDevice1))
typedef interface ID2D1CommandSink1 ID2D1CommandSink1;
typedef struct ID2D1CommandSink1Vtbl
{
ID2D1CommandSinkVtbl Base;
STDMETHOD(SetPrimitiveBlend1)(
ID2D1CommandSink1 *This,
D2D1_PRIMITIVE_BLEND primitiveBlend
) PURE;
} ID2D1CommandSink1Vtbl;
interface ID2D1CommandSink1
{
CONST struct ID2D1CommandSink1Vtbl *lpVtbl;
};
#define ID2D1CommandSink1_QueryInterface(This, riid, ppv) \
((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
#define ID2D1CommandSink1_AddRef(This) \
((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This))
#define ID2D1CommandSink1_Release(This) \
((This)->lpVtbl->Base.Base.Release((IUnknown *)This))
#define ID2D1CommandSink1_BeginDraw(This) \
((This)->lpVtbl->Base.BeginDraw((ID2D1CommandSink *)This))
#define ID2D1CommandSink1_EndDraw(This) \
((This)->lpVtbl->Base.EndDraw((ID2D1CommandSink *)This))
#define ID2D1CommandSink1_SetAntialiasMode(This, antialiasMode) \
((This)->lpVtbl->Base.SetAntialiasMode((ID2D1CommandSink *)This, antialiasMode))
#define ID2D1CommandSink1_SetTags(This, tag1, tag2) \
((This)->lpVtbl->Base.SetTags((ID2D1CommandSink *)This, tag1, tag2))
#define ID2D1CommandSink1_SetTextAntialiasMode(This, textAntialiasMode) \
((This)->lpVtbl->Base.SetTextAntialiasMode((ID2D1CommandSink *)This, textAntialiasMode))
#define ID2D1CommandSink1_SetTextRenderingParams(This, textRenderingParams) \
((This)->lpVtbl->Base.SetTextRenderingParams((ID2D1CommandSink *)This, textRenderingParams))
#define ID2D1CommandSink1_SetTransform(This, transform) \
((This)->lpVtbl->Base.SetTransform((ID2D1CommandSink *)This, transform))
#define ID2D1CommandSink1_SetPrimitiveBlend(This, primitiveBlend) \
((This)->lpVtbl->Base.SetPrimitiveBlend((ID2D1CommandSink *)This, primitiveBlend))
#define ID2D1CommandSink1_SetUnitMode(This, unitMode) \
((This)->lpVtbl->Base.SetUnitMode((ID2D1CommandSink *)This, unitMode))
#define ID2D1CommandSink1_Clear(This, color) \
((This)->lpVtbl->Base.Clear((ID2D1CommandSink *)This, color))
#define ID2D1CommandSink1_DrawGlyphRun(This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode) \
((This)->lpVtbl->Base.DrawGlyphRun((ID2D1CommandSink *)This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode))
#define ID2D1CommandSink1_DrawLine(This, point0, point1, brush, strokeWidth, strokeStyle) \
((This)->lpVtbl->Base.DrawLine((ID2D1CommandSink *)This, point0, point1, brush, strokeWidth, strokeStyle))
#define ID2D1CommandSink1_DrawGeometry(This, geometry, brush, strokeWidth, strokeStyle) \
((This)->lpVtbl->Base.DrawGeometry((ID2D1CommandSink *)This, geometry, brush, strokeWidth, strokeStyle))
#define ID2D1CommandSink1_DrawRectangle(This, rect, brush, strokeWidth, strokeStyle) \
((This)->lpVtbl->Base.DrawRectangle((ID2D1CommandSink *)This, rect, brush, strokeWidth, strokeStyle))
#define ID2D1CommandSink1_DrawBitmap(This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform) \
((This)->lpVtbl->Base.DrawBitmap((ID2D1CommandSink *)This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform))
#define ID2D1CommandSink1_DrawImage(This, image, targetOffset, imageRectangle, interpolationMode, compositeMode) \
((This)->lpVtbl->Base.DrawImage((ID2D1CommandSink *)This, image, targetOffset, imageRectangle, interpolationMode, compositeMode))
#define ID2D1CommandSink1_DrawGdiMetafile(This, gdiMetafile, targetOffset) \
((This)->lpVtbl->Base.DrawGdiMetafile((ID2D1CommandSink *)This, gdiMetafile, targetOffset))
#define ID2D1CommandSink1_FillMesh(This, mesh, brush) \
((This)->lpVtbl->Base.FillMesh((ID2D1CommandSink *)This, mesh, brush))
#define ID2D1CommandSink1_FillOpacityMask(This, opacityMask, brush, destinationRectangle, sourceRectangle) \
((This)->lpVtbl->Base.FillOpacityMask((ID2D1CommandSink *)This, opacityMask, brush, destinationRectangle, sourceRectangle))
#define ID2D1CommandSink1_FillGeometry(This, geometry, brush, opacityBrush) \
((This)->lpVtbl->Base.FillGeometry((ID2D1CommandSink *)This, geometry, brush, opacityBrush))
#define ID2D1CommandSink1_FillRectangle(This, rect, brush) \
((This)->lpVtbl->Base.FillRectangle((ID2D1CommandSink *)This, rect, brush))
#define ID2D1CommandSink1_PushAxisAlignedClip(This, clipRect, antialiasMode) \
((This)->lpVtbl->Base.PushAxisAlignedClip((ID2D1CommandSink *)This, clipRect, antialiasMode))
#define ID2D1CommandSink1_PushLayer(This, layerParameters1, layer) \
((This)->lpVtbl->Base.PushLayer((ID2D1CommandSink *)This, layerParameters1, layer))
#define ID2D1CommandSink1_PopAxisAlignedClip(This) \
((This)->lpVtbl->Base.PopAxisAlignedClip((ID2D1CommandSink *)This))
#define ID2D1CommandSink1_PopLayer(This) \
((This)->lpVtbl->Base.PopLayer((ID2D1CommandSink *)This))
#define ID2D1CommandSink1_SetPrimitiveBlend1(This, primitiveBlend) \
((This)->lpVtbl->SetPrimitiveBlend1(This, primitiveBlend))
#endif
+853 -1582
View File
File diff suppressed because it is too large Load Diff
+10
View File
@@ -215,6 +215,16 @@ namespace D2D1
return inkStyleProperties;
}
COM_DECLSPEC_NOTHROW
D2D1FORCEINLINE
D2D1_RECT_U
InfiniteRectU()
{
D2D1_RECT_U rect = { 0u, 0u, UINT_MAX, UINT_MAX };
return rect;
}
} // namespace D2D1
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
+1464 -1865
View File
File diff suppressed because it is too large Load Diff
+35 -55
View File
@@ -25,73 +25,53 @@
// Built in effect CLSIDs
DEFINE_GUID(CLSID_D2D1YCbCr, 0x99503cc1, 0x66c7, 0x45c9, 0xa8, 0x75, 0x8a, 0xd8, 0xa7, 0x91, 0x44, 0x01);
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_YCBCR_PROP
//
// Synopsis:
// The enumeration of the YCbCr effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the YCbCr effect's top level properties.
/// </summary>
typedef enum D2D1_YCBCR_PROP
{
//
// Property Name: "ChromaSubsampling"
// Property Type: D2D1_YCBCR_CHROMA_SUBSAMPLING
//
D2D1_YCBCR_PROP_CHROMA_SUBSAMPLING = 0,
//
// Property Name: "TransformMatrix"
// Property Type: D2D1_MATRIX_3X2_F
//
D2D1_YCBCR_PROP_TRANSFORM_MATRIX = 1,
//
// Property Name: "InterpolationMode"
// Property Type: D2D1_YCBCR_INTERPOLATION_MODE
//
D2D1_YCBCR_PROP_INTERPOLATION_MODE = 2,
D2D1_YCBCR_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "ChromaSubsampling"
/// Property Type: D2D1_YCBCR_CHROMA_SUBSAMPLING
/// </summary>
D2D1_YCBCR_PROP_CHROMA_SUBSAMPLING = 0,
/// <summary>
/// Property Name: "TransformMatrix"
/// Property Type: D2D1_MATRIX_3X2_F
/// </summary>
D2D1_YCBCR_PROP_TRANSFORM_MATRIX = 1,
/// <summary>
/// Property Name: "InterpolationMode"
/// Property Type: D2D1_YCBCR_INTERPOLATION_MODE
/// </summary>
D2D1_YCBCR_PROP_INTERPOLATION_MODE = 2,
D2D1_YCBCR_PROP_FORCE_DWORD = 0xffffffff
} D2D1_YCBCR_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_YCBCR_CHROMA_SUBSAMPLING
//
//------------------------------------------------------------------------------
typedef enum D2D1_YCBCR_CHROMA_SUBSAMPLING
{
D2D1_YCBCR_CHROMA_SUBSAMPLING_AUTO = 0,
D2D1_YCBCR_CHROMA_SUBSAMPLING_420 = 1,
D2D1_YCBCR_CHROMA_SUBSAMPLING_422 = 2,
D2D1_YCBCR_CHROMA_SUBSAMPLING_444 = 3,
D2D1_YCBCR_CHROMA_SUBSAMPLING_440 = 4,
D2D1_YCBCR_CHROMA_SUBSAMPLING_FORCE_DWORD = 0xffffffff
D2D1_YCBCR_CHROMA_SUBSAMPLING_AUTO = 0,
D2D1_YCBCR_CHROMA_SUBSAMPLING_420 = 1,
D2D1_YCBCR_CHROMA_SUBSAMPLING_422 = 2,
D2D1_YCBCR_CHROMA_SUBSAMPLING_444 = 3,
D2D1_YCBCR_CHROMA_SUBSAMPLING_440 = 4,
D2D1_YCBCR_CHROMA_SUBSAMPLING_FORCE_DWORD = 0xffffffff
} D2D1_YCBCR_CHROMA_SUBSAMPLING;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_YCBCR_INTERPOLATION_MODE
//
//------------------------------------------------------------------------------
typedef enum D2D1_YCBCR_INTERPOLATION_MODE
{
D2D1_YCBCR_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0,
D2D1_YCBCR_INTERPOLATION_MODE_LINEAR = 1,
D2D1_YCBCR_INTERPOLATION_MODE_CUBIC = 2,
D2D1_YCBCR_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = 3,
D2D1_YCBCR_INTERPOLATION_MODE_ANISOTROPIC = 4,
D2D1_YCBCR_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = 5,
D2D1_YCBCR_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff
D2D1_YCBCR_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0,
D2D1_YCBCR_INTERPOLATION_MODE_LINEAR = 1,
D2D1_YCBCR_INTERPOLATION_MODE_CUBIC = 2,
D2D1_YCBCR_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = 3,
D2D1_YCBCR_INTERPOLATION_MODE_ANISOTROPIC = 4,
D2D1_YCBCR_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = 5,
D2D1_YCBCR_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff
} D2D1_YCBCR_INTERPOLATION_MODE;
+372 -431
View File
@@ -41,553 +41,494 @@ DEFINE_GUID(CLSID_D2D1EdgeDetection, 0xEFF583CA, 0xCB07, 0x4AA9, 0xAC
DEFINE_GUID(CLSID_D2D1HighlightsShadows, 0xCADC8384, 0x323F, 0x4C7E, 0xA3, 0x61, 0x2E, 0x2B, 0x24, 0xDF, 0x6E, 0xE4);
DEFINE_GUID(CLSID_D2D1LookupTable3D, 0x349E0EDA, 0x0088, 0x4A79, 0x9C, 0xA3, 0xC7, 0xE3, 0x00, 0x20, 0x20, 0x20);
#if NTDDI_VERSION >= NTDDI_WIN10_RS1
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_CONTRAST_PROP
//
// Synopsis:
// The enumeration of the Contrast effect's top level properties.
//
//------------------------------------------------------------------------------
DEFINE_GUID(CLSID_D2D1Opacity, 0x811d79a4, 0xde28, 0x4454, 0x80, 0x94, 0xc6, 0x46, 0x85, 0xf8, 0xbd, 0x4c);
DEFINE_GUID(CLSID_D2D1AlphaMask, 0xc80ecff0, 0x3fd5, 0x4f05, 0x83, 0x28, 0xc5, 0xd1, 0x72, 0x4b, 0x4f, 0x0a);
DEFINE_GUID(CLSID_D2D1CrossFade, 0x12f575e8, 0x4db1, 0x485f, 0x9a, 0x84, 0x03, 0xa0, 0x7d, 0xd3, 0x82, 0x9f);
DEFINE_GUID(CLSID_D2D1Tint, 0x36312b17, 0xf7dd, 0x4014, 0x91, 0x5d, 0xff, 0xca, 0x76, 0x8c, 0xf2, 0x11);
#endif // #if NTDDI_VERSION >= NTDDI_WIN10_RS1
/// <summary>
/// The enumeration of the Contrast effect's top level properties.
/// </summary>
typedef enum D2D1_CONTRAST_PROP
{
//
// Property Name: "Contrast"
// Property Type: FLOAT
//
D2D1_CONTRAST_PROP_CONTRAST = 0,
//
// Property Name: "ClampInput"
// Property Type: BOOL
//
D2D1_CONTRAST_PROP_CLAMP_INPUT = 1,
D2D1_CONTRAST_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "Contrast"
/// Property Type: FLOAT
/// </summary>
D2D1_CONTRAST_PROP_CONTRAST = 0,
/// <summary>
/// Property Name: "ClampInput"
/// Property Type: BOOL
/// </summary>
D2D1_CONTRAST_PROP_CLAMP_INPUT = 1,
D2D1_CONTRAST_PROP_FORCE_DWORD = 0xffffffff
} D2D1_CONTRAST_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_RGBTOHUE_PROP
//
// Synopsis:
// The enumeration of the RgbToHue effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the RgbToHue effect's top level properties.
/// </summary>
typedef enum D2D1_RGBTOHUE_PROP
{
//
// Property Name: "OutputColorSpace"
// Property Type: D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE
//
D2D1_RGBTOHUE_PROP_OUTPUT_COLOR_SPACE = 0,
D2D1_RGBTOHUE_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "OutputColorSpace"
/// Property Type: D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE
/// </summary>
D2D1_RGBTOHUE_PROP_OUTPUT_COLOR_SPACE = 0,
D2D1_RGBTOHUE_PROP_FORCE_DWORD = 0xffffffff
} D2D1_RGBTOHUE_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE
//
//------------------------------------------------------------------------------
typedef enum D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE
{
D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_HUE_SATURATION_VALUE = 0,
D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_HUE_SATURATION_LIGHTNESS = 1,
D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_FORCE_DWORD = 0xffffffff
D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_HUE_SATURATION_VALUE = 0,
D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_HUE_SATURATION_LIGHTNESS = 1,
D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_FORCE_DWORD = 0xffffffff
} D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_HUETORGB_PROP
//
// Synopsis:
// The enumeration of the HueToRgb effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the HueToRgb effect's top level properties.
/// </summary>
typedef enum D2D1_HUETORGB_PROP
{
//
// Property Name: "InputColorSpace"
// Property Type: D2D1_HUETORGB_INPUT_COLOR_SPACE
//
D2D1_HUETORGB_PROP_INPUT_COLOR_SPACE = 0,
D2D1_HUETORGB_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "InputColorSpace"
/// Property Type: D2D1_HUETORGB_INPUT_COLOR_SPACE
/// </summary>
D2D1_HUETORGB_PROP_INPUT_COLOR_SPACE = 0,
D2D1_HUETORGB_PROP_FORCE_DWORD = 0xffffffff
} D2D1_HUETORGB_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_HUETORGB_INPUT_COLOR_SPACE
//
//------------------------------------------------------------------------------
typedef enum D2D1_HUETORGB_INPUT_COLOR_SPACE
{
D2D1_HUETORGB_INPUT_COLOR_SPACE_HUE_SATURATION_VALUE = 0,
D2D1_HUETORGB_INPUT_COLOR_SPACE_HUE_SATURATION_LIGHTNESS = 1,
D2D1_HUETORGB_INPUT_COLOR_SPACE_FORCE_DWORD = 0xffffffff
D2D1_HUETORGB_INPUT_COLOR_SPACE_HUE_SATURATION_VALUE = 0,
D2D1_HUETORGB_INPUT_COLOR_SPACE_HUE_SATURATION_LIGHTNESS = 1,
D2D1_HUETORGB_INPUT_COLOR_SPACE_FORCE_DWORD = 0xffffffff
} D2D1_HUETORGB_INPUT_COLOR_SPACE;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_CHROMAKEY_PROP
//
// Synopsis:
// The enumeration of the Chroma Key effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the Chroma Key effect's top level properties.
/// </summary>
typedef enum D2D1_CHROMAKEY_PROP
{
//
// Property Name: "Color"
// Property Type: D2D1_VECTOR_3F
//
D2D1_CHROMAKEY_PROP_COLOR = 0,
//
// Property Name: "Tolerance"
// Property Type: FLOAT
//
D2D1_CHROMAKEY_PROP_TOLERANCE = 1,
//
// Property Name: "InvertAlpha"
// Property Type: BOOL
//
D2D1_CHROMAKEY_PROP_INVERT_ALPHA = 2,
//
// Property Name: "Feather"
// Property Type: BOOL
//
D2D1_CHROMAKEY_PROP_FEATHER = 3,
D2D1_CHROMAKEY_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "Color"
/// Property Type: D2D1_VECTOR_3F
/// </summary>
D2D1_CHROMAKEY_PROP_COLOR = 0,
/// <summary>
/// Property Name: "Tolerance"
/// Property Type: FLOAT
/// </summary>
D2D1_CHROMAKEY_PROP_TOLERANCE = 1,
/// <summary>
/// Property Name: "InvertAlpha"
/// Property Type: BOOL
/// </summary>
D2D1_CHROMAKEY_PROP_INVERT_ALPHA = 2,
/// <summary>
/// Property Name: "Feather"
/// Property Type: BOOL
/// </summary>
D2D1_CHROMAKEY_PROP_FEATHER = 3,
D2D1_CHROMAKEY_PROP_FORCE_DWORD = 0xffffffff
} D2D1_CHROMAKEY_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_EMBOSS_PROP
//
// Synopsis:
// The enumeration of the Emboss effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the Emboss effect's top level properties.
/// </summary>
typedef enum D2D1_EMBOSS_PROP
{
//
// Property Name: "Height"
// Property Type: FLOAT
//
D2D1_EMBOSS_PROP_HEIGHT = 0,
//
// Property Name: "Direction"
// Property Type: FLOAT
//
D2D1_EMBOSS_PROP_DIRECTION = 1,
D2D1_EMBOSS_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "Height"
/// Property Type: FLOAT
/// </summary>
D2D1_EMBOSS_PROP_HEIGHT = 0,
/// <summary>
/// Property Name: "Direction"
/// Property Type: FLOAT
/// </summary>
D2D1_EMBOSS_PROP_DIRECTION = 1,
D2D1_EMBOSS_PROP_FORCE_DWORD = 0xffffffff
} D2D1_EMBOSS_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_EXPOSURE_PROP
//
// Synopsis:
// The enumeration of the Exposure effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the Exposure effect's top level properties.
/// </summary>
typedef enum D2D1_EXPOSURE_PROP
{
//
// Property Name: "ExposureValue"
// Property Type: FLOAT
//
D2D1_EXPOSURE_PROP_EXPOSURE_VALUE = 0,
D2D1_EXPOSURE_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "ExposureValue"
/// Property Type: FLOAT
/// </summary>
D2D1_EXPOSURE_PROP_EXPOSURE_VALUE = 0,
D2D1_EXPOSURE_PROP_FORCE_DWORD = 0xffffffff
} D2D1_EXPOSURE_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_POSTERIZE_PROP
//
// Synopsis:
// The enumeration of the Posterize effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the Posterize effect's top level properties.
/// </summary>
typedef enum D2D1_POSTERIZE_PROP
{
//
// Property Name: "RedValueCount"
// Property Type: UINT32
//
D2D1_POSTERIZE_PROP_RED_VALUE_COUNT = 0,
//
// Property Name: "GreenValueCount"
// Property Type: UINT32
//
D2D1_POSTERIZE_PROP_GREEN_VALUE_COUNT = 1,
//
// Property Name: "BlueValueCount"
// Property Type: UINT32
//
D2D1_POSTERIZE_PROP_BLUE_VALUE_COUNT = 2,
D2D1_POSTERIZE_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "RedValueCount"
/// Property Type: UINT32
/// </summary>
D2D1_POSTERIZE_PROP_RED_VALUE_COUNT = 0,
/// <summary>
/// Property Name: "GreenValueCount"
/// Property Type: UINT32
/// </summary>
D2D1_POSTERIZE_PROP_GREEN_VALUE_COUNT = 1,
/// <summary>
/// Property Name: "BlueValueCount"
/// Property Type: UINT32
/// </summary>
D2D1_POSTERIZE_PROP_BLUE_VALUE_COUNT = 2,
D2D1_POSTERIZE_PROP_FORCE_DWORD = 0xffffffff
} D2D1_POSTERIZE_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_SEPIA_PROP
//
// Synopsis:
// The enumeration of the Sepia effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the Sepia effect's top level properties.
/// </summary>
typedef enum D2D1_SEPIA_PROP
{
//
// Property Name: "Intensity"
// Property Type: FLOAT
//
D2D1_SEPIA_PROP_INTENSITY = 0,
//
// Property Name: "AlphaMode"
// Property Type: D2D1_ALPHA_MODE
//
D2D1_SEPIA_PROP_ALPHA_MODE = 1,
D2D1_SEPIA_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "Intensity"
/// Property Type: FLOAT
/// </summary>
D2D1_SEPIA_PROP_INTENSITY = 0,
/// <summary>
/// Property Name: "AlphaMode"
/// Property Type: D2D1_ALPHA_MODE
/// </summary>
D2D1_SEPIA_PROP_ALPHA_MODE = 1,
D2D1_SEPIA_PROP_FORCE_DWORD = 0xffffffff
} D2D1_SEPIA_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_SHARPEN_PROP
//
// Synopsis:
// The enumeration of the Sharpen effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the Sharpen effect's top level properties.
/// </summary>
typedef enum D2D1_SHARPEN_PROP
{
//
// Property Name: "Sharpness"
// Property Type: FLOAT
//
D2D1_SHARPEN_PROP_SHARPNESS = 0,
//
// Property Name: "Threshold"
// Property Type: FLOAT
//
D2D1_SHARPEN_PROP_THRESHOLD = 1,
D2D1_SHARPEN_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "Sharpness"
/// Property Type: FLOAT
/// </summary>
D2D1_SHARPEN_PROP_SHARPNESS = 0,
/// <summary>
/// Property Name: "Threshold"
/// Property Type: FLOAT
/// </summary>
D2D1_SHARPEN_PROP_THRESHOLD = 1,
D2D1_SHARPEN_PROP_FORCE_DWORD = 0xffffffff
} D2D1_SHARPEN_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_STRAIGHTEN_PROP
//
// Synopsis:
// The enumeration of the Straighten effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the Straighten effect's top level properties.
/// </summary>
typedef enum D2D1_STRAIGHTEN_PROP
{
//
// Property Name: "Angle"
// Property Type: FLOAT
//
D2D1_STRAIGHTEN_PROP_ANGLE = 0,
//
// Property Name: "MaintainSize"
// Property Type: BOOL
//
D2D1_STRAIGHTEN_PROP_MAINTAIN_SIZE = 1,
//
// Property Name: "ScaleMode"
// Property Type: D2D1_STRAIGHTEN_SCALE_MODE
//
D2D1_STRAIGHTEN_PROP_SCALE_MODE = 2,
D2D1_STRAIGHTEN_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "Angle"
/// Property Type: FLOAT
/// </summary>
D2D1_STRAIGHTEN_PROP_ANGLE = 0,
/// <summary>
/// Property Name: "MaintainSize"
/// Property Type: BOOL
/// </summary>
D2D1_STRAIGHTEN_PROP_MAINTAIN_SIZE = 1,
/// <summary>
/// Property Name: "ScaleMode"
/// Property Type: D2D1_STRAIGHTEN_SCALE_MODE
/// </summary>
D2D1_STRAIGHTEN_PROP_SCALE_MODE = 2,
D2D1_STRAIGHTEN_PROP_FORCE_DWORD = 0xffffffff
} D2D1_STRAIGHTEN_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_STRAIGHTEN_SCALE_MODE
//
//------------------------------------------------------------------------------
typedef enum D2D1_STRAIGHTEN_SCALE_MODE
{
D2D1_STRAIGHTEN_SCALE_MODE_NEAREST_NEIGHBOR = 0,
D2D1_STRAIGHTEN_SCALE_MODE_LINEAR = 1,
D2D1_STRAIGHTEN_SCALE_MODE_CUBIC = 2,
D2D1_STRAIGHTEN_SCALE_MODE_MULTI_SAMPLE_LINEAR = 3,
D2D1_STRAIGHTEN_SCALE_MODE_ANISOTROPIC = 4,
D2D1_STRAIGHTEN_SCALE_MODE_FORCE_DWORD = 0xffffffff
D2D1_STRAIGHTEN_SCALE_MODE_NEAREST_NEIGHBOR = 0,
D2D1_STRAIGHTEN_SCALE_MODE_LINEAR = 1,
D2D1_STRAIGHTEN_SCALE_MODE_CUBIC = 2,
D2D1_STRAIGHTEN_SCALE_MODE_MULTI_SAMPLE_LINEAR = 3,
D2D1_STRAIGHTEN_SCALE_MODE_ANISOTROPIC = 4,
D2D1_STRAIGHTEN_SCALE_MODE_FORCE_DWORD = 0xffffffff
} D2D1_STRAIGHTEN_SCALE_MODE;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_TEMPERATUREANDTINT_PROP
//
// Synopsis:
// The enumeration of the Temperature And Tint effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the Temperature And Tint effect's top level properties.
/// </summary>
typedef enum D2D1_TEMPERATUREANDTINT_PROP
{
//
// Property Name: "Temperature"
// Property Type: FLOAT
//
D2D1_TEMPERATUREANDTINT_PROP_TEMPERATURE = 0,
//
// Property Name: "Tint"
// Property Type: FLOAT
//
D2D1_TEMPERATUREANDTINT_PROP_TINT = 1,
D2D1_TEMPERATUREANDTINT_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "Temperature"
/// Property Type: FLOAT
/// </summary>
D2D1_TEMPERATUREANDTINT_PROP_TEMPERATURE = 0,
/// <summary>
/// Property Name: "Tint"
/// Property Type: FLOAT
/// </summary>
D2D1_TEMPERATUREANDTINT_PROP_TINT = 1,
D2D1_TEMPERATUREANDTINT_PROP_FORCE_DWORD = 0xffffffff
} D2D1_TEMPERATUREANDTINT_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_VIGNETTE_PROP
//
// Synopsis:
// The enumeration of the Vignette effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the Vignette effect's top level properties.
/// </summary>
typedef enum D2D1_VIGNETTE_PROP
{
//
// Property Name: "Color"
// Property Type: D2D1_VECTOR_4F
//
D2D1_VIGNETTE_PROP_COLOR = 0,
//
// Property Name: "TransitionSize"
// Property Type: FLOAT
//
D2D1_VIGNETTE_PROP_TRANSITION_SIZE = 1,
//
// Property Name: "Strength"
// Property Type: FLOAT
//
D2D1_VIGNETTE_PROP_STRENGTH = 2,
D2D1_VIGNETTE_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "Color"
/// Property Type: D2D1_VECTOR_4F
/// </summary>
D2D1_VIGNETTE_PROP_COLOR = 0,
/// <summary>
/// Property Name: "TransitionSize"
/// Property Type: FLOAT
/// </summary>
D2D1_VIGNETTE_PROP_TRANSITION_SIZE = 1,
/// <summary>
/// Property Name: "Strength"
/// Property Type: FLOAT
/// </summary>
D2D1_VIGNETTE_PROP_STRENGTH = 2,
D2D1_VIGNETTE_PROP_FORCE_DWORD = 0xffffffff
} D2D1_VIGNETTE_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_EDGEDETECTION_PROP
//
// Synopsis:
// The enumeration of the Edge Detection effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the Edge Detection effect's top level properties.
/// </summary>
typedef enum D2D1_EDGEDETECTION_PROP
{
//
// Property Name: "Strength"
// Property Type: FLOAT
//
D2D1_EDGEDETECTION_PROP_STRENGTH = 0,
//
// Property Name: "BlurRadius"
// Property Type: FLOAT
//
D2D1_EDGEDETECTION_PROP_BLUR_RADIUS = 1,
//
// Property Name: "Mode"
// Property Type: D2D1_EDGEDETECTION_MODE
//
D2D1_EDGEDETECTION_PROP_MODE = 2,
//
// Property Name: "OverlayEdges"
// Property Type: BOOL
//
D2D1_EDGEDETECTION_PROP_OVERLAY_EDGES = 3,
//
// Property Name: "AlphaMode"
// Property Type: D2D1_ALPHA_MODE
//
D2D1_EDGEDETECTION_PROP_ALPHA_MODE = 4,
D2D1_EDGEDETECTION_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "Strength"
/// Property Type: FLOAT
/// </summary>
D2D1_EDGEDETECTION_PROP_STRENGTH = 0,
/// <summary>
/// Property Name: "BlurRadius"
/// Property Type: FLOAT
/// </summary>
D2D1_EDGEDETECTION_PROP_BLUR_RADIUS = 1,
/// <summary>
/// Property Name: "Mode"
/// Property Type: D2D1_EDGEDETECTION_MODE
/// </summary>
D2D1_EDGEDETECTION_PROP_MODE = 2,
/// <summary>
/// Property Name: "OverlayEdges"
/// Property Type: BOOL
/// </summary>
D2D1_EDGEDETECTION_PROP_OVERLAY_EDGES = 3,
/// <summary>
/// Property Name: "AlphaMode"
/// Property Type: D2D1_ALPHA_MODE
/// </summary>
D2D1_EDGEDETECTION_PROP_ALPHA_MODE = 4,
D2D1_EDGEDETECTION_PROP_FORCE_DWORD = 0xffffffff
} D2D1_EDGEDETECTION_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_EDGEDETECTION_MODE
//
//------------------------------------------------------------------------------
typedef enum D2D1_EDGEDETECTION_MODE
{
D2D1_EDGEDETECTION_MODE_SOBEL = 0,
D2D1_EDGEDETECTION_MODE_PREWITT = 1,
D2D1_EDGEDETECTION_MODE_FORCE_DWORD = 0xffffffff
D2D1_EDGEDETECTION_MODE_SOBEL = 0,
D2D1_EDGEDETECTION_MODE_PREWITT = 1,
D2D1_EDGEDETECTION_MODE_FORCE_DWORD = 0xffffffff
} D2D1_EDGEDETECTION_MODE;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_HIGHLIGHTSANDSHADOWS_PROP
//
// Synopsis:
// The enumeration of the Highlights and Shadows effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the Highlights and Shadows effect's top level properties.
/// </summary>
typedef enum D2D1_HIGHLIGHTSANDSHADOWS_PROP
{
//
// Property Name: "Highlights"
// Property Type: FLOAT
//
D2D1_HIGHLIGHTSANDSHADOWS_PROP_HIGHLIGHTS = 0,
//
// Property Name: "Shadows"
// Property Type: FLOAT
//
D2D1_HIGHLIGHTSANDSHADOWS_PROP_SHADOWS = 1,
//
// Property Name: "Clarity"
// Property Type: FLOAT
//
D2D1_HIGHLIGHTSANDSHADOWS_PROP_CLARITY = 2,
//
// Property Name: "InputGamma"
// Property Type: D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA
//
D2D1_HIGHLIGHTSANDSHADOWS_PROP_INPUT_GAMMA = 3,
//
// Property Name: "MaskBlurRadius"
// Property Type: FLOAT
//
D2D1_HIGHLIGHTSANDSHADOWS_PROP_MASK_BLUR_RADIUS = 4,
D2D1_HIGHLIGHTSANDSHADOWS_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "Highlights"
/// Property Type: FLOAT
/// </summary>
D2D1_HIGHLIGHTSANDSHADOWS_PROP_HIGHLIGHTS = 0,
/// <summary>
/// Property Name: "Shadows"
/// Property Type: FLOAT
/// </summary>
D2D1_HIGHLIGHTSANDSHADOWS_PROP_SHADOWS = 1,
/// <summary>
/// Property Name: "Clarity"
/// Property Type: FLOAT
/// </summary>
D2D1_HIGHLIGHTSANDSHADOWS_PROP_CLARITY = 2,
/// <summary>
/// Property Name: "InputGamma"
/// Property Type: D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA
/// </summary>
D2D1_HIGHLIGHTSANDSHADOWS_PROP_INPUT_GAMMA = 3,
/// <summary>
/// Property Name: "MaskBlurRadius"
/// Property Type: FLOAT
/// </summary>
D2D1_HIGHLIGHTSANDSHADOWS_PROP_MASK_BLUR_RADIUS = 4,
D2D1_HIGHLIGHTSANDSHADOWS_PROP_FORCE_DWORD = 0xffffffff
} D2D1_HIGHLIGHTSANDSHADOWS_PROP;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA
//
//------------------------------------------------------------------------------
typedef enum D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA
{
D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA_LINEAR = 0,
D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA_SRGB = 1,
D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA_FORCE_DWORD = 0xffffffff
D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA_LINEAR = 0,
D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA_SRGB = 1,
D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA_FORCE_DWORD = 0xffffffff
} D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_LOOKUPTABLE3D_PROP
//
// Synopsis:
// The enumeration of the Lookup Table 3D effect's top level properties.
//
//------------------------------------------------------------------------------
/// <summary>
/// The enumeration of the Lookup Table 3D effect's top level properties.
/// </summary>
typedef enum D2D1_LOOKUPTABLE3D_PROP
{
//
// Property Name: "Lut"
// Property Type: IUnknown *
//
D2D1_LOOKUPTABLE3D_PROP_LUT = 0,
//
// Property Name: "AlphaMode"
// Property Type: D2D1_ALPHA_MODE
//
D2D1_LOOKUPTABLE3D_PROP_ALPHA_MODE = 1,
D2D1_LOOKUPTABLE3D_PROP_FORCE_DWORD = 0xffffffff
/// <summary>
/// Property Name: "Lut"
/// Property Type: IUnknown *
/// </summary>
D2D1_LOOKUPTABLE3D_PROP_LUT = 0,
/// <summary>
/// Property Name: "AlphaMode"
/// Property Type: D2D1_ALPHA_MODE
/// </summary>
D2D1_LOOKUPTABLE3D_PROP_ALPHA_MODE = 1,
D2D1_LOOKUPTABLE3D_PROP_FORCE_DWORD = 0xffffffff
} D2D1_LOOKUPTABLE3D_PROP;
#if NTDDI_VERSION >= NTDDI_WIN10_RS1
/// <summary>
/// The enumeration of the Opacity effect's top level properties.
/// </summary>
typedef enum D2D1_OPACITY_PROP
{
/// <summary>
/// Property Name: "Opacity"
/// Property Type: FLOAT
/// </summary>
D2D1_OPACITY_PROP_OPACITY = 0,
D2D1_OPACITY_PROP_FORCE_DWORD = 0xffffffff
} D2D1_OPACITY_PROP;
/// <summary>
/// The enumeration of the Cross Fade effect's top level properties.
/// </summary>
typedef enum D2D1_CROSSFADE_PROP
{
/// <summary>
/// Property Name: "Weight"
/// Property Type: FLOAT
/// </summary>
D2D1_CROSSFADE_PROP_WEIGHT = 0,
D2D1_CROSSFADE_PROP_FORCE_DWORD = 0xffffffff
} D2D1_CROSSFADE_PROP;
/// <summary>
/// The enumeration of the Tint effect's top level properties.
/// </summary>
typedef enum D2D1_TINT_PROP
{
/// <summary>
/// Property Name: "Color"
/// Property Type: D2D1_VECTOR_4F
/// </summary>
D2D1_TINT_PROP_COLOR = 0,
/// <summary>
/// Property Name: "ClampOutput"
/// Property Type: BOOL
/// </summary>
D2D1_TINT_PROP_CLAMP_OUTPUT = 1,
D2D1_TINT_PROP_FORCE_DWORD = 0xffffffff
} D2D1_TINT_PROP;
#endif // #if NTDDI_VERSION >= NTDDI_WIN10_RS1
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
#pragma endregion
+1 -1
View File
@@ -8,7 +8,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
/* @@MIDL_FILE_HEADING( ) */
+1 -1
View File
@@ -8,7 +8,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
/* @@MIDL_FILE_HEADING( ) */
+8 -3
View File
@@ -8,7 +8,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
/* @@MIDL_FILE_HEADING( ) */
@@ -7306,7 +7306,8 @@ enum D3D11_FEATURE
D3D11_FEATURE_D3D9_OPTIONS1 = ( D3D11_FEATURE_MARKER_SUPPORT + 1 ) ,
D3D11_FEATURE_D3D11_OPTIONS2 = ( D3D11_FEATURE_D3D9_OPTIONS1 + 1 ) ,
D3D11_FEATURE_D3D11_OPTIONS3 = ( D3D11_FEATURE_D3D11_OPTIONS2 + 1 ) ,
D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = ( D3D11_FEATURE_D3D11_OPTIONS3 + 1 )
D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = ( D3D11_FEATURE_D3D11_OPTIONS3 + 1 ) ,
D3D11_FEATURE_D3D11_OPTIONS4 = ( D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT + 1 )
} D3D11_FEATURE;
typedef struct D3D11_FEATURE_DATA_THREADING
@@ -9661,6 +9662,9 @@ DEFINE_GUID(D3D11_DECODER_PROFILE_MPEG4PT2_VLD_ADVSIMPLE_NOGMC, 0xed418a9f, 0x0
DEFINE_GUID(D3D11_DECODER_PROFILE_MPEG4PT2_VLD_ADVSIMPLE_GMC, 0xab998b5b, 0x4258,0x44a9,0x9f,0xeb,0x94,0xe5,0x97,0xa6,0xba,0xae);
DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN, 0x5b11d51b, 0x2f4c,0x4452,0xbc,0xc3,0x09,0xf2,0xa1,0x16,0x0c,0xc0);
DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10, 0x107af0e0, 0xef1a,0x4d19,0xab,0xa8,0x67,0xa1,0x63,0x07,0x3d,0x13);
DEFINE_GUID(D3D11_DECODER_PROFILE_VP9_VLD_PROFILE0, 0x463707f8, 0xa1d0, 0x4585, 0x87, 0x6d, 0x83, 0xaa, 0x6d, 0x60, 0xb8, 0x9e);
DEFINE_GUID(D3D11_DECODER_PROFILE_VP9_VLD_10BIT_PROFILE2, 0xa4c749ef, 0x6ecf, 0x48aa, 0x84, 0x48, 0x50, 0xa7, 0xa1, 0x16, 0x5f, 0xf7);
DEFINE_GUID(D3D11_DECODER_PROFILE_VP8_VLD, 0x90b899ea, 0x3a62, 0x4705, 0x88, 0xb3, 0x8d, 0xf0, 0x4b, 0x27, 0x44, 0xe7);
typedef struct D3D11_VIDEO_DECODER_DESC
{
GUID Guid;
@@ -9929,7 +9933,8 @@ enum D3D11_VIDEO_PROCESSOR_FEATURE_CAPS
D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_STREAM = 0x80,
D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_PIXEL_ASPECT_RATIO = 0x100,
D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_MIRROR = 0x200,
D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_SHADER_USAGE = 0x400
D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_SHADER_USAGE = 0x400,
D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_METADATA_HDR10 = 0x800
} D3D11_VIDEO_PROCESSOR_FEATURE_CAPS;
typedef
+1 -1
View File
@@ -8,7 +8,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
/* @@MIDL_FILE_HEADING( ) */
+1 -1
View File
@@ -8,7 +8,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
/* @@MIDL_FILE_HEADING( ) */
+1 -1
View File
@@ -8,7 +8,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
/* @@MIDL_FILE_HEADING( ) */
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -8,7 +8,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
+977 -28
View File
File diff suppressed because it is too large Load Diff
+485 -23
View File
@@ -8,7 +8,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
@@ -50,6 +50,20 @@ typedef interface ID3D12Debug ID3D12Debug;
#endif /* __ID3D12Debug_FWD_DEFINED__ */
#ifndef __ID3D12Debug1_FWD_DEFINED__
#define __ID3D12Debug1_FWD_DEFINED__
typedef interface ID3D12Debug1 ID3D12Debug1;
#endif /* __ID3D12Debug1_FWD_DEFINED__ */
#ifndef __ID3D12DebugDevice1_FWD_DEFINED__
#define __ID3D12DebugDevice1_FWD_DEFINED__
typedef interface ID3D12DebugDevice1 ID3D12DebugDevice1;
#endif /* __ID3D12DebugDevice1_FWD_DEFINED__ */
#ifndef __ID3D12DebugDevice_FWD_DEFINED__
#define __ID3D12DebugDevice_FWD_DEFINED__
typedef interface ID3D12DebugDevice ID3D12DebugDevice;
@@ -64,6 +78,13 @@ typedef interface ID3D12DebugCommandQueue ID3D12DebugCommandQueue;
#endif /* __ID3D12DebugCommandQueue_FWD_DEFINED__ */
#ifndef __ID3D12DebugCommandList1_FWD_DEFINED__
#define __ID3D12DebugCommandList1_FWD_DEFINED__
typedef interface ID3D12DebugCommandList1 ID3D12DebugCommandList1;
#endif /* __ID3D12DebugCommandList1_FWD_DEFINED__ */
#ifndef __ID3D12DebugCommandList_FWD_DEFINED__
#define __ID3D12DebugCommandList_FWD_DEFINED__
typedef interface ID3D12DebugCommandList ID3D12DebugCommandList;
@@ -176,18 +197,106 @@ EXTERN_C const IID IID_ID3D12Debug;
#endif /* __ID3D12Debug_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12sdklayers_0000_0001 */
#ifndef __ID3D12Debug1_INTERFACE_DEFINED__
#define __ID3D12Debug1_INTERFACE_DEFINED__
/* interface ID3D12Debug1 */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_ID3D12Debug1;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("affaa4ca-63fe-4d8e-b8ad-159000af4304")
ID3D12Debug1 : public IUnknown
{
public:
virtual void STDMETHODCALLTYPE EnableDebugLayer( void) = 0;
virtual void STDMETHODCALLTYPE SetEnableGPUBasedValidation(
BOOL Enable) = 0;
virtual void STDMETHODCALLTYPE SetEnableSynchronizedCommandQueueValidation(
BOOL Enable) = 0;
};
#else /* C style interface */
typedef struct ID3D12Debug1Vtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ID3D12Debug1 * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
ID3D12Debug1 * This);
ULONG ( STDMETHODCALLTYPE *Release )(
ID3D12Debug1 * This);
void ( STDMETHODCALLTYPE *EnableDebugLayer )(
ID3D12Debug1 * This);
void ( STDMETHODCALLTYPE *SetEnableGPUBasedValidation )(
ID3D12Debug1 * This,
BOOL Enable);
void ( STDMETHODCALLTYPE *SetEnableSynchronizedCommandQueueValidation )(
ID3D12Debug1 * This,
BOOL Enable);
END_INTERFACE
} ID3D12Debug1Vtbl;
interface ID3D12Debug1
{
CONST_VTBL struct ID3D12Debug1Vtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ID3D12Debug1_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ID3D12Debug1_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ID3D12Debug1_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ID3D12Debug1_EnableDebugLayer(This) \
( (This)->lpVtbl -> EnableDebugLayer(This) )
#define ID3D12Debug1_SetEnableGPUBasedValidation(This,Enable) \
( (This)->lpVtbl -> SetEnableGPUBasedValidation(This,Enable) )
#define ID3D12Debug1_SetEnableSynchronizedCommandQueueValidation(This,Enable) \
( (This)->lpVtbl -> SetEnableSynchronizedCommandQueueValidation(This,Enable) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ID3D12Debug1_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12sdklayers_0000_0002 */
/* [local] */
typedef
enum D3D12_DEBUG_FEATURE
{
D3D12_DEBUG_FEATURE_NONE = 0,
D3D12_DEBUG_FEATURE_TREAT_BUNDLE_AS_DRAW = 0x1,
D3D12_DEBUG_FEATURE_TREAT_BUNDLE_AS_DISPATCH = 0x2
} D3D12_DEBUG_FEATURE;
DEFINE_ENUM_FLAG_OPERATORS( D3D12_DEBUG_FEATURE );
typedef
enum D3D12_RLDO_FLAGS
{
@@ -198,10 +307,163 @@ enum D3D12_RLDO_FLAGS
} D3D12_RLDO_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(D3D12_RLDO_FLAGS)
typedef
enum D3D12_DEBUG_DEVICE_PARAMETER_TYPE
{
D3D12_DEBUG_DEVICE_PARAMETER_FEATURE_FLAGS = 0,
D3D12_DEBUG_DEVICE_PARAMETER_GPU_BASED_VALIDATION_SETTINGS = ( D3D12_DEBUG_DEVICE_PARAMETER_FEATURE_FLAGS + 1 )
} D3D12_DEBUG_DEVICE_PARAMETER_TYPE;
typedef
enum D3D12_DEBUG_FEATURE
{
D3D12_DEBUG_FEATURE_NONE = 0,
D3D12_DEBUG_FEATURE_ALLOW_BEHAVIOR_CHANGING_DEBUG_AIDS = 0x1,
D3D12_DEBUG_FEATURE_CONSERVATIVE_RESOURCE_STATE_TRACKING = 0x2,
D3D12_DEBUG_FEATURE_DISABLE_VIRTUALIZED_BUNDLES_VALIDATION = 0x4,
D3D12_DEBUG_FEATURE_VALID_MASK = ( ( D3D12_DEBUG_FEATURE_ALLOW_BEHAVIOR_CHANGING_DEBUG_AIDS | D3D12_DEBUG_FEATURE_CONSERVATIVE_RESOURCE_STATE_TRACKING ) | D3D12_DEBUG_FEATURE_DISABLE_VIRTUALIZED_BUNDLES_VALIDATION )
} D3D12_DEBUG_FEATURE;
DEFINE_ENUM_FLAG_OPERATORS(D3D12_DEBUG_FEATURE)
typedef
enum D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE
{
D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_NONE = 0,
D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_STATE_TRACKING_ONLY = ( D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_NONE + 1 ) ,
D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_UNGUARDED_VALIDATION = ( D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_STATE_TRACKING_ONLY + 1 ) ,
D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_GUARDED_VALIDATION = ( D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_UNGUARDED_VALIDATION + 1 ) ,
NUM_D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODES = ( D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_GUARDED_VALIDATION + 1 )
} D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE;
typedef
enum D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS
{
D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAG_NONE = 0,
D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAG_FRONT_LOAD_CREATE_TRACKING_ONLY_SHADERS = 0x1,
D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAG_FRONT_LOAD_CREATE_UNGUARDED_VALIDATION_SHADERS = 0x2,
D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAG_FRONT_LOAD_CREATE_GUARDED_VALIDATION_SHADERS = 0x4,
D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS_VALID_MASK = 0x7
} D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS)
typedef struct D3D12_DEBUG_DEVICE_GPU_BASED_VALIDATION_SETTINGS
{
UINT MaxMessagesPerCommandList;
D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE DefaultShaderPatchMode;
D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS PipelineStateCreateFlags;
} D3D12_DEBUG_DEVICE_GPU_BASED_VALIDATION_SETTINGS;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0001_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0001_v0_0_s_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0002_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0002_v0_0_s_ifspec;
#ifndef __ID3D12DebugDevice1_INTERFACE_DEFINED__
#define __ID3D12DebugDevice1_INTERFACE_DEFINED__
/* interface ID3D12DebugDevice1 */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_ID3D12DebugDevice1;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("a9b71770-d099-4a65-a698-3dee10020f88")
ID3D12DebugDevice1 : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE SetDebugParameter(
D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type,
_In_reads_bytes_(DataSize) const void *pData,
UINT DataSize) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDebugParameter(
D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type,
_Out_writes_bytes_(DataSize) void *pData,
UINT DataSize) = 0;
virtual HRESULT STDMETHODCALLTYPE ReportLiveDeviceObjects(
D3D12_RLDO_FLAGS Flags) = 0;
};
#else /* C style interface */
typedef struct ID3D12DebugDevice1Vtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ID3D12DebugDevice1 * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
ID3D12DebugDevice1 * This);
ULONG ( STDMETHODCALLTYPE *Release )(
ID3D12DebugDevice1 * This);
HRESULT ( STDMETHODCALLTYPE *SetDebugParameter )(
ID3D12DebugDevice1 * This,
D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type,
_In_reads_bytes_(DataSize) const void *pData,
UINT DataSize);
HRESULT ( STDMETHODCALLTYPE *GetDebugParameter )(
ID3D12DebugDevice1 * This,
D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type,
_Out_writes_bytes_(DataSize) void *pData,
UINT DataSize);
HRESULT ( STDMETHODCALLTYPE *ReportLiveDeviceObjects )(
ID3D12DebugDevice1 * This,
D3D12_RLDO_FLAGS Flags);
END_INTERFACE
} ID3D12DebugDevice1Vtbl;
interface ID3D12DebugDevice1
{
CONST_VTBL struct ID3D12DebugDevice1Vtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ID3D12DebugDevice1_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ID3D12DebugDevice1_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ID3D12DebugDevice1_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ID3D12DebugDevice1_SetDebugParameter(This,Type,pData,DataSize) \
( (This)->lpVtbl -> SetDebugParameter(This,Type,pData,DataSize) )
#define ID3D12DebugDevice1_GetDebugParameter(This,Type,pData,DataSize) \
( (This)->lpVtbl -> GetDebugParameter(This,Type,pData,DataSize) )
#define ID3D12DebugDevice1_ReportLiveDeviceObjects(This,Flags) \
( (This)->lpVtbl -> ReportLiveDeviceObjects(This,Flags) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ID3D12DebugDevice1_INTERFACE_DEFINED__ */
#ifndef __ID3D12DebugDevice_INTERFACE_DEFINED__
#define __ID3D12DebugDevice_INTERFACE_DEFINED__
@@ -300,14 +562,14 @@ EXTERN_C const IID IID_ID3D12DebugDevice;
#endif /* __ID3D12DebugDevice_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12sdklayers_0000_0002 */
/* interface __MIDL_itf_d3d12sdklayers_0000_0004 */
/* [local] */
DEFINE_GUID(DXGI_DEBUG_D3D12, 0xcf59a98c, 0xa950, 0x4326, 0x91, 0xef, 0x9b, 0xba, 0xa1, 0x7b, 0xfd, 0x95);
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0002_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0002_v0_0_s_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0004_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0004_v0_0_s_ifspec;
#ifndef __ID3D12DebugCommandQueue_INTERFACE_DEFINED__
#define __ID3D12DebugCommandQueue_INTERFACE_DEFINED__
@@ -392,6 +654,136 @@ EXTERN_C const IID IID_ID3D12DebugCommandQueue;
#endif /* __ID3D12DebugCommandQueue_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12sdklayers_0000_0005 */
/* [local] */
typedef
enum D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE
{
D3D12_DEBUG_COMMAND_LIST_PARAMETER_GPU_BASED_VALIDATION_SETTINGS = 0
} D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE;
typedef struct D3D12_DEBUG_COMMAND_LIST_GPU_BASED_VALIDATION_SETTINGS
{
D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE ShaderPatchMode;
} D3D12_DEBUG_COMMAND_LIST_GPU_BASED_VALIDATION_SETTINGS;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0005_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0005_v0_0_s_ifspec;
#ifndef __ID3D12DebugCommandList1_INTERFACE_DEFINED__
#define __ID3D12DebugCommandList1_INTERFACE_DEFINED__
/* interface ID3D12DebugCommandList1 */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_ID3D12DebugCommandList1;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("102ca951-311b-4b01-b11f-ecb83e061b37")
ID3D12DebugCommandList1 : public IUnknown
{
public:
virtual BOOL STDMETHODCALLTYPE AssertResourceState(
_In_ ID3D12Resource *pResource,
UINT Subresource,
UINT State) = 0;
virtual HRESULT STDMETHODCALLTYPE SetDebugParameter(
D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type,
_In_reads_bytes_(DataSize) const void *pData,
UINT DataSize) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDebugParameter(
D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type,
_Out_writes_bytes_(DataSize) void *pData,
UINT DataSize) = 0;
};
#else /* C style interface */
typedef struct ID3D12DebugCommandList1Vtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ID3D12DebugCommandList1 * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
ID3D12DebugCommandList1 * This);
ULONG ( STDMETHODCALLTYPE *Release )(
ID3D12DebugCommandList1 * This);
BOOL ( STDMETHODCALLTYPE *AssertResourceState )(
ID3D12DebugCommandList1 * This,
_In_ ID3D12Resource *pResource,
UINT Subresource,
UINT State);
HRESULT ( STDMETHODCALLTYPE *SetDebugParameter )(
ID3D12DebugCommandList1 * This,
D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type,
_In_reads_bytes_(DataSize) const void *pData,
UINT DataSize);
HRESULT ( STDMETHODCALLTYPE *GetDebugParameter )(
ID3D12DebugCommandList1 * This,
D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type,
_Out_writes_bytes_(DataSize) void *pData,
UINT DataSize);
END_INTERFACE
} ID3D12DebugCommandList1Vtbl;
interface ID3D12DebugCommandList1
{
CONST_VTBL struct ID3D12DebugCommandList1Vtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ID3D12DebugCommandList1_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ID3D12DebugCommandList1_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ID3D12DebugCommandList1_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ID3D12DebugCommandList1_AssertResourceState(This,pResource,Subresource,State) \
( (This)->lpVtbl -> AssertResourceState(This,pResource,Subresource,State) )
#define ID3D12DebugCommandList1_SetDebugParameter(This,Type,pData,DataSize) \
( (This)->lpVtbl -> SetDebugParameter(This,Type,pData,DataSize) )
#define ID3D12DebugCommandList1_GetDebugParameter(This,Type,pData,DataSize) \
( (This)->lpVtbl -> GetDebugParameter(This,Type,pData,DataSize) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ID3D12DebugCommandList1_INTERFACE_DEFINED__ */
#ifndef __ID3D12DebugCommandList_INTERFACE_DEFINED__
#define __ID3D12DebugCommandList_INTERFACE_DEFINED__
@@ -493,7 +885,7 @@ EXTERN_C const IID IID_ID3D12DebugCommandList;
#endif /* __ID3D12DebugCommandList_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12sdklayers_0000_0004 */
/* interface __MIDL_itf_d3d12sdklayers_0000_0007 */
/* [local] */
typedef
@@ -1459,7 +1851,74 @@ enum D3D12_MESSAGE_ID
D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE = ( D3D12_MESSAGE_ID_MAP_INVALID_NULLRANGE + 1 ) ,
D3D12_MESSAGE_ID_NO_GRAPHICS_API_SUPPORT = ( D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE + 1 ) ,
D3D12_MESSAGE_ID_NO_COMPUTE_API_SUPPORT = ( D3D12_MESSAGE_ID_NO_GRAPHICS_API_SUPPORT + 1 ) ,
D3D12_MESSAGE_ID_D3D12_MESSAGES_END = ( D3D12_MESSAGE_ID_NO_COMPUTE_API_SUPPORT + 1 )
D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_RESOURCE_FLAGS_NOT_SUPPORTED = ( D3D12_MESSAGE_ID_NO_COMPUTE_API_SUPPORT + 1 ) ,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_ROOT_ARGUMENT_UNINITIALIZED = ( D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_RESOURCE_FLAGS_NOT_SUPPORTED + 1 ) ,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_HEAP_INDEX_OUT_OF_BOUNDS = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_ROOT_ARGUMENT_UNINITIALIZED + 1 ) ,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_TABLE_REGISTER_INDEX_OUT_OF_BOUNDS = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_HEAP_INDEX_OUT_OF_BOUNDS + 1 ) ,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_UNINITIALIZED = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_TABLE_REGISTER_INDEX_OUT_OF_BOUNDS + 1 ) ,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_TYPE_MISMATCH = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_UNINITIALIZED + 1 ) ,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_SRV_RESOURCE_DIMENSION_MISMATCH = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_TYPE_MISMATCH + 1 ) ,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UAV_RESOURCE_DIMENSION_MISMATCH = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_SRV_RESOURCE_DIMENSION_MISMATCH + 1 ) ,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INCOMPATIBLE_RESOURCE_STATE = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UAV_RESOURCE_DIMENSION_MISMATCH + 1 ) ,
D3D12_MESSAGE_ID_COPYRESOURCE_NULLDST = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INCOMPATIBLE_RESOURCE_STATE + 1 ) ,
D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDDSTRESOURCE = ( D3D12_MESSAGE_ID_COPYRESOURCE_NULLDST + 1 ) ,
D3D12_MESSAGE_ID_COPYRESOURCE_NULLSRC = ( D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDDSTRESOURCE + 1 ) ,
D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDSRCRESOURCE = ( D3D12_MESSAGE_ID_COPYRESOURCE_NULLSRC + 1 ) ,
D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_NULLDST = ( D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDSRCRESOURCE + 1 ) ,
D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALIDDSTRESOURCE = ( D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_NULLDST + 1 ) ,
D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_NULLSRC = ( D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALIDDSTRESOURCE + 1 ) ,
D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALIDSRCRESOURCE = ( D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_NULLSRC + 1 ) ,
D3D12_MESSAGE_ID_PIPELINE_STATE_TYPE_MISMATCH = ( D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALIDSRCRESOURCE + 1 ) ,
D3D12_MESSAGE_ID_COMMAND_LIST_DISPATCH_ROOT_SIGNATURE_NOT_SET = ( D3D12_MESSAGE_ID_PIPELINE_STATE_TYPE_MISMATCH + 1 ) ,
D3D12_MESSAGE_ID_COMMAND_LIST_DISPATCH_ROOT_SIGNATURE_MISMATCH = ( D3D12_MESSAGE_ID_COMMAND_LIST_DISPATCH_ROOT_SIGNATURE_NOT_SET + 1 ) ,
D3D12_MESSAGE_ID_RESOURCE_BARRIER_ZERO_BARRIERS = ( D3D12_MESSAGE_ID_COMMAND_LIST_DISPATCH_ROOT_SIGNATURE_MISMATCH + 1 ) ,
D3D12_MESSAGE_ID_BEGIN_END_EVENT_MISMATCH = ( D3D12_MESSAGE_ID_RESOURCE_BARRIER_ZERO_BARRIERS + 1 ) ,
D3D12_MESSAGE_ID_RESOURCE_BARRIER_POSSIBLE_BEFORE_AFTER_MISMATCH = ( D3D12_MESSAGE_ID_BEGIN_END_EVENT_MISMATCH + 1 ) ,
D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_BEGIN_END = ( D3D12_MESSAGE_ID_RESOURCE_BARRIER_POSSIBLE_BEFORE_AFTER_MISMATCH + 1 ) ,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INVALID_RESOURCE = ( D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_BEGIN_END + 1 ) ,
D3D12_MESSAGE_ID_USE_OF_ZERO_REFCOUNT_OBJECT = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INVALID_RESOURCE + 1 ) ,
D3D12_MESSAGE_ID_OBJECT_EVICTED_WHILE_STILL_IN_USE = ( D3D12_MESSAGE_ID_USE_OF_ZERO_REFCOUNT_OBJECT + 1 ) ,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_ROOT_DESCRIPTOR_ACCESS_OUT_OF_BOUNDS = ( D3D12_MESSAGE_ID_OBJECT_EVICTED_WHILE_STILL_IN_USE + 1 ) ,
D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_INVALIDLIBRARYBLOB = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_ROOT_DESCRIPTOR_ACCESS_OUT_OF_BOUNDS + 1 ) ,
D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_DRIVERVERSIONMISMATCH = ( D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_INVALIDLIBRARYBLOB + 1 ) ,
D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_ADAPTERVERSIONMISMATCH = ( D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_DRIVERVERSIONMISMATCH + 1 ) ,
D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_UNSUPPORTED = ( D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_ADAPTERVERSIONMISMATCH + 1 ) ,
D3D12_MESSAGE_ID_CREATE_PIPELINELIBRARY = ( D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_UNSUPPORTED + 1 ) ,
D3D12_MESSAGE_ID_LIVE_PIPELINELIBRARY = ( D3D12_MESSAGE_ID_CREATE_PIPELINELIBRARY + 1 ) ,
D3D12_MESSAGE_ID_DESTROY_PIPELINELIBRARY = ( D3D12_MESSAGE_ID_LIVE_PIPELINELIBRARY + 1 ) ,
D3D12_MESSAGE_ID_STOREPIPELINE_NONAME = ( D3D12_MESSAGE_ID_DESTROY_PIPELINELIBRARY + 1 ) ,
D3D12_MESSAGE_ID_STOREPIPELINE_DUPLICATENAME = ( D3D12_MESSAGE_ID_STOREPIPELINE_NONAME + 1 ) ,
D3D12_MESSAGE_ID_LOADPIPELINE_NAMENOTFOUND = ( D3D12_MESSAGE_ID_STOREPIPELINE_DUPLICATENAME + 1 ) ,
D3D12_MESSAGE_ID_LOADPIPELINE_INVALIDDESC = ( D3D12_MESSAGE_ID_LOADPIPELINE_NAMENOTFOUND + 1 ) ,
D3D12_MESSAGE_ID_PIPELINELIBRARY_SERIALIZE_NOTENOUGHMEMORY = ( D3D12_MESSAGE_ID_LOADPIPELINE_INVALIDDESC + 1 ) ,
D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_OUTPUT_RT_OUTPUT_MISMATCH = ( D3D12_MESSAGE_ID_PIPELINELIBRARY_SERIALIZE_NOTENOUGHMEMORY + 1 ) ,
D3D12_MESSAGE_ID_SETEVENTONMULTIPLEFENCECOMPLETION_INVALIDFLAGS = ( D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_OUTPUT_RT_OUTPUT_MISMATCH + 1 ) ,
D3D12_MESSAGE_ID_CREATE_QUEUE_VIDEO_NOT_SUPPORTED = ( D3D12_MESSAGE_ID_SETEVENTONMULTIPLEFENCECOMPLETION_INVALIDFLAGS + 1 ) ,
D3D12_MESSAGE_ID_CREATE_COMMAND_ALLOCATOR_VIDEO_NOT_SUPPORTED = ( D3D12_MESSAGE_ID_CREATE_QUEUE_VIDEO_NOT_SUPPORTED + 1 ) ,
D3D12_MESSAGE_ID_CREATEQUERY_HEAP_VIDEO_DECODE_STATISTICS_NOT_SUPPORTED = ( D3D12_MESSAGE_ID_CREATE_COMMAND_ALLOCATOR_VIDEO_NOT_SUPPORTED + 1 ) ,
D3D12_MESSAGE_ID_CREATE_VIDEOCOMMANDLIST = ( D3D12_MESSAGE_ID_CREATEQUERY_HEAP_VIDEO_DECODE_STATISTICS_NOT_SUPPORTED + 1 ) ,
D3D12_MESSAGE_ID_CREATE_VIDEODECODER = ( D3D12_MESSAGE_ID_CREATE_VIDEOCOMMANDLIST + 1 ) ,
D3D12_MESSAGE_ID_CREATE_VIDEODECODESTREAM = ( D3D12_MESSAGE_ID_CREATE_VIDEODECODER + 1 ) ,
D3D12_MESSAGE_ID_LIVE_VIDEOCOMMANDLIST = ( D3D12_MESSAGE_ID_CREATE_VIDEODECODESTREAM + 1 ) ,
D3D12_MESSAGE_ID_LIVE_VIDEODECODER = ( D3D12_MESSAGE_ID_LIVE_VIDEOCOMMANDLIST + 1 ) ,
D3D12_MESSAGE_ID_LIVE_VIDEODECODESTREAM = ( D3D12_MESSAGE_ID_LIVE_VIDEODECODER + 1 ) ,
D3D12_MESSAGE_ID_DESTROY_VIDEOCOMMANDLIST = ( D3D12_MESSAGE_ID_LIVE_VIDEODECODESTREAM + 1 ) ,
D3D12_MESSAGE_ID_DESTROY_VIDEODECODER = ( D3D12_MESSAGE_ID_DESTROY_VIDEOCOMMANDLIST + 1 ) ,
D3D12_MESSAGE_ID_DESTROY_VIDEODECODESTREAM = ( D3D12_MESSAGE_ID_DESTROY_VIDEODECODER + 1 ) ,
D3D12_MESSAGE_ID_DECODE_FRAME_INVALID_PARAMETERS = ( D3D12_MESSAGE_ID_DESTROY_VIDEODECODESTREAM + 1 ) ,
D3D12_MESSAGE_ID_DEPRECATED_API = ( D3D12_MESSAGE_ID_DECODE_FRAME_INVALID_PARAMETERS + 1 ) ,
D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_COMMAND_LIST_TYPE = ( D3D12_MESSAGE_ID_DEPRECATED_API + 1 ) ,
D3D12_MESSAGE_ID_COMMAND_LIST_DESCRIPTOR_TABLE_NOT_SET = ( D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_COMMAND_LIST_TYPE + 1 ) ,
D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_CONSTANT_BUFFER_VIEW_NOT_SET = ( D3D12_MESSAGE_ID_COMMAND_LIST_DESCRIPTOR_TABLE_NOT_SET + 1 ) ,
D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_SHADER_RESOURCE_VIEW_NOT_SET = ( D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_CONSTANT_BUFFER_VIEW_NOT_SET + 1 ) ,
D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_UNORDERED_ACCESS_VIEW_NOT_SET = ( D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_SHADER_RESOURCE_VIEW_NOT_SET + 1 ) ,
D3D12_MESSAGE_ID_DISCARD_INVALID_SUBRESOURCE_RANGE = ( D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_UNORDERED_ACCESS_VIEW_NOT_SET + 1 ) ,
D3D12_MESSAGE_ID_DISCARD_ONE_SUBRESOURCE_FOR_MIPS_WITH_RECTS = ( D3D12_MESSAGE_ID_DISCARD_INVALID_SUBRESOURCE_RANGE + 1 ) ,
D3D12_MESSAGE_ID_DISCARD_NO_RECTS_FOR_NON_TEXTURE2D = ( D3D12_MESSAGE_ID_DISCARD_ONE_SUBRESOURCE_FOR_MIPS_WITH_RECTS + 1 ) ,
D3D12_MESSAGE_ID_COPY_ON_SAME_SUBRESOURCE = ( D3D12_MESSAGE_ID_DISCARD_NO_RECTS_FOR_NON_TEXTURE2D + 1 ) ,
D3D12_MESSAGE_ID_SETRESIDENCYPRIORITY_INVALID_PAGEABLE = ( D3D12_MESSAGE_ID_COPY_ON_SAME_SUBRESOURCE + 1 ) ,
D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UNSUPPORTED = ( D3D12_MESSAGE_ID_SETRESIDENCYPRIORITY_INVALID_PAGEABLE + 1 ) ,
D3D12_MESSAGE_ID_D3D12_MESSAGES_END = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UNSUPPORTED + 1 )
} D3D12_MESSAGE_ID;
typedef struct D3D12_MESSAGE
@@ -1490,8 +1949,8 @@ typedef struct D3D12_INFO_QUEUE_FILTER
#define D3D12_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT 1024
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0004_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0004_v0_0_s_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0007_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0007_v0_0_s_ifspec;
#ifndef __ID3D12InfoQueue_INTERFACE_DEFINED__
#define __ID3D12InfoQueue_INTERFACE_DEFINED__
@@ -1898,20 +2357,23 @@ EXTERN_C const IID IID_ID3D12InfoQueue;
#endif /* __ID3D12InfoQueue_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12sdklayers_0000_0005 */
/* interface __MIDL_itf_d3d12sdklayers_0000_0008 */
/* [local] */
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
#pragma endregion
DEFINE_GUID(IID_ID3D12Debug,0x344488b7,0x6846,0x474b,0xb9,0x89,0xf0,0x27,0x44,0x82,0x45,0xe0);
DEFINE_GUID(IID_ID3D12Debug1,0xaffaa4ca,0x63fe,0x4d8e,0xb8,0xad,0x15,0x90,0x00,0xaf,0x43,0x04);
DEFINE_GUID(IID_ID3D12DebugDevice1,0xa9b71770,0xd099,0x4a65,0xa6,0x98,0x3d,0xee,0x10,0x02,0x0f,0x88);
DEFINE_GUID(IID_ID3D12DebugDevice,0x3febd6dd,0x4973,0x4787,0x81,0x94,0xe4,0x5f,0x9e,0x28,0x92,0x3e);
DEFINE_GUID(IID_ID3D12DebugCommandQueue,0x09e0bf36,0x54ac,0x484f,0x88,0x47,0x4b,0xae,0xea,0xb6,0x05,0x3a);
DEFINE_GUID(IID_ID3D12DebugCommandList1,0x102ca951,0x311b,0x4b01,0xb1,0x1f,0xec,0xb8,0x3e,0x06,0x1b,0x37);
DEFINE_GUID(IID_ID3D12DebugCommandList,0x09e0bf36,0x54ac,0x484f,0x88,0x47,0x4b,0xae,0xea,0xb6,0x05,0x3f);
DEFINE_GUID(IID_ID3D12InfoQueue,0x0742a90b,0xc387,0x483f,0xb9,0x46,0x30,0xa7,0xe4,0xe6,0x14,0x58);
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0005_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0005_v0_0_s_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0008_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0008_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */
+123 -3
View File
@@ -3,7 +3,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
/* @@MIDL_FILE_HEADING( ) */
@@ -46,6 +46,13 @@ typedef interface ID3D10Blob ID3D10Blob;
#endif /* __ID3D10Blob_FWD_DEFINED__ */
#ifndef __ID3DDestructionNotifier_FWD_DEFINED__
#define __ID3DDestructionNotifier_FWD_DEFINED__
typedef interface ID3DDestructionNotifier ID3DDestructionNotifier;
#endif /* __ID3DDestructionNotifier_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
@@ -442,6 +449,119 @@ typedef ID3D10Blob ID3DBlob;
typedef ID3DBlob* LPD3DBLOB;
#define IID_ID3DBlob IID_ID3D10Blob
typedef void ( __stdcall *PFN_DESTRUCTION_CALLBACK )(
void *pData);
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_s_ifspec;
#ifndef __ID3DDestructionNotifier_INTERFACE_DEFINED__
#define __ID3DDestructionNotifier_INTERFACE_DEFINED__
/* interface ID3DDestructionNotifier */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_ID3DDestructionNotifier;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("a06eb39a-50da-425b-8c31-4eecd6c270f3")
ID3DDestructionNotifier : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE RegisterDestructionCallback(
/* [annotation] */
_In_ PFN_DESTRUCTION_CALLBACK callbackFn,
/* [annotation] */
_In_ void *pData,
/* [annotation] */
_Out_ UINT *pCallbackID) = 0;
virtual HRESULT STDMETHODCALLTYPE UnregisterDestructionCallback(
/* [annotation] */
_In_ UINT callbackID) = 0;
};
#else /* C style interface */
typedef struct ID3DDestructionNotifierVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ID3DDestructionNotifier * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
ID3DDestructionNotifier * This);
ULONG ( STDMETHODCALLTYPE *Release )(
ID3DDestructionNotifier * This);
HRESULT ( STDMETHODCALLTYPE *RegisterDestructionCallback )(
ID3DDestructionNotifier * This,
/* [annotation] */
_In_ PFN_DESTRUCTION_CALLBACK callbackFn,
/* [annotation] */
_In_ void *pData,
/* [annotation] */
_Out_ UINT *pCallbackID);
HRESULT ( STDMETHODCALLTYPE *UnregisterDestructionCallback )(
ID3DDestructionNotifier * This,
/* [annotation] */
_In_ UINT callbackID);
END_INTERFACE
} ID3DDestructionNotifierVtbl;
interface ID3DDestructionNotifier
{
CONST_VTBL struct ID3DDestructionNotifierVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ID3DDestructionNotifier_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ID3DDestructionNotifier_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ID3DDestructionNotifier_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ID3DDestructionNotifier_RegisterDestructionCallback(This,callbackFn,pData,pCallbackID) \
( (This)->lpVtbl -> RegisterDestructionCallback(This,callbackFn,pData,pCallbackID) )
#define ID3DDestructionNotifier_UnregisterDestructionCallback(This,callbackID) \
( (This)->lpVtbl -> UnregisterDestructionCallback(This,callbackID) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ID3DDestructionNotifier_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3dcommon_0000_0002 */
/* [local] */
typedef
enum _D3D_INCLUDE_TYPE
{
@@ -866,8 +986,8 @@ DEFINE_GUID(WKPDID_CommentStringW,0xd0149dc0,0x90e8,0x4ec8,0x81, 0x44, 0xe9, 0x0
#define D3D_COMPONENT_MASK_W 8
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_s_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0002_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0002_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */
+277 -48
View File
@@ -3,7 +3,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Abstract:
// Public API definitions for DWrite, D2D and DImage.
// Public API definitions shared by DWrite, D2D, and DImage.
//
//----------------------------------------------------------------------------
#pragma once
@@ -21,84 +21,72 @@
#define CHECKMETHOD(method) virtual DECLSPEC_NOTHROW _Must_inspect_result_ HRESULT STDMETHODCALLTYPE method
#endif
#pragma warning(push)
#pragma warning(disable:4201) // anonymous unions warning
//
// Forward declarations
//
interface IDXGISurface;
struct IDXGISurface;
//+----------------------------------------------------------------------------
//
// Enum:
// DWRITE_MEASURING_MODE
//
// Synopsis:
// The measuring method used for text layout.
//
//-------------------------------------------------------------------------------
/// <summary>
/// The measuring method used for text layout.
/// </summary>
typedef enum DWRITE_MEASURING_MODE
{
//
// Text is measured using glyph ideal metrics whose values are independent to the current display resolution.
//
/// <summary>
/// Text is measured using glyph ideal metrics whose values are independent to the current display resolution.
/// </summary>
DWRITE_MEASURING_MODE_NATURAL,
//
// Text is measured using glyph display compatible metrics whose values tuned for the current display resolution.
//
/// <summary>
/// Text is measured using glyph display compatible metrics whose values tuned for the current display resolution.
/// </summary>
DWRITE_MEASURING_MODE_GDI_CLASSIC,
//
/// <summary>
// Text is measured using the same glyph display metrics as text measured by GDI using a font
// created with CLEARTYPE_NATURAL_QUALITY.
//
/// </summary>
DWRITE_MEASURING_MODE_GDI_NATURAL
} DWRITE_MEASURING_MODE;
//+-----------------------------------------------------------------------------
//
// Enum:
// D2D1_ALPHA_MODE
//
// Synopsis:
// Qualifies how alpha is to be treated in a bitmap or render target containing
// alpha.
//
//------------------------------------------------------------------------------
/// <summary>
/// Qualifies how alpha is to be treated in a bitmap or render target containing
/// alpha.
/// </summary>
typedef enum D2D1_ALPHA_MODE
{
//
// Alpha mode should be determined implicitly. Some target surfaces do not supply
// or imply this information in which case alpha must be specified.
//
/// <summary>
/// Alpha mode should be determined implicitly. Some target surfaces do not supply
/// or imply this information in which case alpha must be specified.
/// </summary>
D2D1_ALPHA_MODE_UNKNOWN = 0,
//
// Treat the alpha as premultipled.
//
/// <summary>
/// Treat the alpha as premultipled.
/// </summary>
D2D1_ALPHA_MODE_PREMULTIPLIED = 1,
//
// Opacity is in the 'A' component only.
//
/// <summary>
/// Opacity is in the 'A' component only.
/// </summary>
D2D1_ALPHA_MODE_STRAIGHT = 2,
//
// Ignore any alpha channel information.
//
/// <summary>
/// Ignore any alpha channel information.
/// </summary>
D2D1_ALPHA_MODE_IGNORE = 3,
D2D1_ALPHA_MODE_FORCE_DWORD = 0xffffffff
} D2D1_ALPHA_MODE;
//+-----------------------------------------------------------------------------
//
// Struct:
// D2D1_PIXEL_FORMAT
//
//------------------------------------------------------------------------------
/// <summary>
/// Description of a pixel format.
/// </summary>
typedef struct D2D1_PIXEL_FORMAT
{
DXGI_FORMAT format;
@@ -106,4 +94,245 @@ typedef struct D2D1_PIXEL_FORMAT
} D2D1_PIXEL_FORMAT;
/// <summary>
/// Represents an x-coordinate and y-coordinate pair in two-dimensional space.
/// </summary>
typedef struct D2D_POINT_2U
{
UINT32 x;
UINT32 y;
} D2D_POINT_2U;
/// <summary>
/// Represents an x-coordinate and y-coordinate pair in two-dimensional space.
/// </summary>
typedef struct D2D_POINT_2F
{
FLOAT x;
FLOAT y;
} D2D_POINT_2F;
typedef POINT D2D_POINT_2L;
/// <summary>
/// A vector of 2 FLOAT values (x, y).
/// </summary>
typedef struct D2D_VECTOR_2F
{
FLOAT x;
FLOAT y;
} D2D_VECTOR_2F;
/// <summary>
/// A vector of 3 FLOAT values (x, y, z).
/// </summary>
typedef struct D2D_VECTOR_3F
{
FLOAT x;
FLOAT y;
FLOAT z;
} D2D_VECTOR_3F;
/// <summary>
/// A vector of 4 FLOAT values (x, y, z, w).
/// </summary>
typedef struct D2D_VECTOR_4F
{
FLOAT x;
FLOAT y;
FLOAT z;
FLOAT w;
} D2D_VECTOR_4F;
/// <summary>
/// Represents a rectangle defined by the coordinates of the upper-left corner
/// (left, top) and the coordinates of the lower-right corner (right, bottom).
/// </summary>
typedef struct D2D_RECT_F
{
FLOAT left;
FLOAT top;
FLOAT right;
FLOAT bottom;
} D2D_RECT_F;
/// <summary>
/// Represents a rectangle defined by the coordinates of the upper-left corner
/// (left, top) and the coordinates of the lower-right corner (right, bottom).
/// </summary>
typedef struct D2D_RECT_U
{
UINT32 left;
UINT32 top;
UINT32 right;
UINT32 bottom;
} D2D_RECT_U;
typedef RECT D2D_RECT_L;
/// <summary>
/// Stores an ordered pair of floats, typically the width and height of a rectangle.
/// </summary>
typedef struct D2D_SIZE_F
{
FLOAT width;
FLOAT height;
} D2D_SIZE_F;
/// <summary>
/// Stores an ordered pair of integers, typically the width and height of a
/// rectangle.
/// </summary>
typedef struct D2D_SIZE_U
{
UINT32 width;
UINT32 height;
} D2D_SIZE_U;
/// <summary>
/// Represents a 3-by-2 matrix.
/// </summary>
typedef struct D2D_MATRIX_3X2_F
{
union
{
struct
{
/// <summary>
/// Horizontal scaling / cosine of rotation
/// </summary>
FLOAT m11;
/// <summary>
/// Vertical shear / sine of rotation
/// </summary>
FLOAT m12;
/// <summary>
/// Horizontal shear / negative sine of rotation
/// </summary>
FLOAT m21;
/// <summary>
/// Vertical scaling / cosine of rotation
/// </summary>
FLOAT m22;
/// <summary>
/// Horizontal shift (always orthogonal regardless of rotation)
/// </summary>
FLOAT dx;
/// <summary>
/// Vertical shift (always orthogonal regardless of rotation)
/// </summary>
FLOAT dy;
};
struct
{
FLOAT _11, _12;
FLOAT _21, _22;
FLOAT _31, _32;
};
FLOAT m[3][2];
};
} D2D_MATRIX_3X2_F;
/// <summary>
/// Represents a 4-by-3 matrix.
/// </summary>
typedef struct D2D_MATRIX_4X3_F
{
union
{
struct
{
FLOAT _11, _12, _13;
FLOAT _21, _22, _23;
FLOAT _31, _32, _33;
FLOAT _41, _42, _43;
};
FLOAT m[4][3];
};
} D2D_MATRIX_4X3_F;
/// <summary>
/// Represents a 4-by-4 matrix.
/// </summary>
typedef struct D2D_MATRIX_4X4_F
{
union
{
struct
{
FLOAT _11, _12, _13, _14;
FLOAT _21, _22, _23, _24;
FLOAT _31, _32, _33, _34;
FLOAT _41, _42, _43, _44;
};
FLOAT m[4][4];
};
} D2D_MATRIX_4X4_F;
/// <summary>
/// Represents a 5-by-4 matrix.
/// </summary>
typedef struct D2D_MATRIX_5X4_F
{
union
{
struct
{
FLOAT _11, _12, _13, _14;
FLOAT _21, _22, _23, _24;
FLOAT _31, _32, _33, _34;
FLOAT _41, _42, _43, _44;
FLOAT _51, _52, _53, _54;
};
FLOAT m[5][4];
};
} D2D_MATRIX_5X4_F;
typedef D2D_POINT_2F D2D1_POINT_2F;
typedef D2D_POINT_2U D2D1_POINT_2U;
typedef D2D_POINT_2L D2D1_POINT_2L;
typedef D2D_RECT_F D2D1_RECT_F;
typedef D2D_RECT_U D2D1_RECT_U;
typedef D2D_RECT_L D2D1_RECT_L;
typedef D2D_SIZE_F D2D1_SIZE_F;
typedef D2D_SIZE_U D2D1_SIZE_U;
typedef D2D_MATRIX_3X2_F D2D1_MATRIX_3X2_F;
#pragma warning(pop)
#endif /* DCOMMON_H_INCLUDED */
+15 -11
View File
@@ -10,9 +10,7 @@
#ifndef DWRITE_H_INCLUDED
#define DWRITE_H_INCLUDED
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef DWRITE_NO_WINDOWS_H
@@ -56,7 +54,7 @@ enum DWRITE_FONT_FILE_TYPE
/// <summary>
/// OpenType font that contains a TrueType collection.
/// </summary>
DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION,
DWRITE_FONT_FILE_TYPE_OPENTYPE_COLLECTION,
/// <summary>
/// Type 1 PFM font.
@@ -76,7 +74,10 @@ enum DWRITE_FONT_FILE_TYPE
/// <summary>
/// Bitmap .FON font.
/// </summary>
DWRITE_FONT_FILE_TYPE_BITMAP
DWRITE_FONT_FILE_TYPE_BITMAP,
// The following name is obsolete, but kept as an alias to avoid breaking existing code.
DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION = DWRITE_FONT_FILE_TYPE_OPENTYPE_COLLECTION,
};
/// <summary>
@@ -97,9 +98,9 @@ enum DWRITE_FONT_FACE_TYPE
DWRITE_FONT_FACE_TYPE_TRUETYPE,
/// <summary>
/// OpenType font face that is a part of a TrueType collection.
/// OpenType font face that is a part of a TrueType or CFF collection.
/// </summary>
DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION,
DWRITE_FONT_FACE_TYPE_OPENTYPE_COLLECTION,
/// <summary>
/// A Type 1 font face.
@@ -127,7 +128,10 @@ enum DWRITE_FONT_FACE_TYPE
/// font file loaders) and the resulting font face object supports only the
/// minimum functionality necessary to render glyphs.
/// </summary>
DWRITE_FONT_FACE_TYPE_RAW_CFF
DWRITE_FONT_FACE_TYPE_RAW_CFF,
// The following name is obsolete, but kept as an alias to avoid breaking existing code.
DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION = DWRITE_FONT_FACE_TYPE_OPENTYPE_COLLECTION,
};
/// <summary>
@@ -2446,7 +2450,7 @@ enum DWRITE_NUMBER_SUBSTITUTION_METHOD
/// <summary>
/// Holds the appropriate digits and numeric punctuation for a given locale.
/// </summary>
interface DECLSPEC_UUID("14885CC9-BAB0-4f90-B6ED-5C366A2CD03D") DECLSPEC_NOVTABLE IDWriteNumberSubstitution : public IUnknown
interface DWRITE_DECLARE_INTERFACE("14885CC9-BAB0-4f90-B6ED-5C366A2CD03D") IDWriteNumberSubstitution : public IUnknown
{
};
@@ -2511,7 +2515,7 @@ struct DWRITE_SHAPING_GLYPH_PROPERTIES
/// stop prematurely and return a callback error. Rather than return E_NOTIMPL,
/// an application should stub the method and return a constant/null and S_OK.
/// </summary>
interface DECLSPEC_UUID("688e1a58-5094-47c8-adc8-fbcea60ae92b") DECLSPEC_NOVTABLE IDWriteTextAnalysisSource : public IUnknown
interface DWRITE_DECLARE_INTERFACE("688e1a58-5094-47c8-adc8-fbcea60ae92b") IDWriteTextAnalysisSource : public IUnknown
{
/// <summary>
/// Get a block of text starting at the specified text position.
@@ -2620,7 +2624,7 @@ interface DECLSPEC_UUID("688e1a58-5094-47c8-adc8-fbcea60ae92b") DECLSPEC_NOVTABL
/// state of the analysis sink, therefore a Set method call on a range
/// overwrites the previously set analysis result of the same range.
/// </summary>
interface DECLSPEC_UUID("5810cd44-0ca0-4701-b3fa-bec5182ae4f6") DECLSPEC_NOVTABLE IDWriteTextAnalysisSink : public IUnknown
interface DWRITE_DECLARE_INTERFACE("5810cd44-0ca0-4701-b3fa-bec5182ae4f6") IDWriteTextAnalysisSink : public IUnknown
{
/// <summary>
/// Report script analysis for the text range.
@@ -2918,7 +2922,7 @@ interface DWRITE_DECLARE_INTERFACE("b7e6163e-7f46-43b4-84b3-e4e6249c365d") IDWri
_In_reads_(glyphCount) UINT16 const* glyphIndices,
_In_reads_(glyphCount) DWRITE_SHAPING_GLYPH_PROPERTIES const* glyphProps,
UINT32 glyphCount,
_In_ IDWriteFontFace * fontFace,
_In_ IDWriteFontFace* fontFace,
FLOAT fontEmSize,
BOOL isSideways,
BOOL isRightToLeft,
+6 -2
View File
@@ -1101,6 +1101,8 @@ interface DWRITE_DECLARE_INTERFACE("a71efdb4-9fdb-4838-ad90-cfc3be8c3daf") IDWri
_Out_ DWRITE_FONT_METRICS1* fontMetrics
) PURE;
using IDWriteFontFace::GetMetrics;
/// <summary>
/// Gets common metrics for the font in design units.
/// These metrics are applicable to all the glyphs within a font,
@@ -1355,6 +1357,8 @@ interface DWRITE_DECLARE_INTERFACE("acd16696-8c14-4f5d-877e-fe3fc1d32738") IDWri
_Out_ DWRITE_FONT_METRICS1* fontMetrics
) PURE;
using IDWriteFont::GetMetrics;
/// <summary>
/// Gets the PANOSE values from the font, used for font selection and
/// matching.
@@ -1714,7 +1718,7 @@ interface DWRITE_DECLARE_INTERFACE("80DAD800-E21F-4E83-96CE-BFCCE500DB7C") IDWri
/// If any of these callbacks returns an error, the analysis functions will
/// stop prematurely and return a callback error.
/// </summary>
interface DECLSPEC_UUID("{639CFAD8-0FB4-4B21-A58A-067920120009}") DECLSPEC_NOVTABLE IDWriteTextAnalysisSource1 : public IDWriteTextAnalysisSource
interface DWRITE_DECLARE_INTERFACE("639CFAD8-0FB4-4B21-A58A-067920120009") IDWriteTextAnalysisSource1 : public IDWriteTextAnalysisSource
{
/// <summary>
/// The text analyzer calls back to this to get the desired glyph
@@ -1753,7 +1757,7 @@ interface DECLSPEC_UUID("{639CFAD8-0FB4-4B21-A58A-067920120009}") DECLSPEC_NOVTA
/// The interface implemented by the client to receive the
/// output of the text analyzers.
/// </summary>
interface DECLSPEC_UUID("B0D941A0-85E7-4D8B-9FD3-5CED9934482A") DECLSPEC_NOVTABLE IDWriteTextAnalysisSink1 : public IDWriteTextAnalysisSink
interface DWRITE_DECLARE_INTERFACE("B0D941A0-85E7-4D8B-9FD3-5CED9934482A") IDWriteTextAnalysisSink1 : public IDWriteTextAnalysisSink
{
/// <summary>
/// The text analyzer calls back to this to report the actual orientation
+10 -6
View File
@@ -554,8 +554,8 @@ interface DWRITE_DECLARE_INTERFACE("EFA008F9-F7A1-48BF-B05C-F224713CC0FF") IDWri
DWRITE_FONT_WEIGHT baseWeight,
DWRITE_FONT_STYLE baseStyle,
DWRITE_FONT_STRETCH baseStretch,
_Deref_out_range_(0, textLength) UINT32* mappedLength,
_COM_Outptr_ IDWriteFont** mappedFont,
_Out_range_(0, textLength) UINT32* mappedLength,
_COM_Outptr_result_maybenull_ IDWriteFont** mappedFont,
_Out_ FLOAT* scale
) PURE;
};
@@ -653,8 +653,10 @@ typedef D3DCOLORVALUE DWRITE_COLOR_F;
interface DWRITE_DECLARE_INTERFACE("29748ed6-8c9c-4a6a-be0b-d912e8538944") IDWriteFont2 : public IDWriteFont1
{
/// <summary>
/// Returns TRUE if the font contains color information (COLR and CPAL tables),
/// or FALSE if not.
/// Returns TRUE if the font contains tables that can provide color information
/// (including COLR, CPAL, SVG, CBDT, sbix tables), or FALSE if not. Note that
/// TRUE is returned even in the case when the font tables contain only grayscale
/// images.
/// </summary>
STDMETHOD_(BOOL, IsColorFont)() PURE;
};
@@ -667,8 +669,10 @@ interface DWRITE_DECLARE_INTERFACE("29748ed6-8c9c-4a6a-be0b-d912e8538944") IDWri
interface DWRITE_DECLARE_INTERFACE("d8b768ff-64bc-4e66-982b-ec8e87f693f7") IDWriteFontFace2 : public IDWriteFontFace1
{
/// <summary>
/// Returns TRUE if the font contains color information (COLR and CPAL tables),
/// or FALSE if not.
/// Returns TRUE if the font contains tables that can provide color information
/// (including COLR, CPAL, SVG, CBDT, sbix tables), or FALSE if not. Note that
/// TRUE is returned even in the case when the font tables contain only grayscale
/// images.
/// </summary>
STDMETHOD_(BOOL, IsColorFont)() PURE;
+319 -3
View File
@@ -10,9 +10,7 @@
#ifndef DWRITE_3_H_INCLUDED
#define DWRITE_3_H_INCLUDED
#if _MSC_VER > 1000
#pragma once
#endif
#include <DWrite_2.h>
@@ -1247,6 +1245,8 @@ interface DWRITE_DECLARE_INTERFACE("D37D7598-09BE-4222-A236-2081341CC1F2") IDWri
_Out_ DWRITE_GRID_FIT_MODE* gridFitMode
) PURE;
using IDWriteFontFace2::GetRecommendedRenderingMode;
/// <summary>
/// Determines whether the character is locally downloaded from the font.
/// </summary>
@@ -1740,4 +1740,320 @@ interface DWRITE_DECLARE_INTERFACE("07DDCD52-020E-4DE8-AC33-6C953D83F92D") IDWri
) PURE;
};
#endif /* DWRITE_3_H_INCLUDED */
////////////////////////////////////////////////////////////////////////////////////////////////////
#if NTDDI_VERSION >= NTDDI_WIN10_RS1
/// <summary>
/// Fonts may contain multiple drawable data formats for glyphs. These flags specify which formats
/// are supported in the font, either at a font-wide level or per glyph, and the app may use them
/// to tell DWrite which formats to return when splitting a color glyph run.
/// </summary>
enum DWRITE_GLYPH_IMAGE_FORMATS
{
/// <summary>
/// Indicates no data is available for this glyph.
/// </summary>
DWRITE_GLYPH_IMAGE_FORMATS_NONE = 0x00000000,
/// <summary>
/// The glyph has TrueType outlines.
/// </summary>
DWRITE_GLYPH_IMAGE_FORMATS_TRUETYPE = 0x00000001,
/// <summary>
/// The glyph has CFF outlines.
/// </summary>
DWRITE_GLYPH_IMAGE_FORMATS_CFF = 0x00000002,
/// <summary>
/// The glyph has multilayered COLR data.
/// </summary>
DWRITE_GLYPH_IMAGE_FORMATS_COLR = 0x00000004,
/// <summary>
/// The glyph has SVG outlines as standard XML.
/// </summary>
/// <remarks>
/// Fonts may store the content gzip'd rather than plain text,
/// indicated by the first two bytes as gzip header {0x1F 0x8B}.
/// </remarks>
DWRITE_GLYPH_IMAGE_FORMATS_SVG = 0x00000008,
/// <summary>
/// The glyph has PNG image data, with standard PNG IHDR.
/// </summary>
DWRITE_GLYPH_IMAGE_FORMATS_PNG = 0x00000010,
/// <summary>
/// The glyph has JPEG image data, with standard JIFF SOI header.
/// </summary>
DWRITE_GLYPH_IMAGE_FORMATS_JPEG = 0x00000020,
/// <summary>
/// The glyph has TIFF image data.
/// </summary>
DWRITE_GLYPH_IMAGE_FORMATS_TIFF = 0x00000040,
/// <summary>
/// The glyph has raw 32-bit premultiplied BGRA data.
/// </summary>
DWRITE_GLYPH_IMAGE_FORMATS_PREMULTIPLIED_B8G8R8A8 = 0x00000080,
};
#ifdef DEFINE_ENUM_FLAG_OPERATORS
DEFINE_ENUM_FLAG_OPERATORS(DWRITE_GLYPH_IMAGE_FORMATS);
#endif
/// <summary>
/// Represents a color glyph run. The IDWriteFactory4::TranslateColorGlyphRun
/// method returns an ordered collection of color glyph runs of varying types
/// depending on what the font supports.
/// </summary>
/// <summary>
/// For runs without any specific color, such as PNG data, the runColor field will be zero.
/// </summary>
struct DWRITE_COLOR_GLYPH_RUN1 : DWRITE_COLOR_GLYPH_RUN
{
/// <summary>
/// Type of glyph image format for this color run. Exactly one type will be set since
/// TranslateColorGlyphRun has already broken down the run into separate parts.
/// </summary>
DWRITE_GLYPH_IMAGE_FORMATS glyphImageFormat;
/// <summary>
/// Measuring mode to use for this glyph run.
/// </summary>
DWRITE_MEASURING_MODE measuringMode;
};
/// <summary>
/// Data for a single glyph from GetGlyphImageData.
/// </summary>
struct DWRITE_GLYPH_IMAGE_DATA
{
/// <summary>
/// Pointer to the glyph data, be it SVG, PNG, JPEG, TIFF.
/// </summary>
_Field_size_bytes_(imageDataSize) void const* imageData;
/// <summary>
/// Size of glyph data in bytes.
/// </summary>
UINT32 imageDataSize;
/// <summary>
/// Unique identifier for the glyph data. Clients may use this to cache a parsed/decompressed
/// version and tell whether a repeated call to the same font returns the same data.
/// </summary>
UINT32 uniqueDataId;
/// <summary>
/// Pixels per em of the returned data. For non-scalable raster data (PNG/TIFF/JPG), this can be larger
/// or smaller than requested from GetGlyphImageData when there isn't an exact match.
/// For scaling intermediate sizes, use: desired pixels per em * font em size / actual pixels per em.
/// </summary>
UINT32 pixelsPerEm;
/// <summary>
/// Size of image when the format is pixel data.
/// </summary>
D2D1_SIZE_U pixelSize;
/// <summary>
/// Left origin along the horizontal Roman baseline.
/// </summary>
D2D1_POINT_2L horizontalLeftOrigin;
/// <summary>
/// Right origin along the horizontal Roman baseline.
/// </summary>
D2D1_POINT_2L horizontalRightOrigin;
/// <summary>
/// Top origin along the vertical central baseline.
/// </summary>
D2D1_POINT_2L verticalTopOrigin;
/// <summary>
/// Bottom origin along vertical central baseline.
/// </summary>
D2D1_POINT_2L verticalBottomOrigin;
};
/// <summary>
/// Enumerator for an ordered collection of color glyph runs.
/// </summary>
interface DWRITE_DECLARE_INTERFACE("7C5F86DA-C7A1-4F05-B8E1-55A179FE5A35") IDWriteColorGlyphRunEnumerator1 : public IDWriteColorGlyphRunEnumerator
{
/// <summary>
/// Gets the current color glyph run.
/// </summary>
/// <param name="colorGlyphRun">Receives a pointer to the color
/// glyph run. The pointer remains valid until the next call to
/// MoveNext or until the interface is released.</param>
/// <returns>
/// Standard HRESULT error code. An error is returned if there is
/// no current glyph run, i.e., if MoveNext has not yet been called
/// or if the end of the sequence has been reached.
/// </returns>
STDMETHOD(GetCurrentRun)(
_Outptr_ DWRITE_COLOR_GLYPH_RUN1 const** colorGlyphRun
) PURE;
using IDWriteColorGlyphRunEnumerator::GetCurrentRun;
};
/// <summary>
/// The interface that represents an absolute reference to a font face.
/// It contains font face type, appropriate file references and face identification data.
/// Various font data such as metrics, names and glyph outlines is obtained from IDWriteFontFace.
/// </summary>
interface DWRITE_DECLARE_INTERFACE("27F2A904-4EB8-441D-9678-0563F53E3E2F") IDWriteFontFace4 : public IDWriteFontFace3
{
/// <summary>
/// Gets all the glyph image formats supported by the entire font (SVG, PNG, JPEG, ...).
/// </summary>
STDMETHOD_(DWRITE_GLYPH_IMAGE_FORMATS, GetGlyphImageFormats)() PURE;
/// <summary>
/// Gets the available image formats of a specific glyph and ppem. Glyphs often have at least TrueType
/// or CFF outlines, but they may also have SVG outlines, or they may have only bitmaps
/// with no TrueType/CFF outlines. Some image formats, notably the PNG/JPEG ones, are size
/// specific and will return no match when there isn't an entry in that size range.
/// </summary>
/// <remarks>
/// Glyph ids beyond the glyph count return DWRITE_GLYPH_IMAGE_FORMATS_NONE.
/// </remarks>
STDMETHOD(GetGlyphImageFormats)(
UINT16 glyphId,
UINT32 pixelsPerEmFirst,
UINT32 pixelsPerEmLast,
_Out_ DWRITE_GLYPH_IMAGE_FORMATS* glyphImageFormats
) PURE;
/// <summary>
/// Gets a pointer to the glyph data based on the desired image format.
/// </summary>
/// <remarks>
/// The glyphDataContext must be released via ReleaseGlyphImageData when done if the data is not empty,
/// similar to IDWriteFontFileStream::ReadFileFragment and IDWriteFontFileStream::ReleaseFileFragment.
/// The data pointer is valid so long as the IDWriteFontFace exists and ReleaseGlyphImageData has not
/// been called.
/// </remarks>
/// <remarks>
/// The DWRITE_GLYPH_IMAGE_DATA::uniqueDataId is valuable for caching purposes so that if the same
/// resource is returned more than once, an existing resource can be quickly retrieved rather than
/// needing to reparse or decompress the data.
/// </remarks>
/// <remarks>
/// The function only returns SVG or raster data - requesting TrueType/CFF/COLR data returns
/// DWRITE_E_INVALIDARG. Those must be drawn via DrawGlyphRun or queried using GetGlyphOutline instead.
/// Exactly one format may be requested or else the function returns DWRITE_E_INVALIDARG.
/// If the glyph does not have that format, the call is not an error, but the function returns empty data.
/// </remarks>
STDMETHOD(GetGlyphImageData)(
_In_ UINT16 glyphId,
UINT32 pixelsPerEm,
DWRITE_GLYPH_IMAGE_FORMATS glyphImageFormat,
_Out_ DWRITE_GLYPH_IMAGE_DATA* glyphData,
_Outptr_result_maybenull_ void** glyphDataContext
) PURE;
/// <summary>
/// Releases the table data obtained earlier from ReadGlyphData.
/// </summary>
/// <param name="glyphDataContext">Opaque context from ReadGlyphData.</param>
STDMETHOD_(void, ReleaseGlyphImageData)(
void* glyphDataContext
) PURE;
};
interface DWRITE_DECLARE_INTERFACE("4B0B5BD3-0797-4549-8AC5-FE915CC53856") IDWriteFactory4 : public IDWriteFactory3
{
/// <summary>
/// Translates a glyph run to a sequence of color glyph runs, which can be
/// rendered to produce a color representation of the original "base" run.
/// </summary>
/// <param name="baselineOriginX">Horizontal and vertical origin of the base glyph run in
/// pre-transform coordinates.</param>
/// <param name="glyphRun">Pointer to the original "base" glyph run.</param>
/// <param name="glyphRunDescription">Optional glyph run description.</param>
/// <param name="glyphImageFormats">Which data formats TranslateColorGlyphRun
/// should split the runs into.</param>
/// <param name="measuringMode">Measuring mode, needed to compute the origins
/// of each glyph.</param>
/// <param name="worldToDeviceTransform">Matrix converting from the client's
/// coordinate space to device coordinates (pixels), i.e., the world transform
/// multiplied by any DPI scaling.</param>
/// <param name="colorPaletteIndex">Zero-based index of the color palette to use.
/// Valid indices are less than the number of palettes in the font, as returned
/// by IDWriteFontFace2::GetColorPaletteCount.</param>
/// <param name="colorLayers">If the function succeeds, receives a pointer
/// to an enumerator object that can be used to obtain the color glyph runs.
/// If the base run has no color glyphs, then the output pointer is NULL
/// and the method returns DWRITE_E_NOCOLOR.</param>
/// <returns>
/// Returns DWRITE_E_NOCOLOR if the font has no color information, the glyph run
/// does not contain any color glyphs, or the specified color palette index
/// is out of range. In this case, the client should render the original glyph
/// run. Otherwise, returns a standard HRESULT error code.
/// </returns>
/// <remarks>
/// The old IDWriteFactory2::TranslateColorGlyphRun is equivalent to passing
/// DWRITE_GLYPH_IMAGE_FORMATS_TRUETYPE|CFF|COLR.
/// </remarks>
STDMETHOD(TranslateColorGlyphRun)(
D2D1_POINT_2F baselineOrigin,
_In_ DWRITE_GLYPH_RUN const* glyphRun,
_In_opt_ DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
DWRITE_GLYPH_IMAGE_FORMATS desiredGlyphImageFormats,
DWRITE_MEASURING_MODE measuringMode,
_In_opt_ DWRITE_MATRIX const* worldAndDpiTransform,
UINT32 colorPaletteIndex,
_COM_Outptr_ IDWriteColorGlyphRunEnumerator1** colorLayers
) PURE;
using IDWriteFactory2::TranslateColorGlyphRun;
/// <summary>
/// Converts glyph run placements to glyph origins.
/// </summary>
/// <returns>
/// Standard HRESULT error code.
/// </returns>
/// <remarks>
/// The transform and DPI have no affect on the origin scaling.
/// They are solely used to compute glyph advances when not supplied
/// and align glyphs in pixel aligned measuring modes.
/// </remarks>
STDMETHOD(ComputeGlyphOrigins)(
DWRITE_GLYPH_RUN const* glyphRun,
DWRITE_MEASURING_MODE measuringMode,
D2D1_POINT_2F baselineOrigin,
_In_opt_ DWRITE_MATRIX const* worldAndDpiTransform,
_Out_writes_(glyphRun->glyphCount) D2D1_POINT_2F* glyphOrigins
) PURE;
/// <summary>
/// Converts glyph run placements to glyph origins. This overload is for natural metrics, which
/// includes SVG, TrueType natural modes, and bitmap placement.
/// </summary>
STDMETHOD(ComputeGlyphOrigins)(
DWRITE_GLYPH_RUN const* glyphRun,
D2D1_POINT_2F baselineOrigin,
_Out_writes_(glyphRun->glyphCount) D2D1_POINT_2F* glyphOrigins
) PURE;
};
#endif // NTDDI_VERSION >= NTDDI_WIN10_RS1
#endif // DWRITE_3_H_INCLUDED
+4 -2
View File
@@ -3,7 +3,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
/* @@MIDL_FILE_HEADING( ) */
@@ -273,7 +273,8 @@ enum DXGI_SWAP_CHAIN_FLAG
DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER = 128,
DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO = 256,
DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO = 512,
DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED = 1024
DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED = 1024,
DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING = 2048
} DXGI_SWAP_CHAIN_FLAG;
typedef struct DXGI_SWAP_CHAIN_DESC
@@ -1684,6 +1685,7 @@ EXTERN_C const IID IID_IDXGIOutput;
#define DXGI_PRESENT_STEREO_TEMPORARY_MONO 0x00000020UL
#define DXGI_PRESENT_RESTRICT_TO_OUTPUT 0x00000040UL
#define DXGI_PRESENT_USE_DURATION 0x00000100UL
#define DXGI_PRESENT_ALLOW_TEARING 0x00000200UL
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0008_v0_0_c_ifspec;
+1 -1
View File
@@ -3,7 +3,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
/* @@MIDL_FILE_HEADING( ) */
+1 -1
View File
@@ -3,7 +3,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
/* @@MIDL_FILE_HEADING( ) */
+1 -1
View File
@@ -3,7 +3,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* File created by MIDL compiler version 8.01.0618 */
/* @@MIDL_FILE_HEADING( ) */
File diff suppressed because it is too large Load Diff
+6
View File
@@ -119,6 +119,12 @@ typedef enum DXGI_COLOR_SPACE_TYPE
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 9,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 10,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 11,
DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 = 12,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020 = 13,
DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020 = 14,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020 = 15,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020 = 16,
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020 = 17,
DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF
} DXGI_COLOR_SPACE_TYPE;
+295
View File
@@ -0,0 +1,295 @@
/*
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
sdkddkver.h
Abstract:
Master include file for versioning windows SDK/DDK.
*/
#ifndef _INC_SDKDDKVER
#define _INC_SDKDDKVER
#if (_MSC_VER >= 800)
#if (_MSC_VER >= 1200)
#pragma warning(push)
#pragma warning(disable:4668) /* #if not_defined treated as #if 0 */
#endif
#pragma warning(disable:4001) /* nonstandard extension : single line comment */
#endif
#pragma once
//
// _WIN32_WINNT version constants
//
#define _WIN32_WINNT_NT4 0x0400
#define _WIN32_WINNT_WIN2K 0x0500
#define _WIN32_WINNT_WINXP 0x0501
#define _WIN32_WINNT_WS03 0x0502
#define _WIN32_WINNT_WIN6 0x0600
#define _WIN32_WINNT_VISTA 0x0600
#define _WIN32_WINNT_WS08 0x0600
#define _WIN32_WINNT_LONGHORN 0x0600
#define _WIN32_WINNT_WIN7 0x0601
#define _WIN32_WINNT_WIN8 0x0602
#define _WIN32_WINNT_WINBLUE 0x0603
#define _WIN32_WINNT_WINTHRESHOLD 0x0A00 /* ABRACADABRA_THRESHOLD*/
#define _WIN32_WINNT_WIN10 0x0A00 /* ABRACADABRA_THRESHOLD*/
//
// _WIN32_IE_ version constants
//
#define _WIN32_IE_IE20 0x0200
#define _WIN32_IE_IE30 0x0300
#define _WIN32_IE_IE302 0x0302
#define _WIN32_IE_IE40 0x0400
#define _WIN32_IE_IE401 0x0401
#define _WIN32_IE_IE50 0x0500
#define _WIN32_IE_IE501 0x0501
#define _WIN32_IE_IE55 0x0550
#define _WIN32_IE_IE60 0x0600
#define _WIN32_IE_IE60SP1 0x0601
#define _WIN32_IE_IE60SP2 0x0603
#define _WIN32_IE_IE70 0x0700
#define _WIN32_IE_IE80 0x0800
#define _WIN32_IE_IE90 0x0900
#define _WIN32_IE_IE100 0x0A00
#define _WIN32_IE_IE110 0x0A00 /* ABRACADABRA_THRESHOLD */
//
// IE <-> OS version mapping
//
// NT4 supports IE versions 2.0 -> 6.0 SP1
#define _WIN32_IE_NT4 _WIN32_IE_IE20
#define _WIN32_IE_NT4SP1 _WIN32_IE_IE20
#define _WIN32_IE_NT4SP2 _WIN32_IE_IE20
#define _WIN32_IE_NT4SP3 _WIN32_IE_IE302
#define _WIN32_IE_NT4SP4 _WIN32_IE_IE401
#define _WIN32_IE_NT4SP5 _WIN32_IE_IE401
#define _WIN32_IE_NT4SP6 _WIN32_IE_IE50
// Win98 supports IE versions 4.01 -> 6.0 SP1
#define _WIN32_IE_WIN98 _WIN32_IE_IE401
// Win98SE supports IE versions 5.0 -> 6.0 SP1
#define _WIN32_IE_WIN98SE _WIN32_IE_IE50
// WinME supports IE versions 5.5 -> 6.0 SP1
#define _WIN32_IE_WINME _WIN32_IE_IE55
// Win2k supports IE versions 5.01 -> 6.0 SP1
#define _WIN32_IE_WIN2K _WIN32_IE_IE501
#define _WIN32_IE_WIN2KSP1 _WIN32_IE_IE501
#define _WIN32_IE_WIN2KSP2 _WIN32_IE_IE501
#define _WIN32_IE_WIN2KSP3 _WIN32_IE_IE501
#define _WIN32_IE_WIN2KSP4 _WIN32_IE_IE501
#define _WIN32_IE_XP _WIN32_IE_IE60
#define _WIN32_IE_XPSP1 _WIN32_IE_IE60SP1
#define _WIN32_IE_XPSP2 _WIN32_IE_IE60SP2
#define _WIN32_IE_WS03 0x0602
#define _WIN32_IE_WS03SP1 _WIN32_IE_IE60SP2
#define _WIN32_IE_WIN6 _WIN32_IE_IE70
#define _WIN32_IE_LONGHORN _WIN32_IE_IE70
#define _WIN32_IE_WIN7 _WIN32_IE_IE80
#define _WIN32_IE_WIN8 _WIN32_IE_IE100
#define _WIN32_IE_WINBLUE _WIN32_IE_IE100
#define _WIN32_IE_WINTHRESHOLD _WIN32_IE_IE110 /* ABRACADABRA_THRESHOLD */
#define _WIN32_IE_WIN10 _WIN32_IE_IE110 /* ABRACADABRA_THRESHOLD */
//
// NTDDI version constants
//
#define NTDDI_WIN2K 0x05000000
#define NTDDI_WIN2KSP1 0x05000100
#define NTDDI_WIN2KSP2 0x05000200
#define NTDDI_WIN2KSP3 0x05000300
#define NTDDI_WIN2KSP4 0x05000400
#define NTDDI_WINXP 0x05010000
#define NTDDI_WINXPSP1 0x05010100
#define NTDDI_WINXPSP2 0x05010200
#define NTDDI_WINXPSP3 0x05010300
#define NTDDI_WINXPSP4 0x05010400
#define NTDDI_WS03 0x05020000
#define NTDDI_WS03SP1 0x05020100
#define NTDDI_WS03SP2 0x05020200
#define NTDDI_WS03SP3 0x05020300
#define NTDDI_WS03SP4 0x05020400
#define NTDDI_WIN6 0x06000000
#define NTDDI_WIN6SP1 0x06000100
#define NTDDI_WIN6SP2 0x06000200
#define NTDDI_WIN6SP3 0x06000300
#define NTDDI_WIN6SP4 0x06000400
#define NTDDI_VISTA NTDDI_WIN6
#define NTDDI_VISTASP1 NTDDI_WIN6SP1
#define NTDDI_VISTASP2 NTDDI_WIN6SP2
#define NTDDI_VISTASP3 NTDDI_WIN6SP3
#define NTDDI_VISTASP4 NTDDI_WIN6SP4
#define NTDDI_LONGHORN NTDDI_VISTA
#define NTDDI_WS08 NTDDI_WIN6SP1
#define NTDDI_WS08SP2 NTDDI_WIN6SP2
#define NTDDI_WS08SP3 NTDDI_WIN6SP3
#define NTDDI_WS08SP4 NTDDI_WIN6SP4
#define NTDDI_WIN7 0x06010000
#define NTDDI_WIN8 0x06020000
#define NTDDI_WINBLUE 0x06030000
#define NTDDI_WINTHRESHOLD 0x0A000000 /* ABRACADABRA_THRESHOLD */
#define NTDDI_WIN10 0x0A000000 /* ABRACADABRA_THRESHOLD */
#define NTDDI_WIN10_TH2 0x0A000001 /* ABRACADABRA_WIN10_TH2 */
#define NTDDI_WIN10_RS1 0x0A000002 /* ABRACADABRA_WIN10_RS1 */
//
// masks for version macros
//
#define OSVERSION_MASK 0xFFFF0000
#define SPVERSION_MASK 0x0000FF00
#define SUBVERSION_MASK 0x000000FF
//
// macros to extract various version fields from the NTDDI version
//
#define OSVER(Version) ((Version) & OSVERSION_MASK)
#define SPVER(Version) (((Version) & SPVERSION_MASK) >> 8)
#define SUBVER(Version) (((Version) & SUBVERSION_MASK) )
#if defined(DECLSPEC_DEPRECATED_DDK)
// deprecate in 2k or later
#if (NTDDI_VERSION >= NTDDI_WIN2K)
#define DECLSPEC_DEPRECATED_DDK_WIN2K DECLSPEC_DEPRECATED_DDK
#else
#define DECLSPEC_DEPRECATED_DDK_WIN2K
#endif
// deprecate in XP or later
#if (NTDDI_VERSION >= NTDDI_WINXP)
#define DECLSPEC_DEPRECATED_DDK_WINXP DECLSPEC_DEPRECATED_DDK
#else
#define DECLSPEC_DEPRECATED_DDK_WINXP
#endif
// deprecate in WS03 or later
#if (NTDDI_VERSION >= NTDDI_WS03)
#define DECLSPEC_DEPRECATED_DDK_WIN2003 DECLSPEC_DEPRECATED_DDK
#else
#define DECLSPEC_DEPRECATED_DDK_WIN2003
#endif
// deprecate in WIN6 or later
#if (NTDDI_VERSION >= NTDDI_WIN6)
#define DECLSPEC_DEPRECATED_DDK_WIN6 DECLSPEC_DEPRECATED_DDK
#else
#define DECLSPEC_DEPRECATED_DDK_WIN6
#endif
#define DECLSPEC_DEPRECATED_DDK_LONGHORN DECLSPEC_DEPRECATED_DDK_WIN6
#endif // defined(DECLSPEC_DEPRECATED_DDK)
//
// if versions aren't already defined, default to most current
//
#define NTDDI_VERSION_FROM_WIN32_WINNT2(ver) ver##0000
#define NTDDI_VERSION_FROM_WIN32_WINNT(ver) NTDDI_VERSION_FROM_WIN32_WINNT2(ver)
#if !defined(_WIN32_WINNT) && !defined(_CHICAGO_)
#define _WIN32_WINNT 0x0A00
#endif
#ifndef NTDDI_VERSION
#ifdef _WIN32_WINNT
// set NTDDI_VERSION based on _WIN32_WINNT
#define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
#else
#define NTDDI_VERSION 0x0A000002
#endif
#endif
#ifndef WINVER
#ifdef _WIN32_WINNT
// set WINVER based on _WIN32_WINNT
#define WINVER _WIN32_WINNT
#else
#define WINVER 0x0A00
#endif
#endif
#ifndef _WIN32_IE
#ifdef _WIN32_WINNT
// set _WIN32_IE based on _WIN32_WINNT
#if (_WIN32_WINNT <= _WIN32_WINNT_NT4)
#define _WIN32_IE _WIN32_IE_IE50
#elif (_WIN32_WINNT <= _WIN32_WINNT_WIN2K)
#define _WIN32_IE _WIN32_IE_IE501
#elif (_WIN32_WINNT <= _WIN32_WINNT_WINXP)
#define _WIN32_IE _WIN32_IE_IE60
#elif (_WIN32_WINNT <= _WIN32_WINNT_WS03)
#define _WIN32_IE _WIN32_IE_WS03
#elif (_WIN32_WINNT <= _WIN32_WINNT_VISTA)
#define _WIN32_IE _WIN32_IE_LONGHORN
#elif (_WIN32_WINNT <= _WIN32_WINNT_WIN7)
#define _WIN32_IE _WIN32_IE_WIN7
#elif (_WIN32_WINNT <= _WIN32_WINNT_WIN8)
#define _WIN32_IE _WIN32_IE_WIN8
#else
#define _WIN32_IE 0x0A00
#endif
#else
#define _WIN32_IE 0x0A00
#endif
#endif
//
// Sanity check for compatible versions
//
#if defined(_WIN32_WINNT) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
#if (defined(WINVER) && (WINVER < 0x0400) && (_WIN32_WINNT > 0x0400))
#error WINVER setting conflicts with _WIN32_WINNT setting
#endif
#if (((OSVERSION_MASK & NTDDI_VERSION) == NTDDI_WIN2K) && (_WIN32_WINNT != _WIN32_WINNT_WIN2K))
#error NTDDI_VERSION setting conflicts with _WIN32_WINNT setting
#endif
#if (((OSVERSION_MASK & NTDDI_VERSION) == NTDDI_WINXP) && (_WIN32_WINNT != _WIN32_WINNT_WINXP))
#error NTDDI_VERSION setting conflicts with _WIN32_WINNT setting
#endif
#if (((OSVERSION_MASK & NTDDI_VERSION) == NTDDI_WS03) && (_WIN32_WINNT != _WIN32_WINNT_WS03))
#error NTDDI_VERSION setting conflicts with _WIN32_WINNT setting
#endif
#if (((OSVERSION_MASK & NTDDI_VERSION) == NTDDI_VISTA) && (_WIN32_WINNT != _WIN32_WINNT_VISTA))
#error NTDDI_VERSION setting conflicts with _WIN32_WINNT setting
#endif
#if ((_WIN32_WINNT < _WIN32_WINNT_WIN2K) && (_WIN32_IE > _WIN32_IE_IE60SP1))
#error _WIN32_WINNT settings conflicts with _WIN32_IE setting
#endif
#endif // defined(_WIN32_WINNT) && !defined(MIDL_PASS) && !defined(_WINRESRC_)
#if (_MSC_VER >= 800)
#if (_MSC_VER >= 1200)
#pragma warning(pop)
#else
#pragma warning(default:4001) /* nonstandard extension : single line comment */
#endif
#endif
#endif /* !_INC_SDKDDKVER */
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
-1
Submodule 3rdparty/zlib deleted from cacf7f1d4e
+10 -23
View File
@@ -1,11 +1,4 @@
cmake_minimum_required(VERSION 3.1)
option(WITH_GDB "WITH_GDB" OFF)
option(WITHOUT_LLVM "WITHOUT_LLVM" OFF)
if (WITH_GDB)
add_definitions(-DWITH_GDB_DEBUGGER)
endif()
cmake_minimum_required(VERSION 2.8.12)
set(ASMJIT_STATIC TRUE)
@@ -18,6 +11,14 @@ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
message( FATAL_ERROR "RPCS3 can only be compiled on 64-bit platforms." )
endif()
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
message( FATAL_ERROR "RPCS3 requires at least gcc-5.1." )
endif()
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 6.1)
message( FATAL_ERROR "RPCS3 can't be compiled with gcc-6.1, see #1691." )
endif()
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
@@ -40,20 +41,6 @@ option(VULKAN_PREBUILT "" OFF)
# TODO: do real installation, including copying directory structure
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${PROJECT_BINARY_DIR}/bin")
add_subdirectory( Vulkan )
add_subdirectory( rpcs3 )
include_directories(3rdparty/hidapi/hidapi)
if(APPLE)
add_subdirectory(3rdparty/hidapi/mac)
#list(APPEND LIBS hidapi)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
add_subdirectory(3rdparty/hidapi/linux)
elseif(MSVC)
add_subdirectory(3rdparty/hidapi/windows)
else()
add_subdirectory(3rdparty/hidapi/libusb)
#list(APPEND LIBS hidapi-libusb)
endif()
add_subdirectory( rsx_program_decompiler )
-20
View File
@@ -1,20 +0,0 @@
# Getting Started
Before getting started using the emulator, read the [Quickstart Guide](https://rpcs3.net/quickstart) and the [FAQ](https://rpcs3.net/faq). After reading those, if you need support, visit our [Forums](https://forums.rpcs3.net).
# Issue Reporting
**The GitHub Issue Tracker is not the place to ask for support or to submit [Game Compatibility](https://rpcs3.net/compatibility) reports.** Requests for support or incorrect reports will be closed. If you are not sure whether the issue you want to report is an actual issue that is not yet known, please use the forums to submit such report.
**Before reporting an issue:**
- Check if your system matches all the minimum requirements listed in the [Quickstart Guide](https://rpcs3.net/quickstart);
- Check if the issue is meaningful for the team (e.g. The Last of Us doesn't work is obvious and therefore useless);
- Search older issues/forum threads to see if your issue was already submitted.
- Use understandable English. It doesn't need to be perfect, but clear enough to understand your message.
- While reporting issues, don't forget to include details about your system (OS, CPU, GPU, etc.), as well as the RPCS3.log file.
Submitting your test results for Commercial Games must be done on our forums. Please read the [Game Compatibility](https://github.com/RPCS3/rpcs3/wiki/Game-Compatibility) wiki page before doing so.
# Contributing
Check the [Coding Style Guidelines](https://github.com/RPCS3/rpcs3/wiki/Coding-Style), [Roadmap](https://github.com/RPCS3/rpcs3/wiki/Roadmap) and [Developer Information](https://github.com/RPCS3/rpcs3/wiki/Developer-Information). If you have any questions, hit us up on our [Discord Server](https://discord.me/RPCS3) in the **#development** channel.
+35 -72
View File
@@ -3,104 +3,67 @@ RPCS3
[![Build Status](https://travis-ci.org/RPCS3/rpcs3.svg?branch=master)](https://travis-ci.org/RPCS3/rpcs3)
[![Build status](https://ci.appveyor.com/api/projects/status/411c4clmiohtx7eo/branch/master?svg=true)](https://ci.appveyor.com/project/rpcs3/rpcs3/branch/master)
[![Coverity Status](https://img.shields.io/coverity/scan/3960.svg)](https://scan.coverity.com/projects/3960)
The world's first open-source PlayStation 3 emulator/debugger written in C++ for Windows and Linux.
An open-source PlayStation 3 emulator/debugger written in C++.
You can find some basic information in our [**website**](https://rpcs3.net/).
For discussion about this emulator and PS3 emulation please visit our [**forums**](https://forums.rpcs3.net) and our [**Discord server**](https://discord.me/RPCS3).
You can find some basic information in the [FAQ](https://github.com/RPCS3/rpcs3/wiki/FAQ). For discussion about this emulator and PS3 emulation please visit the [official forums](http://www.emunewz.net/forum/forumdisplay.php?fid=172).
[**Support Lead Developers Nekotekina and kd-11 on Patreon**](https://www.patreon.com/Nekotekina)
Official Discord server: https://discord.me/RPCS3
Support Nekotekina on Patreon: https://www.patreon.com/Nekotekina
### Development
If you want to contribute please take a look at the [Coding Style](https://github.com/RPCS3/rpcs3/wiki/Coding-Style), [Roadmap](https://github.com/RPCS3/rpcs3/wiki/Roadmap) and [Developer Information](https://github.com/RPCS3/rpcs3/wiki/Developer-Information) pages. You should as well contact any of the developers in the forum in order to know about the current situation of the emulator.
## Development
### Dependencies
If you want to contribute please take a look at the [Coding Style](https://github.com/RPCS3/rpcs3/wiki/Coding-Style), [Roadmap](https://github.com/RPCS3/rpcs3/wiki/Roadmap) and [Developer Information](https://github.com/RPCS3/rpcs3/wiki/Developer-Information) pages. You should as well contact any of the developers in the forums or in Discord in order to know more about the current situation of the emulator.
## Dependencies
### Windows
* [Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/)
* [Visual C++ Redistributable Packages for Visual Studio 2015](http://www.microsoft.com/en-us/download/details.aspx?id=48145)
* [Cmake 3.1.0+](https://www.cmake.org/download/) (required; add to PATH)
__Windows__
* [Visual Studio 2017](https://www.visualstudio.com/downloads/)
* [Visual C++ Redistributable Packages for Visual Studio 2017](https://go.microsoft.com/fwlink/?LinkId=746572)
* [Cmake 3.1.0+](http://www.cmake.org/download/) (required; add to PATH)
* [Python 3.3+](https://www.python.org/downloads/) (required; add to PATH)
* [Qt 5.8+](https://www.qt.io/download-open-source/) (required; add QTDIR `<QtInstallFolder>\5.8\msvc2015_64\` environment variable if you do not want to use the Visual Studio Qt Plugin)
* [Visual Studio Qt Plugin](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.QtVisualStudioTools2015) (optional; see above)
### Linux
* [Qt 5.7+](https://www.qt.io/download-open-source/)
__Linux__
* GCC 5.1+ or Clang 3.5.0+ ([not GCC 6.1](https://github.com/RPCS3/rpcs3/issues/1691))
* Debian & Ubuntu: `sudo apt-get install cmake build-essential libasound2-dev libpulse-dev libopenal-dev libglew-dev zlib1g-dev libedit-dev libvulkan-dev libudev-dev git qt5-default`
* Arch: `sudo pacman -S glew openal cmake llvm qt5-base`
* Fedora: `sudo dnf install cmake glew glew-devel libatomic libudev-devel openal-devel qt5-devel vulkan-devel`
* OpenSUSE: `sudo zypper install git cmake libasound2 libpulse-devel openal-soft-devel glew-devel zlib-devel libedit-devel vulkan-devel libudev-devel libqt5-qtbase-devel libevdev-devel`
**If you have a NVIDIA GPU, you may need to install the libglvnd package.**
* Debian & Ubuntu: `sudo apt-get install cmake build-essential libopenal-dev libwxgtk3.0-dev libglew-dev zlib1g-dev libedit-dev libvulkan-dev git`
* Arch: `sudo pacman -S glew openal wxgtk cmake llvm`
### MacOS
MacOS is not supported at this moment because it doesn't meet system requirements (OpenGL 4.3)
__Mac OSX__
Mac OSX is not supported at this moment because it doesn't meet system requirements (OpenGL 4.3)
* Xcode 6+ (tested with Xcode 6.4)
* Install with Homebrew: `brew install glew llvm qt cmake`
* Install with Homebrew: `brew install glew wxwidgets`
* Remove '-framework QuickTime' from '_ldflags' in /usr/local/bin/wx-config
### Building
## Building on Windows:
To initialize the repository don't forget to execute `git submodule update --init` to pull the submodules.
### Configuring Qt
*If you're using Visual Studio 2017 without Qt plugin support (or simply dont want to use it):*
1) Add `QTDIR` environment variable and set it to `<QtInstallFolder>\5.8\msvc2015_64\` </br>
Open `rpcs3.sln`
*If you wish to use the Visual Studio plugin for Qt:* </br>
1) Go to the Qt5 menu and edit Qt5 options. Add the path to your Qt installation with compiler e.g. `C:\Qt\5.8\msvc2015_64`. </br>
2) While selecting the rpcs3qt project, go to Qt5->Project Setting and select the version you added.
### Building the projects
You may want to download precompiled [LLVM lib](https://drive.google.com/uc?export=download&id=0B8A6NaxhQAGRY2k3Q2Yya05lcm8) and extract to root rpcs3 folder (which contains `rpcs3.sln`), as well as download and extract [additional libs](https://drive.google.com/uc?export=download&id=0B8A6NaxhQAGRaHYxV3VOS2d0a0U) to `lib\%CONFIGURATION%-x64\` to speed up compilation time (unoptimised/debug libs are currently not available precompiled).
If you're not using precompiled libs, build the projects in *__BUILD_BEFORE* folder: right-click on every project > *Build*. </br></br>
`Build > Build Solution`</br>
## Building on Linux & Mac OS:
- __Windows__: </br>
1) To initialize the repository don't forget to execute `git submodule update --init` to pull the submodules. </br>
2) Open the *.SLN* file. </br>
3) Build the projects in *__BUILD_BEFORE* folder: right-click on every project > *Build*. </br>
4) Press *BUILD* > *Build Solution* or *Rebuild Solution*. </br>
- __Linux & Mac OSX__: </br>
1) `git clone https://github.com/RPCS3/rpcs3.git` </br>
2) `cd rpcs3/` </br>
3) `git submodule update --init` </br>
4) `cd ../ && mkdir rpcs3_build && cd rpcs3_build`
4) `cmake ../rpcs3/ && make GitVersion && make` </br>
4) `cmake CMakeLists.txt && make GitVersion && make` </br>
5) Run RPCS3 with `./bin/rpcs3` </br>
If you are on MacOS and want to build with brew llvm and qt don't forget to add the following environment variables
* `LLVM_DIR=/usr/local/opt/llvm/` (or wherever llvm was installed).
* `Qt5_DIR=/usr/local/opt/qt/lib/cmake/Qt5` (or wherever qt was installed).
If you are on OSX and want to build with llvm don't forget to add `-DLLVM_DIR=...` (or wherever llvm brew was installed) to cmake invocation.
When using GDB, configure it to ignore SIGSEGV signal (`handle SIGSEGV nostop noprint`).
##### CMake Build Options (Linux & Mac OSX)
## CMake Build Options (Linux & Mac OS)
- ```-DUSE_SYSTEM_LIBPNG=ON/OFF``` (default = *OFF*)
- ```-DUSE_SYSTEM_LIBPNG=ON/OFF``` (default = *OFF*) </br>
Build against the shared libpng instead of using the builtin one. libpng 1.6+ highly recommended. Try this option if you get version conflict errors or only see black game icons.
- ```-DUSE_SYSTEM_FFMPEG=ON/OFF``` (default = *OFF*)
- ```-DUSE_SYSTEM_FFMPEG=ON/OFF``` (default = *OFF*) </br>
Build against the shared ffmpeg libraries instead of using the builtin patched version. Try this if the builtin version breaks the OpenGL renderer for you.
- ```-DWITHOUT_LLVM=ON/OFF``` (default = *OFF*)
This forces RPCS3 to build without LLVM, not recommended.
- ```-DWITH_GDB=ON/OFF``` (default = *OFF*)
This Builds RPCS3 with support for debugging PS3 games using gdb.
- ```-DUSE_VULKAN=ON/OFF``` (default = *ON*)
This builds RPCS3 with Vulkan support.
## License
### License
Most files are licensed under the terms of GNU GPLv2 License, see LICENSE file for details. Some files may be licensed differently, check appropriate file headers for details.
+73
View File
@@ -0,0 +1,73 @@
#include "stdafx.h"
#include "Config.h"
#include "Emu/System.h"
#include "AutoPause.h"
cfg::bool_entry g_cfg_debug_autopause_syscall(cfg::root.misc, "Automatically pause at system call");
cfg::bool_entry g_cfg_debug_autopause_func_call(cfg::root.misc, "Automatically pause at function call");
debug::autopause& debug::autopause::get_instance()
{
// Use magic static
static autopause instance;
return instance;
}
// Load Auto Pause Configuration from file "pause.bin"
void debug::autopause::reload(void)
{
auto& instance = get_instance();
instance.m_pause_function.clear();
instance.m_pause_syscall.clear();
// TODO: better format, possibly a config entry
if (fs::file list{ fs::get_config_dir() + "pause.bin" })
{
u32 num;
size_t fmax = list.size();
size_t fcur = 0;
list.seek(0);
while (fcur <= fmax - sizeof(u32))
{
list.read(&num, sizeof(u32));
fcur += sizeof(u32);
if (num == 0xFFFFFFFF) break;
if (num < 1024)
{
instance.m_pause_syscall.emplace(num);
LOG_WARNING(HLE, "Set autopause at syscall %lld", num);
}
else
{
instance.m_pause_function.emplace(num);
LOG_WARNING(HLE, "Set autopause at function 0x%08x", num);
}
}
}
}
bool debug::autopause::pause_syscall(u64 code)
{
if (g_cfg_debug_autopause_syscall && get_instance().m_pause_syscall.count(code) != 0)
{
Emu.Pause();
LOG_SUCCESS(HLE, "Autopause triggered at syscall %lld", code);
return true;
}
return false;
}
bool debug::autopause::pause_function(u32 code)
{
if (g_cfg_debug_autopause_func_call && get_instance().m_pause_function.count(code) != 0)
{
Emu.Pause();
LOG_SUCCESS(HLE, "Autopause triggered at function 0x%08x", code);
return true;
}
return false;
}
+22
View File
@@ -0,0 +1,22 @@
#pragma once
#include <unordered_set>
// Regarded as a Debugger Enchantment
namespace debug
{
// To store the pause function/call id, and let those pause there.
// Would be with a GUI to configure those.
class autopause
{
std::unordered_set<u64> m_pause_syscall;
std::unordered_set<u32> m_pause_function;
static autopause& get_instance();
public:
static void reload();
static bool pause_syscall(u64 code);
static bool pause_function(u32 code);
};
}
+1 -11
View File
@@ -301,16 +301,6 @@ union alignas(16) v128
}
};
template <typename T, std::size_t N, std::size_t M>
struct offset32_array<v128::masked_array_t<T, N, M>>
{
template <typename Arg>
static inline u32 index32(const Arg& arg)
{
return SIZE_32(T) * (static_cast<u32>(arg) ^ static_cast<u32>(M));
}
};
inline v128 operator|(const v128& left, const v128& right)
{
return v128::fromV(_mm_or_si128(left.vi, right.vi));
@@ -470,7 +460,7 @@ struct se_storage<T, 16, 16>
static inline v128 swap(const v128& src)
{
return v128::from64(se_storage<u64>::swap(src._u64[1]), se_storage<u64>::swap(src._u64[0]));
return v128::fromV(_mm_shuffle_epi8(src.vi, _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)));
}
static inline v128 to(const T& src)
+1 -4
View File
@@ -18,9 +18,6 @@ struct bf_base
// Value mask
static constexpr utype vmask = static_cast<utype>(~utype{} >> (bitmax - bitsize));
// All ones mask
static constexpr utype mask1 = static_cast<utype>(~utype{});
protected:
type m_data;
};
@@ -39,7 +36,7 @@ struct bf_t : bf_base<T, N>
// Get bitmask of size N, at I pos
static constexpr utype data_mask()
{
return static_cast<utype>(static_cast<utype>(bf_t::mask1 >> (bf_t::bitmax - bf_t::bitsize)) << bitpos);
return static_cast<utype>(static_cast<utype>(~utype{} >> (bf_t::bitmax - bf_t::bitsize)) << bitpos);
}
// Bitfield extraction helper
-1702
View File
File diff suppressed because it is too large Load Diff
+56 -114
View File
@@ -3,13 +3,11 @@
#include "yaml-cpp/yaml.h"
#include <typeinfo>
namespace cfg
{
logs::channel cfg("CFG");
logs::channel cfg("CFG", logs::level::notice);
_base::_base(type _type)
entry_base::entry_base(type _type)
: m_type(_type)
{
if (_type != type::node)
@@ -18,41 +16,51 @@ namespace cfg
}
}
_base::_base(type _type, node* owner, const std::string& name)
entry_base::entry_base(type _type, node& owner, const std::string& name)
: m_type(_type)
{
for (const auto& pair : owner->m_nodes)
if (!owner.m_nodes.emplace(name, this).second)
{
if (pair.first == name)
{
fmt::throw_exception<std::logic_error>("Node already exists: %s" HERE, name);
}
fmt::throw_exception<std::logic_error>("Node already exists: %s" HERE, name);
}
owner->m_nodes.emplace_back(name, this);
}
bool _base::from_string(const std::string&)
entry_base& entry_base::operator[](const std::string& name) const
{
if (m_type == type::node)
{
return *static_cast<const node&>(*this).m_nodes.at(name);
}
fmt::throw_exception<std::logic_error>("Invalid node type" HERE);
}
entry_base& entry_base::operator[](const char* name) const
{
if (m_type == type::node)
{
return *static_cast<const node&>(*this).m_nodes.at(name);
}
fmt::throw_exception<std::logic_error>("Invalid node type" HERE);
}
bool entry_base::from_string(const std::string&)
{
fmt::throw_exception<std::logic_error>("from_string() purecall" HERE);
}
bool _base::from_list(std::vector<std::string>&&)
bool entry_base::from_list(std::vector<std::string>&&)
{
fmt::throw_exception<std::logic_error>("from_list() purecall" HERE);
}
// Emit YAML
static void encode(YAML::Emitter& out, const class _base& rhs);
static void encode(YAML::Emitter& out, const class entry_base& rhs);
// Incrementally load config entries from YAML::Node.
// The config value is preserved if the corresponding YAML node doesn't exist.
static void decode(const YAML::Node& data, class _base& rhs);
}
std::vector<std::string> cfg::make_int_range(s64 min, s64 max)
{
return {std::to_string(min), std::to_string(max)};
static void decode(const YAML::Node& data, class entry_base& rhs);
}
bool cfg::try_to_int64(s64* out, const std::string& value, s64 min, s64 max)
@@ -89,8 +97,6 @@ bool cfg::try_to_int64(s64* out, const std::string& value, s64 min, s64 max)
bool cfg::try_to_enum_value(u64* out, decltype(&fmt_class_string<int>::format) func, const std::string& value)
{
u64 max = -1;
for (u64 i = 0;; i++)
{
std::string var;
@@ -108,33 +114,17 @@ bool cfg::try_to_enum_value(u64* out, decltype(&fmt_class_string<int>::format) f
{
break;
}
max = i;
}
try
{
std::size_t pos;
const auto val = std::stoull(value, &pos, 0);
if (pos != value.size())
{
if (out) cfg.error("cfg::try_to_enum_value('%s'): unexpected characters (pos=%zu)", value, pos);
return false;
}
if (val > max)
{
if (out) cfg.error("cfg::try_to_enum_value('%s'): out of bounds(0..%u)", value, max);
return false;
}
const auto val = std::stoull(value, nullptr, 0);
if (out) *out = val;
return true;
}
catch (const std::exception& e)
catch (...)
{
if (out) cfg.error("cfg::try_to_enum_value('%s'): invalid enum value: %s", value, e.what());
return false;
}
}
@@ -161,7 +151,7 @@ std::vector<std::string> cfg::try_to_enum_list(decltype(&fmt_class_string<int>::
return result;
}
void cfg::encode(YAML::Emitter& out, const cfg::_base& rhs)
void cfg::encode(YAML::Emitter& out, const cfg::entry_base& rhs)
{
switch (rhs.get_type())
{
@@ -171,8 +161,7 @@ void cfg::encode(YAML::Emitter& out, const cfg::_base& rhs)
for (const auto& np : static_cast<const node&>(rhs).get_nodes())
{
out << YAML::Key << np.first;
out << YAML::Value;
encode(out, *np.second);
out << YAML::Value; encode(out, *np.second);
}
out << YAML::EndMap;
@@ -189,28 +178,12 @@ void cfg::encode(YAML::Emitter& out, const cfg::_base& rhs)
out << YAML::EndSeq;
return;
}
case type::log:
{
out << YAML::BeginMap;
for (const auto& np : static_cast<const log_entry&>(rhs).get_map())
{
if (np.second == logs::level::notice) continue;
out << YAML::Key << np.first;
out << YAML::Value << fmt::format("%s", np.second);
}
}
out << YAML::EndMap;
return;
}
default:
{
out << rhs.to_string();
return;
}
}
out << rhs.to_string();
}
void cfg::decode(const YAML::Node& data, cfg::_base& rhs)
void cfg::decode(const YAML::Node& data, cfg::entry_base& rhs)
{
switch (rhs.get_type())
{
@@ -226,12 +199,16 @@ void cfg::decode(const YAML::Node& data, cfg::_base& rhs)
if (!pair.first.IsScalar()) continue;
// Find the key among existing nodes
for (const auto& _pair : static_cast<node&>(rhs).get_nodes())
const auto name = pair.first.Scalar();
const auto found = static_cast<node&>(rhs).get_nodes().find(name);
if (found != static_cast<node&>(rhs).get_nodes().cend())
{
if (_pair.first == pair.first.Scalar())
{
decode(pair.second, *_pair.second);
}
decode(pair.second, *found->second);
}
else
{
// ???
}
}
@@ -248,29 +225,6 @@ void cfg::decode(const YAML::Node& data, cfg::_base& rhs)
break;
}
case type::log:
{
if (data.IsScalar() || data.IsSequence())
{
return; // ???
}
std::map<std::string, logs::level> values;
for (const auto& pair : data)
{
if (!pair.first.IsScalar() || !pair.second.IsScalar()) continue;
u64 value;
if (cfg::try_to_enum_value(&value, &fmt_class_string<logs::level>::format, pair.second.Scalar()))
{
values.emplace(pair.first.Scalar(), static_cast<logs::level>(static_cast<int>(value)));
}
}
static_cast<log_entry&>(rhs).set_map(std::move(values));
break;
}
default:
{
std::string value;
@@ -290,19 +244,14 @@ std::string cfg::node::to_string() const
YAML::Emitter out;
cfg::encode(out, *this);
return {out.c_str(), out.size()};
return{ out.c_str(), out.size() };
}
bool cfg::node::from_string(const std::string& value) try
bool cfg::node::from_string(const std::string& value)
{
cfg::decode(YAML::Load(value), *this);
return true;
}
catch (const std::exception& e)
{
cfg.fatal("%s thrown: %s", typeid(e).name(), e.what());
return false;
}
void cfg::node::from_default()
{
@@ -312,32 +261,25 @@ void cfg::node::from_default()
}
}
void cfg::_bool::from_default()
void cfg::bool_entry::from_default()
{
m_value = def;
value = def;
}
void cfg::string::from_default()
void cfg::string_entry::from_default()
{
m_value = def;
*this = def;
}
void cfg::set_entry::from_default()
{
std::lock_guard<std::mutex> lock(m_mutex);
m_set = {};
}
void cfg::log_entry::set_map(std::map<std::string, logs::level>&& map)
cfg::root_node& cfg::get_root()
{
logs::reset();
for (auto&& pair : (m_map = std::move(map)))
{
logs::set_level(pair.first, pair.second);
}
}
void cfg::log_entry::from_default()
{
set_map({});
// Magic static
static root_node root;
return root;
}
+219 -87
View File
@@ -1,20 +1,21 @@
#pragma once
#include "Utilities/types.h"
#include "Utilities/Atomic.h"
#include "Utilities/StrFmt.h"
#include "Utilities/Log.h"
#include <initializer_list>
#include <exception>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <unordered_map>
#include <map>
#include <mutex>
namespace cfg
{
// Format min and max values
std::vector<std::string> make_int_range(s64 min, s64 max);
// Convert string to signed integer
bool try_to_int64(s64* out, const std::string& value, s64 min, s64 max);
@@ -28,33 +29,36 @@ namespace cfg
enum class type : uint
{
node = 0, // cfg::node type
_bool, // cfg::_bool type
_enum, // cfg::_enum type
_int, // cfg::_int type
string, // cfg::string type
boolean, // cfg::bool_entry type
fixed_map, // cfg::map_entry type
enumeration, // cfg::enum_entry type
integer, // cfg::int_entry type
string, // cfg::string_entry type
set, // cfg::set_entry type
log,
};
// Config tree entry abstract base class
class _base
class entry_base
{
const type m_type;
protected:
// Ownerless entry constructor
_base(type _type);
entry_base(type _type);
// Owned entry constructor
_base(type _type, class node* owner, const std::string& name);
entry_base(type _type, class node& owner, const std::string& name);
public:
// Disallow copy/move constructors and assignments
_base(const _base&) = delete;
entry_base(const entry_base&) = delete;
// Get type
type get_type() const { return m_type; }
// Access child node (must exist)
entry_base& operator [](const std::string& name) const; entry_base& operator [](const char* name) const;
// Reset defaults
virtual void from_default() = 0;
@@ -78,27 +82,27 @@ namespace cfg
};
// Config tree node which contains another nodes
class node : public _base
class node : public entry_base
{
std::vector<std::pair<std::string, _base*>> m_nodes;
std::map<std::string, entry_base*> m_nodes;
friend class _base;
friend class entry_base;
public:
// Root node constructor
node()
: _base(type::node)
: entry_base(type::node)
{
}
// Registered node constructor
node(node* owner, const std::string& name)
: _base(type::node, owner, name)
node(node& owner, const std::string& name)
: entry_base(type::node, owner, name)
{
}
// Get child nodes
const auto& get_nodes() const
const std::map<std::string, entry_base*>& get_nodes() const
{
return m_nodes;
}
@@ -113,61 +117,160 @@ namespace cfg
void from_default() override;
};
class _bool final : public _base
struct bool_entry final : public entry_base
{
bool m_value;
atomic_t<bool> value;
public:
bool def;
const bool def;
_bool(node* owner, const std::string& name, bool def = false)
: _base(type::_bool, owner, name)
, m_value(def)
bool_entry(node& owner, const std::string& name, bool def = false)
: entry_base(type::boolean, owner, name)
, value(def)
, def(def)
{
}
explicit operator bool() const
{
return m_value;
return value.load();
}
bool_entry& operator =(bool value)
{
value = value;
return *this;
}
void from_default() override;
std::string to_string() const override
{
return m_value ? "true" : "false";
return value.load() ? "true" : "false";
}
bool from_string(const std::string& value) override
{
if (value == "false")
m_value = false;
this->value = false;
else if (value == "true")
m_value = true;
this->value = true;
else
return false;
return true;
}
};
void set(const bool& value)
// Value node with fixed set of possible values, each maps to a value of type T.
template<typename T>
struct map_entry final : public entry_base
{
using init_type = std::initializer_list<std::pair<std::string, T>>;
using map_type = std::unordered_map<std::string, T>;
using list_type = std::vector<std::string>;
using value_type = typename map_type::value_type;
static map_type make_map(init_type init)
{
m_value = value;
map_type map(init.size());
for (const auto& v : init)
{
// Ensure elements are unique
verify(HERE), map.emplace(v.first, v.second).second;
}
return map;
}
static list_type make_list(init_type init)
{
list_type list; list.reserve(init.size());
for (const auto& v : init)
{
list.emplace_back(v.first);
}
return list;
}
public:
const map_type map;
const list_type list; // Element list sorted in original order
const value_type& def; // Pointer to the default value
private:
atomic_t<const value_type*> m_value;
public:
map_entry(node& owner, const std::string& name, const std::string& def, init_type init)
: entry_base(type::fixed_map, owner, name)
, map(make_map(init))
, list(make_list(init))
, def(*map.find(def))
, m_value(&this->def)
{
}
map_entry(node& owner, const std::string& name, std::size_t def_index, init_type init)
: map_entry(owner, name, (init.begin() + (def_index < init.size() ? def_index : 0))->first, init)
{
}
map_entry(node& owner, const std::string& name, init_type init)
: map_entry(owner, name, 0, init)
{
}
const T& get() const
{
return m_value.load()->second;
}
void from_default() override
{
m_value = &def;
}
std::string to_string() const override
{
return m_value.load()->first;
}
bool from_string(const std::string& value) override
{
const auto found = map.find(value);
if (found == map.end())
{
return false;
}
else
{
m_value = &*found;
return true;
}
}
std::vector<std::string> to_list() const override
{
return list;
}
};
// Value node with fixed set of possible values, each maps to an enum value of type T.
template <typename T>
class _enum final : public _base
template<typename T, bool External = false>
class enum_entry final : public entry_base
{
T m_value;
// Value or reference
std::conditional_t<External, atomic_t<T>&, atomic_t<T>> m_value;
public:
const T def;
_enum(node* owner, const std::string& name, T value = {})
: _base(type::_enum, owner, name)
enum_entry(node& owner, const std::string& name, std::conditional_t<External, atomic_t<T>&, T> value)
: entry_base(type::enumeration, owner, name)
, m_value(value)
, def(value)
{
@@ -175,7 +278,13 @@ namespace cfg
operator T() const
{
return m_value;
return m_value.load();
}
enum_entry& operator =(T value)
{
m_value = value;
return *this;
}
void from_default() override
@@ -211,21 +320,21 @@ namespace cfg
};
// Signed 32/64-bit integer entry with custom Min/Max range.
template <s64 Min, s64 Max>
class _int final : public _base
template<s64 Min, s64 Max>
class int_entry final : public entry_base
{
static_assert(Min < Max, "Invalid cfg::_int range");
static_assert(Min < Max, "Invalid cfg::int_entry range");
// Prefer 32 bit type if possible
using int_type = std::conditional_t<Min >= INT32_MIN && Max <= INT32_MAX, s32, s64>;
int_type m_value;
atomic_t<int_type> m_value;
public:
int_type def;
const int_type def;
_int(node* owner, const std::string& name, int_type def = std::min<int_type>(Max, std::max<int_type>(Min, 0)))
: _base(type::_int, owner, name)
int_entry(node& owner, const std::string& name, int_type def = std::min<int_type>(Max, std::max<int_type>(Min, 0)))
: entry_base(type::integer, owner, name)
, m_value(def)
, def(def)
{
@@ -233,7 +342,18 @@ namespace cfg
operator int_type() const
{
return m_value;
return m_value.load();
}
int_entry& operator =(int_type value)
{
if (value < Min || value > Max)
{
fmt::throw_exception("Value out of the valid range: %lld" HERE, s64{ value });
}
m_value = value;
return *this;
}
void from_default() override
@@ -243,7 +363,7 @@ namespace cfg
std::string to_string() const override
{
return std::to_string(m_value);
return std::to_string(m_value.load());
}
bool from_string(const std::string& value) override
@@ -257,34 +377,25 @@ namespace cfg
return false;
}
void set(const s64& value)
{
m_value = static_cast<int_type>(value);
}
std::vector<std::string> to_list() const override
{
return make_int_range(Min, Max);
}
};
// Alias for 32 bit int
using int32 = _int<INT32_MIN, INT32_MAX>;
using int32_entry = int_entry<INT32_MIN, INT32_MAX>;
// Alias for 64 bit int
using int64 = _int<INT64_MIN, INT64_MAX>;
using int64_entry = int_entry<INT64_MIN, INT64_MAX>;
// Simple string entry with mutex
class string final : public _base
class string_entry final : public entry_base
{
mutable std::mutex m_mutex;
std::string m_value;
public:
std::string def;
const std::string def;
string(node* owner, const std::string& name, const std::string& def = {})
: _base(type::string, owner, name)
string_entry(node& owner, const std::string& name, const std::string& def = {})
: entry_base(type::string, owner, name)
, m_value(def)
, def(def)
{
@@ -292,16 +403,25 @@ namespace cfg
operator std::string() const
{
std::lock_guard<std::mutex> lock(m_mutex);
return m_value;
}
const std::string& get() const
std::string get() const
{
return m_value;
return *this;
}
string_entry& operator =(const std::string& value)
{
std::lock_guard<std::mutex> lock(m_mutex);
m_value = value;
return *this;
}
std::size_t size() const
{
std::lock_guard<std::mutex> lock(m_mutex);
return m_value.size();
}
@@ -309,35 +429,41 @@ namespace cfg
std::string to_string() const override
{
std::lock_guard<std::mutex> lock(m_mutex);
return m_value;
}
bool from_string(const std::string& value) override
{
m_value = value;
*this = value;
return true;
}
};
// Simple set entry with mutex (TODO: template for various types)
class set_entry final : public _base
class set_entry final : public entry_base
{
mutable std::mutex m_mutex;
std::set<std::string> m_set;
public:
// Default value is empty list in current implementation
set_entry(node* owner, const std::string& name)
: _base(type::set, owner, name)
set_entry(node& owner, const std::string& name)
: entry_base(type::set, owner, name)
{
}
std::set<std::string> get_set() const
{
std::lock_guard<std::mutex> lock(m_mutex);
return m_set;
}
void set_set(std::set<std::string>&& set)
{
std::lock_guard<std::mutex> lock(m_mutex);
m_set = std::move(set);
}
@@ -345,34 +471,40 @@ namespace cfg
std::vector<std::string> to_list() const override
{
std::lock_guard<std::mutex> lock(m_mutex);
return{ m_set.begin(), m_set.end() };
}
bool from_list(std::vector<std::string>&& list) override
{
std::lock_guard<std::mutex> lock(m_mutex);
m_set = { std::make_move_iterator(list.begin()), std::make_move_iterator(list.end()) };
return true;
}
};
class log_entry final : public _base
// Root type with some predefined nodes. Don't change it, this is not mandatory for adding nodes.
struct root_node : node
{
std::map<std::string, logs::level> m_map;
public:
log_entry(node* owner, const std::string& name)
: _base(type::log, owner, name)
{
}
std::map<std::string, logs::level> get_map() const
{
return m_map;
}
void set_map(std::map<std::string, logs::level>&& map);
void from_default() override;
node core { *this, "Core" };
node vfs { *this, "VFS" };
node log { *this, "Log" };
node video { *this, "Video" };
node audio { *this, "Audio" };
node io { *this, "Input/Output" };
node sys { *this, "System" };
node net { *this, "Net" };
node misc { *this, "Miscellaneous" };
};
// Get global configuration root instance
extern root_node& get_root();
// Global configuration root instance (cached reference)
static root_node& root = get_root();
}
// Registered log channel
#define LOG_CHANNEL(name) extern logs::channel name; namespace logs { static cfg::enum_entry<logs::level, true> name(cfg::root.log, #name, ::name.enabled); }
+44 -214
View File
@@ -6,11 +6,7 @@
#include <unordered_map>
#include <algorithm>
#include <cstring>
#include <cerrno>
#include <typeinfo>
using namespace std::literals::string_literals;
#ifdef _WIN32
@@ -75,25 +71,10 @@ static time_t to_time(const FILETIME& ft)
static FILETIME from_time(s64 _time)
{
const ullong wtime = (_time + 11644473600ULL) * 10000000ULL;
FILETIME result;
if (_time <= -11644473600ll)
{
result.dwLowDateTime = 0;
result.dwHighDateTime = 0;
}
else if (_time > INT64_MAX / 10000000ll - 11644473600ll)
{
result.dwLowDateTime = 0xffffffff;
result.dwHighDateTime = 0x7fffffff;
}
else
{
const ullong wtime = (_time + 11644473600ull) * 10000000ull;
result.dwLowDateTime = static_cast<DWORD>(wtime);
result.dwHighDateTime = static_cast<DWORD>(wtime >> 32);
}
result.dwLowDateTime = static_cast<DWORD>(wtime);
result.dwHighDateTime = static_cast<DWORD>(wtime >> 32);
return result;
}
@@ -109,10 +90,6 @@ static fs::error to_error(DWORD e)
case ERROR_NEGATIVE_SEEK: return fs::error::inval;
case ERROR_DIRECTORY: return fs::error::inval;
case ERROR_INVALID_NAME: return fs::error::inval;
case ERROR_SHARING_VIOLATION: return fs::error::acces;
case ERROR_DIR_NOT_EMPTY: return fs::error::notempty;
case ERROR_NOT_READY: return fs::error::noent;
//case ERROR_INVALID_PARAMETER: return fs::error::inval;
default: fmt::throw_exception("Unknown Win32 error: %u.", e);
}
}
@@ -122,8 +99,6 @@ static fs::error to_error(DWORD e)
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/statvfs.h>
#include <sys/file.h>
#include <dirent.h>
#include <fcntl.h>
#include <libgen.h>
@@ -131,12 +106,10 @@ static fs::error to_error(DWORD e)
#include <unistd.h>
#include <utime.h>
#if defined(__APPLE__)
#if defined(__APPLE__) || defined(__FreeBSD__)
#include <copyfile.h>
#include <mach-o/dyld.h>
#elif defined(__DragonFly__) || defined(__FreeBSD__)
#include <sys/socket.h> // sendfile
#elif defined(__linux__) || defined(__sun)
#else
#include <sys/sendfile.h>
#endif
@@ -148,7 +121,6 @@ static fs::error to_error(int e)
case EEXIST: return fs::error::exist;
case EINVAL: return fs::error::inval;
case EACCES: return fs::error::acces;
case ENOTEMPTY: return fs::error::notempty;
default: fmt::throw_exception("Unknown system error: %d.", e);
}
}
@@ -181,16 +153,6 @@ namespace fs
{
}
stat_t file_base::stat()
{
fmt::throw_exception("fs::file::stat() not supported for %s", typeid(*this).name());
}
void file_base::sync()
{
// Do notning
}
dir_base::~dir_base()
{
}
@@ -428,45 +390,6 @@ bool fs::is_dir(const std::string& path)
return true;
}
bool fs::statfs(const std::string& path, fs::device_stat& info)
{
if (auto device = get_virtual_device(path))
{
return device->statfs(path, info);
}
#ifdef _WIN32
ULARGE_INTEGER avail_free;
ULARGE_INTEGER total_size;
ULARGE_INTEGER total_free;
if (!GetDiskFreeSpaceExW(to_wchar(path).get(), &avail_free, &total_size, &total_free))
{
g_tls_error = to_error(GetLastError());
return false;
}
info.block_size = 4096; // TODO
info.total_size = total_size.QuadPart;
info.total_free = total_free.QuadPart;
info.avail_free = avail_free.QuadPart;
#else
struct ::statvfs buf;
if (::statvfs(path.c_str(), &buf) != 0)
{
g_tls_error = to_error(errno);
return false;
}
info.block_size = buf.f_frsize;
info.total_size = info.block_size * buf.f_blocks;
info.total_free = info.block_size * buf.f_bfree;
info.avail_free = info.block_size * buf.f_bavail;
#endif
return true;
}
bool fs::create_dir(const std::string& path)
{
if (auto device = get_virtual_device(path))
@@ -531,7 +454,7 @@ bool fs::remove_dir(const std::string& path)
#endif
}
bool fs::rename(const std::string& from, const std::string& to, bool overwrite)
bool fs::rename(const std::string& from, const std::string& to)
{
const auto device = get_virtual_device(from);
@@ -546,43 +469,14 @@ bool fs::rename(const std::string& from, const std::string& to, bool overwrite)
}
#ifdef _WIN32
const auto ws1 = to_wchar(from);
const auto ws2 = to_wchar(to);
if (!MoveFileExW(ws1.get(), ws2.get(), overwrite ? MOVEFILE_REPLACE_EXISTING : 0))
if (!MoveFileW(to_wchar(from).get(), to_wchar(to).get()))
{
DWORD error1 = GetLastError();
if (overwrite && error1 == ERROR_ACCESS_DENIED && is_dir(from) && is_dir(to))
{
if (RemoveDirectoryW(ws2.get()))
{
if (MoveFileW(ws1.get(), ws2.get()))
{
return true;
}
error1 = GetLastError();
CreateDirectoryW(ws2.get(), NULL); // TODO
}
else
{
error1 = GetLastError();
}
}
g_tls_error = to_error(error1);
g_tls_error = to_error(GetLastError());
return false;
}
return true;
#else
if (!overwrite && exists(to))
{
g_tls_error = fs::error::exist;
return false;
}
if (::rename(from.c_str(), to.c_str()) != 0)
{
g_tls_error = to_error(errno);
@@ -631,20 +525,14 @@ bool fs::copy_file(const std::string& from, const std::string& to, bool overwrit
}
// Here we use kernel-space copying for performance reasons
#if defined(__APPLE__)
// fcopyfile works on OS X 10.5+
#if defined(__APPLE__) || defined(__FreeBSD__)
// fcopyfile works on FreeBSD and OS X 10.5+
if (::fcopyfile(input, output, 0, COPYFILE_ALL))
#elif defined(__DragonFly__) || defined(__FreeBSD__)
if (::sendfile(input, output, 0, 0, NULL, NULL, 0))
#elif defined(__linux__) || defined(__sun)
#else
// sendfile will work with non-socket output (i.e. regular file) on Linux 2.6.33+
off_t bytes_copied = 0;
struct ::stat fileinfo = { 0 };
if (::fstat(input, &fileinfo) || ::sendfile(output, input, &bytes_copied, fileinfo.st_size))
#else // NetBSD, OpenBSD, etc.
fmt::throw_exception("fs::copy_file() isn't implemented for this platform.\nFrom: %s\nTo: %s", from, to);
errno = 0;
if (true)
#endif
{
const int err = errno;
@@ -696,17 +584,18 @@ bool fs::truncate_file(const std::string& path, u64 length)
#ifdef _WIN32
// Open the file
const auto handle = CreateFileW(to_wchar(path).get(), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
const auto handle = CreateFileW(to_wchar(path).get(), GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (handle == INVALID_HANDLE_VALUE)
{
g_tls_error = to_error(GetLastError());
return false;
}
FILE_END_OF_FILE_INFO _eof;
_eof.EndOfFile.QuadPart = length;
LARGE_INTEGER distance;
distance.QuadPart = length;
if (!SetFileInformationByHandle(handle, FileEndOfFileInfo, &_eof, sizeof(_eof)))
// Seek and truncate
if (!SetFilePointerEx(handle, distance, NULL, FILE_BEGIN) || !SetEndOfFile(handle))
{
g_tls_error = to_error(GetLastError());
CloseHandle(handle);
@@ -735,7 +624,7 @@ bool fs::utime(const std::string& path, s64 atime, s64 mtime)
#ifdef _WIN32
// Open the file
const auto handle = CreateFileW(to_wchar(path).get(), FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
const auto handle = CreateFileW(to_wchar(path).get(), FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (handle == INVALID_HANDLE_VALUE)
{
g_tls_error = to_error(GetLastError());
@@ -814,13 +703,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
disp = test(mode & fs::trunc) ? TRUNCATE_EXISTING : OPEN_EXISTING;
}
DWORD share = FILE_SHARE_READ;
if (!test(mode & fs::unshare))
{
share |= FILE_SHARE_WRITE | FILE_SHARE_DELETE;
}
const HANDLE handle = CreateFileW(to_wchar(path).get(), access, share, NULL, disp, FILE_ATTRIBUTE_NORMAL, NULL);
const HANDLE handle = CreateFileW(to_wchar(path).get(), access, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, disp, FILE_ATTRIBUTE_NORMAL, NULL);
if (handle == INVALID_HANDLE_VALUE)
{
@@ -828,7 +711,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
return;
}
class windows_file final : public file_base, public get_native_handle
class windows_file final : public file_base
{
const HANDLE m_handle;
@@ -859,22 +742,25 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
return info;
}
void sync() override
{
verify("file::sync" HERE), FlushFileBuffers(m_handle);
}
bool trunc(u64 length) override
{
FILE_END_OF_FILE_INFO _eof;
_eof.EndOfFile.QuadPart = length;
LARGE_INTEGER old, pos;
if (!SetFileInformationByHandle(m_handle, FileEndOfFileInfo, &_eof, sizeof(_eof)))
pos.QuadPart = 0;
if (!SetFilePointerEx(m_handle, pos, &old, FILE_CURRENT)) // get old position
{
g_tls_error = to_error(GetLastError());
return false;
}
pos.QuadPart = length;
if (!SetFilePointerEx(m_handle, pos, NULL, FILE_BEGIN)) // set new position
{
g_tls_error = to_error(GetLastError());
return false;
}
verify("file::trunc" HERE), SetEndOfFile(m_handle), SetFilePointerEx(m_handle, old, NULL, FILE_BEGIN);
return true;
}
@@ -911,11 +797,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
whence == seek_end ? FILE_END :
(fmt::throw_exception("Invalid whence (0x%x)" HERE, whence), 0);
if (!SetFilePointerEx(m_handle, pos, &pos, mode))
{
g_tls_error = to_error(GetLastError());
return -1;
}
verify("file::seek" HERE), SetFilePointerEx(m_handle, pos, &pos, mode);
return pos.QuadPart;
}
@@ -927,11 +809,6 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
return size.QuadPart;
}
native_handle get() override
{
return m_handle;
}
};
m_file = std::make_unique<windows_file>(handle);
@@ -955,14 +832,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
return;
}
if (test(mode & fs::unshare) && ::flock(fd, LOCK_EX | LOCK_NB) != 0)
{
g_tls_error = errno == EWOULDBLOCK ? fs::error::acces : to_error(errno);
::close(fd);
return;
}
class unix_file final : public file_base, public get_native_handle
class unix_file final : public file_base
{
const int m_fd;
@@ -993,11 +863,6 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
return info;
}
void sync() override
{
verify("file::sync" HERE), ::fsync(m_fd) == 0;
}
bool trunc(u64 length) override
{
if (::ftruncate(m_fd, length) != 0)
@@ -1034,12 +899,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
(fmt::throw_exception("Invalid whence (0x%x)" HERE, whence), 0);
const auto result = ::lseek(m_fd, offset, mode);
if (result == -1)
{
g_tls_error = to_error(errno);
return -1;
}
verify("file::seek" HERE), result != -1;
return result;
}
@@ -1051,11 +911,6 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
return file_info.st_size;
}
native_handle get() override
{
return m_fd;
}
};
m_file = std::make_unique<unix_file>(fd);
@@ -1078,6 +933,11 @@ fs::file::file(const void* ptr, std::size_t size)
{
}
fs::stat_t stat() override
{
fmt::raw_error("fs::file::memory_stream::stat(): not supported");
}
bool trunc(u64 length) override
{
return false;
@@ -1106,20 +966,11 @@ fs::file::file(const void* ptr, std::size_t size)
u64 seek(s64 offset, fs::seek_mode whence) override
{
const s64 new_pos =
whence == fs::seek_set ? offset :
whence == fs::seek_cur ? offset + m_pos :
whence == fs::seek_end ? offset + size() :
return
whence == fs::seek_set ? m_pos = offset :
whence == fs::seek_cur ? m_pos = offset + m_pos :
whence == fs::seek_end ? m_pos = offset + m_size :
(fmt::raw_error("fs::file::memory_stream::seek(): invalid whence"), 0);
if (new_pos < 0)
{
fs::g_tls_error = fs::error::inval;
return -1;
}
m_pos = new_pos;
return m_pos;
}
u64 size() override
@@ -1131,20 +982,6 @@ fs::file::file(const void* ptr, std::size_t size)
m_file = std::make_unique<memory_stream>(ptr, size);
}
fs::native_handle fs::file::get_handle() const
{
if (auto getter = dynamic_cast<get_native_handle*>(m_file.get()))
{
return getter->get();
}
#ifdef _WIN32
return INVALID_HANDLE_VALUE;
#else
return -1;
#endif
}
void fs::dir::xnull() const
{
fmt::throw_exception<std::logic_error>("fs::dir is null");
@@ -1258,12 +1095,7 @@ bool fs::dir::open(const std::string& path)
}
struct ::stat file_info;
if (::fstatat(::dirfd(m_dd), found->d_name, &file_info, 0) != 0)
{
//failed metadata (broken symlink?), ignore and skip to next file
return read(info);
}
verify("dir::read" HERE), ::fstatat(::dirfd(m_dd), found->d_name, &file_info, 0) == 0;
info.name = found->d_name;
info.is_directory = S_ISDIR(file_info.st_mode);
@@ -1363,7 +1195,7 @@ std::string fs::get_data_dir(const std::string& prefix, const std::string& locat
continue;
}
buf.push_back(c);
}
@@ -1481,8 +1313,6 @@ void fmt_class_string<fs::error>::format(std::string& out, u64 arg)
case fs::error::inval: return "Invalid arguments";
case fs::error::noent: return "Not found";
case fs::error::exist: return "Already exists";
case fs::error::acces: return "Access violation";
case fs::error::notempty: return "Not empty";
}
return unknown;
+18 -74
View File
@@ -10,12 +10,6 @@
namespace fs
{
#ifdef _WIN32
using native_handle = void*;
#else
using native_handle = int;
#endif
// File open mode flags
enum class open_mode : u32
{
@@ -25,7 +19,6 @@ namespace fs
create,
trunc,
excl,
unshare,
__bitset_enum_max
};
@@ -36,7 +29,6 @@ namespace fs
constexpr auto create = +open_mode::create; // Create file if it doesn't exist
constexpr auto trunc = +open_mode::trunc; // Clear opened file if it's not empty
constexpr auto excl = +open_mode::excl; // Failure if the file already exists (used with `create`)
constexpr auto unshare = +open_mode::unshare; // Prevent opening the file twice
constexpr auto rewrite = open_mode::write + open_mode::create + open_mode::trunc;
@@ -63,19 +55,12 @@ namespace fs
s64 ctime;
};
// Native handle getter
struct get_native_handle
{
virtual native_handle get() = 0;
};
// File handle base
struct file_base
{
virtual ~file_base();
virtual stat_t stat();
virtual void sync();
virtual stat_t stat() = 0;
virtual bool trunc(u64 length) = 0;
virtual u64 read(void* buffer, u64 size) = 0;
virtual u64 write(const void* buffer, u64 size) = 0;
@@ -98,22 +83,12 @@ namespace fs
virtual void rewind() = 0;
};
// Device information
struct device_stat
{
u64 block_size;
u64 total_size;
u64 total_free; // Total size of free space
u64 avail_free; // Free space available to unprivileged user
};
// Virtual device
struct device_base
{
virtual ~device_base();
virtual bool stat(const std::string& path, stat_t& info) = 0;
virtual bool statfs(const std::string& path, device_stat& info) = 0;
virtual bool remove_dir(const std::string& path) = 0;
virtual bool create_dir(const std::string& path) = 0;
virtual bool rename(const std::string& from, const std::string& to) = 0;
@@ -146,9 +121,6 @@ namespace fs
// Check whether the directory exists and is NOT a file
bool is_dir(const std::string& path);
// Get filesystem information
bool statfs(const std::string& path, device_stat& info);
// Delete empty directory
bool remove_dir(const std::string& path);
@@ -159,7 +131,7 @@ namespace fs
bool create_path(const std::string& path);
// Rename (move) file or directory
bool rename(const std::string& from, const std::string& to, bool overwrite);
bool rename(const std::string& from, const std::string& to);
// Copy file contents
bool copy_file(const std::string& from, const std::string& to, bool overwrite);
@@ -234,13 +206,6 @@ namespace fs
return m_file->stat();
}
// Sync file buffers
void sync() const
{
if (!m_file) xnull();
return m_file->sync();
}
// Read the data from the file and return the amount of data written in buffer
u64 read(void* buffer, u64 count) const
{
@@ -361,9 +326,6 @@ namespace fs
if (seek(0), !read(result)) xfail();
return result;
}
// Get native handle if available
native_handle get_handle() const;
};
class dir final
@@ -422,7 +384,7 @@ namespace fs
class iterator
{
const dir* m_parent;
dir* m_parent;
dir_entry m_entry;
public:
@@ -432,7 +394,7 @@ namespace fs
from_current
};
iterator(const dir* parent, mode mode_ = mode::from_first)
iterator(dir* parent, mode mode_ = mode::from_first)
: m_parent(parent)
{
if (!m_parent)
@@ -458,7 +420,7 @@ namespace fs
iterator& operator++()
{
*this = {m_parent, mode::from_current};
*this = { m_parent, mode::from_current };
return *this;
}
@@ -468,14 +430,14 @@ namespace fs
}
};
iterator begin() const
iterator begin()
{
return {m_dir ? this : nullptr};
return{ m_dir ? this : nullptr };
}
iterator end() const
iterator end()
{
return {nullptr};
return{ nullptr };
}
};
@@ -502,7 +464,6 @@ namespace fs
noent,
exist,
acces,
notempty,
};
// Error code returned
@@ -527,6 +488,11 @@ namespace fs
{
}
stat_t stat() override
{
fmt::raw_error("fs::container_stream<>::stat(): not supported");
}
bool trunc(u64 length) override
{
obj.resize(length);
@@ -581,20 +547,11 @@ namespace fs
u64 seek(s64 offset, seek_mode whence) override
{
const s64 new_pos =
whence == fs::seek_set ? offset :
whence == fs::seek_cur ? offset + pos :
whence == fs::seek_end ? offset + size() :
return
whence == fs::seek_set ? pos = offset :
whence == fs::seek_cur ? pos = offset + pos :
whence == fs::seek_end ? pos = offset + size() :
(fmt::raw_error("fs::container_stream<>::seek(): invalid whence"), 0);
if (new_pos < 0)
{
fs::g_tls_error = fs::error::inval;
return -1;
}
pos = new_pos;
return pos;
}
u64 size() override
@@ -610,17 +567,4 @@ namespace fs
result.reset(std::make_unique<container_stream<T>>(std::forward<T>(container)));
return result;
}
template <typename... Args>
bool write_file(const std::string& path, bs_t<fs::open_mode> mode, const Args&... args)
{
if (fs::file f{path, mode})
{
// Write args sequentially
int seq[]{ (f.write(args), 0)... };
return true;
}
return false;
}
}
-817
View File
@@ -1,817 +0,0 @@
#include "stdafx.h"
#ifdef WITH_GDB_DEBUGGER
#include "GDBDebugServer.h"
#include "Log.h"
#include <algorithm>
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/IdManager.h"
#include "Emu/CPU/CPUThread.h"
#include "Emu/Cell/PPUThread.h"
#include "Emu/Cell/RawSPUThread.h"
#include "Emu/Cell/SPUThread.h"
#ifndef _WIN32
#include"fcntl.h"
#endif
extern void ppu_set_breakpoint(u32 addr);
extern void ppu_remove_breakpoint(u32 addr);
logs::channel gdbDebugServer("gdbDebugServer");
int sock_init(void)
{
#ifdef _WIN32
WSADATA wsa_data;
return WSAStartup(MAKEWORD(1, 1), &wsa_data);
#else
return 0;
#endif
}
int sock_quit(void)
{
#ifdef _WIN32
return WSACleanup();
#else
return 0;
#endif
}
#ifndef _WIN32
int closesocket(socket_t s) {
return close(s);
}
const int SOCKET_ERROR = -1;
const socket_t INVALID_SOCKET = -1;
#define sscanf_s sscanf
#define HEX_U32 "x"
#define HEX_U64 "lx"
#else
#define HEX_U32 "lx"
#define HEX_U64 "llx"
#endif
bool check_errno_again() {
#ifdef _WIN32
int err = GetLastError();
return (err == WSAEWOULDBLOCK);
#else
int err = errno;
return (err == EAGAIN) || (err == EWOULDBLOCK);
#endif
}
std::string u32_to_hex(u32 i) {
return fmt::format("%" HEX_U32, i);
}
std::string u64_to_padded_hex(u64 value) {
return fmt::format("%.16" HEX_U64, value);
}
std::string u32_to_padded_hex(u32 value) {
return fmt::format("%.8" HEX_U32, value);
}
u8 hex_to_u8(std::string val) {
u8 result;
sscanf_s(val.c_str(), "%02hhX", &result);
return result;
}
u32 hex_to_u32(std::string val) {
u32 result;
sscanf_s(val.c_str(), "%" HEX_U32, &result);
return result;
}
u64 hex_to_u64(std::string val) {
u64 result;
sscanf_s(val.c_str(), "%" HEX_U64, &result);
return result;
}
void GDBDebugServer::start_server()
{
server_socket = socket(AF_INET, SOCK_STREAM, 0);
if (server_socket == INVALID_SOCKET) {
gdbDebugServer.error("Error creating server socket");
return;
}
#ifdef WIN32
{
int mode = 1;
ioctlsocket(server_socket, FIONBIO, (u_long FAR *)&mode);
}
#else
fcntl(server_socket, F_SETFL, fcntl(server_socket, F_GETFL) | O_NONBLOCK);
#endif
int err;
sockaddr_in server_saddr;
server_saddr.sin_family = AF_INET;
int port = g_cfg.misc.gdb_server_port;
server_saddr.sin_port = htons(port);
server_saddr.sin_addr.s_addr = htonl(INADDR_ANY);
err = bind(server_socket, (struct sockaddr *) &server_saddr, sizeof(server_saddr));
if (err == SOCKET_ERROR) {
gdbDebugServer.error("Error binding to port %d", port);
return;
}
err = listen(server_socket, 1);
if (err == SOCKET_ERROR) {
gdbDebugServer.error("Error listening on port %d", port);
return;
}
gdbDebugServer.success("GDB Debug Server listening on port %d", port);
}
int GDBDebugServer::read(void * buf, int cnt)
{
while (!stop) {
int result = recv(client_socket, reinterpret_cast<char*>(buf), cnt, 0);
if (result == SOCKET_ERROR) {
if (check_errno_again()) {
thread_ctrl::wait_for(50);
continue;
}
gdbDebugServer.error("Error during socket read");
fmt::throw_exception("Error during socket read" HERE);
}
return result;
}
return 0;
}
char GDBDebugServer::read_char()
{
char result;
int cnt = read(&result, 1);
if (!cnt) {
fmt::throw_exception("Tried to read char, but no data was available" HERE);
}
return result;
}
u8 GDBDebugServer::read_hexbyte()
{
char buf[2];
read(buf, 2);
return static_cast<u8>(strtol(buf, nullptr, 16));
}
void GDBDebugServer::try_read_cmd(gdb_cmd & out_cmd)
{
char c = read_char();
//interrupt
if (UNLIKELY(c == 0x03)) {
out_cmd.cmd = "\0x03";
out_cmd.data = "";
out_cmd.checksum = 0;
return;
}
if (UNLIKELY(c != '$')) {
//gdb starts conversation with + for some reason
if (c == '+') {
c = read_char();
}
if (c != '$') {
fmt::throw_exception("Expected start of packet character '$', got '%c' instead" HERE, c);
}
}
//clear packet data
out_cmd.cmd = "";
out_cmd.data = "";
out_cmd.checksum = 0;
bool cmd_part = true;
u8 checksum = 0;
while(true) {
c = read_char();
if (c == '#') {
break;
}
checksum = (checksum + reinterpret_cast<u8&>(c)) % 256;
//escaped char
if (c == '}') {
c = read_char() ^ 0x20;
checksum = (checksum + reinterpret_cast<u8&>(c)) % 256;
}
//cmd-data splitters
if (cmd_part && ((c == ':') || (c == '.') || (c == ';'))) {
cmd_part = false;
}
if (cmd_part) {
out_cmd.cmd += c;
//only q and v commands can have multi-char command
if ((out_cmd.cmd.length() == 1) && (c != 'q') && (c != 'v')) {
cmd_part = false;
}
} else {
out_cmd.data += c;
}
}
out_cmd.checksum = read_hexbyte();
if (out_cmd.checksum != checksum) {
throw new wrong_checksum_exception("Wrong checksum for packet" HERE);
}
}
bool GDBDebugServer::read_cmd(gdb_cmd & out_cmd)
{
while (true) {
try {
try_read_cmd(out_cmd);
ack(true);
return true;
}
catch (wrong_checksum_exception) {
ack(false);
}
catch (std::runtime_error e) {
gdbDebugServer.error(e.what());
return false;
}
}
}
void GDBDebugServer::send(const char * buf, int cnt)
{
gdbDebugServer.trace("Sending %s (%d bytes)", buf, cnt);
while (!stop) {
int res = ::send(client_socket, buf, cnt, 0);
if (res == SOCKET_ERROR) {
if (check_errno_again()) {
thread_ctrl::wait_for(50);
continue;
}
gdbDebugServer.error("Failed sending %d bytes", cnt);
return;
}
return;
}
}
void GDBDebugServer::send_char(char c)
{
send(&c, 1);
}
void GDBDebugServer::ack(bool accepted)
{
send_char(accepted ? '+' : '-');
}
void GDBDebugServer::send_cmd(const std::string & cmd)
{
u8 checksum = 0;
std::string buf;
buf.reserve(cmd.length() + 4);
buf += "$";
for (int i = 0; i < cmd.length(); ++i) {
checksum = (checksum + append_encoded_char(cmd[i], buf)) % 256;
}
buf += "#";
buf += to_hexbyte(checksum);
send(buf.c_str(), static_cast<int>(buf.length()));
}
bool GDBDebugServer::send_cmd_ack(const std::string & cmd)
{
while (true) {
send_cmd(cmd);
char c = read_char();
if (LIKELY(c == '+')) {
return true;
}
if (UNLIKELY(c != '-')) {
gdbDebugServer.error("Wrong acknowledge character received %c", c);
return false;
}
gdbDebugServer.warning("Client rejected our cmd");
}
}
u8 GDBDebugServer::append_encoded_char(char c, std::string & str)
{
u8 checksum = 0;
if (UNLIKELY((c == '#') || (c == '$') || (c == '}'))) {
str += '}';
c ^= 0x20;
checksum = '}';
}
checksum = (checksum + reinterpret_cast<u8&>(c)) % 256;
str += c;
return checksum;
}
std::string GDBDebugServer::to_hexbyte(u8 i)
{
std::string result = "00";
u8 i1 = i & 0xF;
u8 i2 = i >> 4;
result[0] = i2 > 9 ? 'a' + i2 - 10 : '0' + i2;
result[1] = i1 > 9 ? 'a' + i1 - 10 : '0' + i1;
return result;
}
bool GDBDebugServer::select_thread(u64 id)
{
//in case we have none at all
selected_thread.reset();
const auto on_select = [&](u32, cpu_thread& cpu)
{
return (id == ALL_THREADS) || (id == ANY_THREAD) || (cpu.id == id);
};
if (auto ppu = idm::select<ppu_thread>(on_select)) {
selected_thread = ppu.ptr;
return true;
}
return false;
}
std::string GDBDebugServer::get_reg(std::shared_ptr<ppu_thread> thread, u32 rid)
{
std::string result;
//ids from gdb/features/rs6000/powerpc-64.c
//pc
switch (rid) {
case 64:
return u64_to_padded_hex(thread->cia);
//msr?
case 65:
return std::string(16, 'x');
case 66:
return u32_to_padded_hex(thread->cr_pack());
case 67:
return u64_to_padded_hex(thread->lr);
case 68:
return u64_to_padded_hex(thread->ctr);
//xer
case 69:
return std::string(8, 'x');
//fpscr
case 70:
return std::string(8, 'x');
default:
if (rid > 70) return "";
return (rid > 31)
? u64_to_padded_hex(reinterpret_cast<u64&>(thread->fpr[rid - 32])) //fpr
: u64_to_padded_hex(thread->gpr[rid]); //gpr
}
}
bool GDBDebugServer::set_reg(std::shared_ptr<ppu_thread> thread, u32 rid, std::string value)
{
switch (rid) {
case 64:
thread->cia = static_cast<u32>(hex_to_u64(value));
return true;
//msr?
case 65:
return true;
case 66:
thread->cr_unpack(hex_to_u32(value));
return true;
case 67:
thread->lr = hex_to_u64(value);
return true;
case 68:
thread->ctr = hex_to_u64(value);
return true;
//xer
case 69:
return true;
//fpscr
case 70:
return true;
default:
if (rid > 70) return false;
if (rid > 31) {
u64 val = hex_to_u64(value);
thread->fpr[rid - 32] = reinterpret_cast<f64&>(val);
} else {
thread->gpr[rid] = hex_to_u64(value);
}
return true;
}
}
u32 GDBDebugServer::get_reg_size(std::shared_ptr<ppu_thread> thread, u32 rid)
{
switch (rid) {
case 66:
case 69:
case 70:
return 4;
default:
if (rid > 70) {
return 0;
}
return 8;
}
}
bool GDBDebugServer::send_reason()
{
return send_cmd_ack("S05");
}
bool GDBDebugServer::cmd_extended_mode(gdb_cmd & cmd)
{
return send_cmd_ack("OK");
}
bool GDBDebugServer::cmd_reason(gdb_cmd & cmd)
{
return send_reason();
}
bool GDBDebugServer::cmd_supported(gdb_cmd & cmd)
{
return send_cmd_ack("PacketSize=1200");
}
bool GDBDebugServer::cmd_thread_info(gdb_cmd & cmd)
{
std::string result = "";
const auto on_select = [&](u32, cpu_thread& cpu)
{
if (result.length()) {
result += ",";
}
result += u64_to_padded_hex(static_cast<u64>(cpu.id));
};
idm::select<ppu_thread>(on_select);
idm::select<ARMv7Thread>(on_select);
idm::select<RawSPUThread>(on_select);
idm::select<SPUThread>(on_select);
//todo: this may exceed max command length
result = "m" + result + "l";
return send_cmd_ack(result);;
}
bool GDBDebugServer::cmd_current_thread(gdb_cmd & cmd)
{
return send_cmd_ack(selected_thread.expired() ? "" : u64_to_padded_hex(selected_thread.lock()->id));
}
bool GDBDebugServer::cmd_read_register(gdb_cmd & cmd)
{
select_thread(general_ops_thread_id);
auto th = selected_thread.lock();
if (th->id_type() == 1) {
auto ppu = std::static_pointer_cast<ppu_thread>(th);
u32 rid = hex_to_u32(cmd.data);
std::string result = get_reg(ppu, rid);
if (!result.length()) {
gdbDebugServer.warning("Wrong register id %d", rid);
return send_cmd_ack("E01");
}
return send_cmd_ack(result);
}
gdbDebugServer.warning("Unimplemented thread type %d", th->id_type());
return send_cmd_ack("");
}
bool GDBDebugServer::cmd_write_register(gdb_cmd & cmd)
{
select_thread(general_ops_thread_id);
auto th = selected_thread.lock();
if (th->id_type() == 1) {
auto ppu = std::static_pointer_cast<ppu_thread>(th);
size_t eq_pos = cmd.data.find('=');
if (eq_pos == std::string::npos) {
gdbDebugServer.warning("Wrong write_register cmd data %s", cmd.data.c_str());
return send_cmd_ack("E02");
}
u32 rid = hex_to_u32(cmd.data.substr(0, eq_pos));
std::string value = cmd.data.substr(eq_pos + 1);
if (!set_reg(ppu, rid, value)) {
gdbDebugServer.warning("Wrong register id %d", rid);
return send_cmd_ack("E01");
}
return send_cmd_ack("OK");
}
gdbDebugServer.warning("Unimplemented thread type %d", th->id_type());
return send_cmd_ack("");
}
bool GDBDebugServer::cmd_read_memory(gdb_cmd & cmd)
{
size_t s = cmd.data.find(',');
u32 addr = hex_to_u32(cmd.data.substr(0, s));
u32 len = hex_to_u32(cmd.data.substr(s + 1));
std::string result;
result.reserve(len * 2);
for (u32 i = 0; i < len; ++i) {
if (vm::check_addr(addr + i)) {
result += to_hexbyte(vm::read8(addr + i));
} else {
break;
//result += "xx";
}
}
if (len && !result.length()) {
//nothing read
return send_cmd_ack("E01");
}
return send_cmd_ack(result);
}
bool GDBDebugServer::cmd_write_memory(gdb_cmd & cmd)
{
size_t s = cmd.data.find(',');
size_t s2 = cmd.data.find(':');
if ((s == std::string::npos) || (s2 == std::string::npos)) {
gdbDebugServer.warning("Malformed write memory request received: %s", cmd.data.c_str());
return send_cmd_ack("E01");
}
u32 addr = hex_to_u32(cmd.data.substr(0, s));
u32 len = hex_to_u32(cmd.data.substr(s + 1, s2 - s - 1));
const char* data_ptr = (cmd.data.c_str()) + s2 + 1;
for (u32 i = 0; i < len; ++i) {
if (vm::check_addr(addr + i)) {
u8 val;
int res = sscanf_s(data_ptr, "%02hhX", &val);
if (!res) {
gdbDebugServer.warning("Couldn't read u8 from string %s", data_ptr);
return send_cmd_ack("E02");
}
data_ptr += 2;
vm::write8(addr + i, val);
} else {
return send_cmd_ack("E03");
}
}
return send_cmd_ack("OK");
}
bool GDBDebugServer::cmd_read_all_registers(gdb_cmd & cmd)
{
std::string result;
select_thread(general_ops_thread_id);
auto th = selected_thread.lock();
if (th->id_type() == 1) {
auto ppu = std::static_pointer_cast<ppu_thread>(th);
//68 64-bit registers, and 3 32-bit
result.reserve(68*16 + 3*8);
for (int i = 0; i < 71; ++i) {
result += get_reg(ppu, i);
}
return send_cmd_ack(result);
}
gdbDebugServer.warning("Unimplemented thread type %d", th->id_type());
return send_cmd_ack("");
}
bool GDBDebugServer::cmd_write_all_registers(gdb_cmd & cmd)
{
select_thread(general_ops_thread_id);
auto th = selected_thread.lock();
if (th->id_type() == 1) {
auto ppu = std::static_pointer_cast<ppu_thread>(th);
int ptr = 0;
for (int i = 0; i < 71; ++i) {
int sz = get_reg_size(ppu, i);
set_reg(ppu, i, cmd.data.substr(ptr, sz * 2));
ptr += sz * 2;
}
return send_cmd_ack("OK");
}
gdbDebugServer.warning("Unimplemented thread type %d", th->id_type());
return send_cmd_ack("E01");
}
bool GDBDebugServer::cmd_set_thread_ops(gdb_cmd & cmd)
{
char type = cmd.data[0];
std::string thread = cmd.data.substr(1);
u64 id = thread == "-1" ? ALL_THREADS : hex_to_u64(thread);
if (type == 'c') {
continue_ops_thread_id = id;
} else {
general_ops_thread_id = id;
}
if (select_thread(id)) {
return send_cmd_ack("OK");
}
gdbDebugServer.warning("Client asked to use thread %llx for %s, but no matching thread was found", id, type == 'c' ? "continue ops" : "general ops");
return send_cmd_ack("E01");
}
bool GDBDebugServer::cmd_attached_to_what(gdb_cmd & cmd)
{
//creating processes from client is not available yet
return send_cmd_ack("1");
}
bool GDBDebugServer::cmd_kill(gdb_cmd & cmd)
{
Emu.Stop();
return true;
}
bool GDBDebugServer::cmd_continue_support(gdb_cmd & cmd)
{
return send_cmd_ack("vCont;c;s;C;S");
}
bool GDBDebugServer::cmd_vcont(gdb_cmd & cmd)
{
//todo: handle multiple actions and thread ids
this->from_breakpoint = false;
if (cmd.data[1] == 'c') {
select_thread(continue_ops_thread_id);
auto ppu = std::static_pointer_cast<ppu_thread>(selected_thread.lock());
ppu->state -= cpu_flag::dbg_pause;
if (Emu.IsPaused()) {
Emu.Resume();
}
thread_ctrl::wait();
//we are in all-stop mode
Emu.Pause();
return send_reason();
} else if (cmd.data[1] == 's') {
select_thread(continue_ops_thread_id);
auto ppu = std::static_pointer_cast<ppu_thread>(selected_thread.lock());
ppu->state += cpu_flag::dbg_step;
ppu->state -= cpu_flag::dbg_pause;
if (Emu.IsPaused()) {
Emu.Resume();
} else {
ppu->notify();
}
thread_ctrl::wait();
//we are in all-stop mode
Emu.Pause();
return send_reason();
}
return send_cmd_ack("");
}
static const u32 INVALID_PTR = 0xffffffff;
bool GDBDebugServer::cmd_set_breakpoint(gdb_cmd & cmd)
{
char type = cmd.data[0];
//software breakpoint
if (type == '0') {
u32 addr = INVALID_PTR;
if (cmd.data.find(';') != std::string::npos) {
gdbDebugServer.warning("Received request to set breakpoint with condition, but they are not supported");
return send_cmd_ack("E01");
}
sscanf_s(cmd.data.c_str(), "0,%x", &addr);
if (addr == INVALID_PTR) {
gdbDebugServer.warning("Can't parse breakpoint request, data: %s", cmd.data.c_str());
return send_cmd_ack("E02");
}
ppu_set_breakpoint(addr);
return send_cmd_ack("OK");
}
//other breakpoint types are not supported
return send_cmd_ack("");
}
bool GDBDebugServer::cmd_remove_breakpoint(gdb_cmd & cmd)
{
char type = cmd.data[0];
//software breakpoint
if (type == '0') {
u32 addr = INVALID_PTR;
sscanf_s(cmd.data.c_str(), "0,%x", &addr);
if (addr == INVALID_PTR) {
gdbDebugServer.warning("Can't parse breakpoint remove request, data: %s", cmd.data.c_str());
return send_cmd_ack("E01");
}
ppu_remove_breakpoint(addr);
return send_cmd_ack("OK");
}
//other breakpoint types are not supported
return send_cmd_ack("");
}
#define PROCESS_CMD(cmds,handler) if (cmd.cmd == cmds) { if (!handler(cmd)) break; else continue; }
void GDBDebugServer::on_task()
{
sock_init();
start_server();
while (!stop) {
sockaddr_in client;
socklen_t client_len = sizeof(client);
client_socket = accept(server_socket, (struct sockaddr *) &client, &client_len);
if (client_socket == INVALID_SOCKET) {
if (check_errno_again()) {
thread_ctrl::wait_for(50);
continue;
}
gdbDebugServer.error("Could not establish new connection\n");
return;
}
//stop immediately
Emu.Pause();
try {
char hostbuf[32];
inet_ntop(client.sin_family, reinterpret_cast<void*>(&client.sin_addr), hostbuf, 32);
gdbDebugServer.success("Got connection to GDB debug server from %s:%d", hostbuf, client.sin_port);
gdb_cmd cmd;
while (!stop) {
if (!read_cmd(cmd)) {
break;
}
gdbDebugServer.trace("Command %s with data %s received", cmd.cmd.c_str(), cmd.data.c_str());
PROCESS_CMD("!", cmd_extended_mode);
PROCESS_CMD("?", cmd_reason);
PROCESS_CMD("qSupported", cmd_supported);
PROCESS_CMD("qfThreadInfo", cmd_thread_info);
PROCESS_CMD("qC", cmd_current_thread);
PROCESS_CMD("p", cmd_read_register);
PROCESS_CMD("P", cmd_write_register);
PROCESS_CMD("m", cmd_read_memory);
PROCESS_CMD("M", cmd_write_memory);
PROCESS_CMD("g", cmd_read_all_registers);
PROCESS_CMD("G", cmd_write_all_registers);
PROCESS_CMD("H", cmd_set_thread_ops);
PROCESS_CMD("qAttached", cmd_attached_to_what);
PROCESS_CMD("k", cmd_kill);
PROCESS_CMD("vCont?", cmd_continue_support);
PROCESS_CMD("vCont", cmd_vcont);
PROCESS_CMD("z", cmd_remove_breakpoint);
PROCESS_CMD("Z", cmd_set_breakpoint);
gdbDebugServer.trace("Unsupported command received %s", cmd.cmd.c_str());
if (!send_cmd_ack("")) {
break;
}
}
}
catch (std::runtime_error& e)
{
if (client_socket) {
closesocket(client_socket);
client_socket = 0;
}
gdbDebugServer.error(e.what());
}
}
}
#undef PROCESS_CMD
void GDBDebugServer::on_exit()
{
if (server_socket) {
closesocket(server_socket);
}
if (client_socket) {
closesocket(client_socket);
}
sock_quit();
}
std::string GDBDebugServer::get_name() const
{
return "GDBDebugger";
}
void GDBDebugServer::on_stop()
{
this->stop = true;
//just in case we are waiting for breakpoint
this->notify();
named_thread::on_stop();
}
u32 g_gdb_debugger_id = 0;
#ifndef _WIN32
#undef sscanf_s
#endif
#undef HEX_U32
#undef HEX_U64
#endif
-131
View File
@@ -1,131 +0,0 @@
#pragma once
#ifdef WITH_GDB_DEBUGGER
#include "Thread.h"
#include <Emu/IdManager.h>
#include "Emu/CPU/CPUThread.h"
#include "Emu/Cell/PPUThread.h"
#ifdef _WIN32
#include <winsock2.h>
#include <WS2tcpip.h>
#else
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <unistd.h>
#endif
#ifdef _WIN32
using socket_t = SOCKET;
#else
using socket_t = int;
#endif
typedef struct gdb_cmd {
std::string cmd;
std::string data;
u8 checksum;
} gdb_cmd;
class wrong_checksum_exception : public std::runtime_error {
public:
wrong_checksum_exception(char const* const message) : runtime_error(message) {}
};
const u64 ALL_THREADS = 0xffffffffffffffff;
const u64 ANY_THREAD = 0;
class GDBDebugServer : public named_thread {
socket_t server_socket;
socket_t client_socket;
std::weak_ptr<cpu_thread> selected_thread;
u64 continue_ops_thread_id = ANY_THREAD;
u64 general_ops_thread_id = ANY_THREAD;
//initialize server socket and start listening
void start_server();
//read at most cnt bytes to buf, returns nubmer of bytes actually read
int read(void* buf, int cnt);
//reads one character
char read_char();
//reads pairs of hex characters and returns their integer value
u8 read_hexbyte();
//tries to read command, throws exceptions if anything goes wrong
void try_read_cmd(gdb_cmd& out_cmd);
//reads commands until receiveing one with valid checksum
//in case of other exception (i.e. wrong first char of command)
//it will log exception text and return false
//in that case best for caller would be to stop reading, because
//chance of getting correct command is low
bool read_cmd(gdb_cmd& out_cmd);
//send cnt bytes from buf to client
void send(const char* buf, int cnt);
//send character to client
void send_char(char c);
//acknowledge packet, either as accepted or declined
void ack(bool accepted);
//sends command body cmd to client
void send_cmd(const std::string & cmd);
//sends command to client until receives positive acknowledgement
//returns false in case some error happened, and command wasn't sent
bool send_cmd_ack(const std::string & cmd);
//appends encoded char c to string str, and returns checksum. encoded byte can occupy 2 bytes
static u8 append_encoded_char(char c, std::string& str);
//convert u8 to 2 byte hexademical representation
static std::string to_hexbyte(u8 i);
//choose thread, support ALL_THREADS and ANY_THREAD values, returns true if some thread was selected
bool select_thread(u64 id);
//returns register value as hex string by register id (in gdb), in case of wrong id returns empty string
static std::string get_reg(std::shared_ptr<ppu_thread> thread, u32 rid);
//sets register value to hex string by register id (in gdb), in case of wrong id returns false
static bool set_reg(std::shared_ptr<ppu_thread> thread, u32 rid, std::string value);
//returns size of register with id rid in bytes, zero if invalid rid is provided
static u32 get_reg_size(std::shared_ptr<ppu_thread> thread, u32 rid);
//send reason of stop, returns false if sending response failed
bool send_reason();
//commands
bool cmd_extended_mode(gdb_cmd& cmd);
bool cmd_reason(gdb_cmd& cmd);
bool cmd_supported(gdb_cmd& cmd);
bool cmd_thread_info(gdb_cmd& cmd);
bool cmd_current_thread(gdb_cmd& cmd);
bool cmd_read_register(gdb_cmd& cmd);
bool cmd_write_register(gdb_cmd& cmd);
bool cmd_read_memory(gdb_cmd& cmd);
bool cmd_write_memory(gdb_cmd& cmd);
bool cmd_read_all_registers(gdb_cmd& cmd);
bool cmd_write_all_registers(gdb_cmd& cmd);
bool cmd_set_thread_ops(gdb_cmd& cmd);
bool cmd_attached_to_what(gdb_cmd& cmd);
bool cmd_kill(gdb_cmd& cmd);
bool cmd_continue_support(gdb_cmd& cmd);
bool cmd_vcont(gdb_cmd& cmd);
bool cmd_set_breakpoint(gdb_cmd& cmd);
bool cmd_remove_breakpoint(gdb_cmd& cmd);
protected:
void on_task() override final;
void on_exit() override final;
public:
static const u32 id_base = 1;
static const u32 id_step = 1;
static const u32 id_count = 0x100000;
bool from_breakpoint = true;
bool stop = false;
virtual std::string get_name() const;
virtual void on_stop() override final;
};
extern u32 g_gdb_debugger_id;
#endif
+2 -2
View File
@@ -1,10 +1,10 @@
#pragma once
#pragma once
#define GSL_THROW_ON_CONTRACT_VIOLATION
#pragma push_macro("new")
#undef new
#include <gsl.h>
#include <gsl>
#pragma pop_macro("new")
#undef Expects
#undef Ensures
+138 -290
View File
@@ -5,14 +5,11 @@
#include <unordered_set>
#include <set>
#include <array>
#include <deque>
#include "types.h"
#include "StrFmt.h"
#include "File.h"
#include "Log.h"
#include "mutex.h"
#include "sysinfo.h"
#include "VirtualMemory.h"
#ifdef _MSC_VER
@@ -23,21 +20,18 @@
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
#include "llvm/ExecutionEngine/JITEventListener.h"
#include "llvm/ExecutionEngine/ObjectCache.h"
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#ifdef _WIN32
#include <Windows.h>
#else
#include <sys/mman.h>
#endif
#include "JIT.h"
// Memory manager mutex
shared_mutex s_mutex;
// Global LLVM context (thread-unsafe)
llvm::LLVMContext g_llvm_ctx;
// Size of virtual memory area reserved: 512 MB
static const u64 s_memory_size = 0x20000000;
@@ -45,15 +39,6 @@ static const u64 s_memory_size = 0x20000000;
// Try to reserve a portion of virtual memory in the first 2 GB address space beforehand, if possible.
static void* const s_memory = []() -> void*
{
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
LLVMLinkInMCJIT();
#ifdef MAP_32BIT
auto ptr = ::mmap(nullptr, s_memory_size, PROT_NONE, MAP_ANON | MAP_PRIVATE | MAP_32BIT, -1, 0);
if (ptr != MAP_FAILED)
return ptr;
#else
for (u64 addr = 0x10000000; addr <= 0x80000000 - s_memory_size; addr += 0x1000000)
{
if (auto ptr = utils::memory_reserve(s_memory_size, (void*)addr))
@@ -61,76 +46,29 @@ static void* const s_memory = []() -> void*
return ptr;
}
}
#endif
return utils::memory_reserve(s_memory_size);
}();
static void* s_next = s_memory;
// Code section
static u8* s_code_addr;
static u64 s_code_size;
#ifdef _WIN32
static std::deque<std::vector<RUNTIME_FUNCTION>> s_unwater;
static std::vector<std::vector<RUNTIME_FUNCTION>> s_unwind; // .pdata
#else
static std::deque<std::tuple<u8*, u64, std::size_t>> s_unfire;
#endif
// Reset memory manager
extern void jit_finalize()
{
#ifdef _WIN32
for (auto&& unwind : s_unwind)
{
if (!RtlDeleteFunctionTable(unwind.data()))
{
LOG_FATAL(GENERAL, "RtlDeleteFunctionTable() failed! Error %u", GetLastError());
}
}
s_unwind.clear();
#else
struct MemoryManager : llvm::RTDyldMemoryManager
{
u8* allocateCodeSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name) override
{
return nullptr;
}
u8* allocateDataSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name, bool is_ro) override
{
return nullptr;
}
bool finalizeMemory(std::string* = nullptr) override
{
return false;
}
} mem;
for (auto&& t : s_unfire)
{
mem.deregisterEHFrames(std::get<0>(t), std::get<1>(t), std::get<2>(t));
}
s_unfire.clear();
#endif
utils::memory_decommit(s_memory, s_memory_size);
s_next = s_memory;
}
// Helper class
struct MemoryManager : llvm::RTDyldMemoryManager
struct MemoryManager final : llvm::RTDyldMemoryManager
{
std::unordered_map<std::string, u64>& m_link;
std::unordered_map<std::string, std::uintptr_t>& m_link;
std::array<u8, 16>* m_tramps{};
std::array<u8, 16>* m_tramps;
u8* m_code_addr{}; // TODO
MemoryManager(std::unordered_map<std::string, u64>& table)
MemoryManager(std::unordered_map<std::string, std::uintptr_t>& table)
: m_link(table)
, m_next(s_memory)
, m_tramps(nullptr)
{
}
@@ -139,7 +77,7 @@ struct MemoryManager : llvm::RTDyldMemoryManager
fmt::throw_exception("Null function" HERE);
}
llvm::JITSymbol findSymbol(const std::string& name) override
virtual u64 getSymbolAddress(const std::string& name) override
{
auto& addr = m_link[name];
@@ -154,6 +92,7 @@ struct MemoryManager : llvm::RTDyldMemoryManager
}
else
{
// It's fine if some function is never called, for example.
LOG_ERROR(GENERAL, "LLVM: Linkage failed: %s", name);
addr = (u64)null;
}
@@ -162,15 +101,12 @@ struct MemoryManager : llvm::RTDyldMemoryManager
// Verify address for small code model
if ((u64)s_memory > 0x80000000 - s_memory_size ? (u64)addr - (u64)s_memory >= s_memory_size : addr >= 0x80000000)
{
// Lock memory manager
writer_lock lock(s_mutex);
// Allocate memory for trampolines
if (!m_tramps)
{
m_tramps = reinterpret_cast<decltype(m_tramps)>(s_next);
utils::memory_commit(s_next, 4096, utils::protection::wx);
s_next = (u8*)((u64)s_next + 4096);
m_tramps = reinterpret_cast<decltype(m_tramps)>(m_next);
utils::memory_commit(m_next, 4096, utils::protection::wx);
m_next = (u8*)((u64)m_next + 4096);
}
// Create a trampoline
@@ -193,16 +129,13 @@ struct MemoryManager : llvm::RTDyldMemoryManager
}
}
return {addr, llvm::JITSymbolFlags::Exported};
return addr;
}
u8* allocateCodeSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name) override
virtual u8* allocateCodeSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name) override
{
// Lock memory manager
writer_lock lock(s_mutex);
// Simple allocation
const u64 next = ::align((u64)s_next + size, 4096);
const u64 next = ::align((u64)m_next + size, 4096);
if (next > (u64)s_memory + s_memory_size)
{
@@ -210,20 +143,18 @@ struct MemoryManager : llvm::RTDyldMemoryManager
return nullptr;
}
utils::memory_commit(s_next, size, utils::protection::wx);
m_code_addr = (u8*)s_next;
utils::memory_commit(m_next, size, utils::protection::wx);
s_code_addr = (u8*)m_next;
s_code_size = size;
LOG_NOTICE(GENERAL, "LLVM: Code section %u '%s' allocated -> %p (size=0x%llx, aligned 0x%x)", sec_id, sec_name.data(), s_next, size, align);
return (u8*)std::exchange(s_next, (void*)next);
LOG_NOTICE(GENERAL, "LLVM: Code section %u '%s' allocated -> %p (size=0x%llx, aligned 0x%x)", sec_id, sec_name.data(), m_next, size, align);
return (u8*)std::exchange(m_next, (void*)next);
}
u8* allocateDataSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name, bool is_ro) override
virtual u8* allocateDataSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name, bool is_ro) override
{
// Lock memory manager
writer_lock lock(s_mutex);
// Simple allocation
const u64 next = ::align((u64)s_next + size, 4096);
const u64 next = ::align((u64)m_next + size, 4096);
if (next > (u64)s_memory + s_memory_size)
{
@@ -236,17 +167,14 @@ struct MemoryManager : llvm::RTDyldMemoryManager
LOG_ERROR(GENERAL, "LLVM: Writeable data section not supported!");
}
utils::memory_commit(s_next, size);
utils::memory_commit(m_next, size);
LOG_NOTICE(GENERAL, "LLVM: Data section %u '%s' allocated -> %p (size=0x%llx, aligned 0x%x, %s)", sec_id, sec_name.data(), s_next, size, align, is_ro ? "ro" : "rw");
return (u8*)std::exchange(s_next, (void*)next);
LOG_NOTICE(GENERAL, "LLVM: Data section %u '%s' allocated -> %p (size=0x%llx, aligned 0x%x, %s)", sec_id, sec_name.data(), m_next, size, align, is_ro ? "ro" : "rw");
return (u8*)std::exchange(m_next, (void*)next);
}
bool finalizeMemory(std::string* = nullptr) override
virtual bool finalizeMemory(std::string* = nullptr) override
{
// Lock memory manager
writer_lock lock(s_mutex);
// TODO: make only read-only sections read-only
//#ifdef _WIN32
// DWORD op;
@@ -259,22 +187,21 @@ struct MemoryManager : llvm::RTDyldMemoryManager
return false;
}
void registerEHFrames(u8* addr, u64 load_addr, std::size_t size) override
virtual void registerEHFrames(u8* addr, u64 load_addr, std::size_t size) override
{
#ifdef _WIN32
// Lock memory manager
writer_lock lock(s_mutex);
// Use s_memory as a BASE, compute the difference
const u64 code_diff = (u64)s_code_addr - (u64)s_memory;
const u64 unwind_diff = (u64)addr - (u64)s_memory;
// Fix RUNTIME_FUNCTION records (.pdata section)
auto pdata = std::move(s_unwater.front());
s_unwater.pop_front();
auto& pdata = s_unwind.back();
for (auto& rf : pdata)
{
rf.UnwindData += static_cast<DWORD>(unwind_diff);
rf.BeginAddress += static_cast<DWORD>(code_diff);
rf.EndAddress += static_cast<DWORD>(code_diff);
rf.UnwindData += static_cast<DWORD>(unwind_diff);
}
// Register .xdata UNWIND_INFO structs
@@ -282,34 +209,54 @@ struct MemoryManager : llvm::RTDyldMemoryManager
{
LOG_ERROR(GENERAL, "RtlAddFunctionTable() failed! Error %u", GetLastError());
}
else
{
s_unwind.emplace_back(std::move(pdata));
}
#else
s_unfire.push_front(std::make_tuple(addr, load_addr, size));
#endif
return RTDyldMemoryManager::registerEHFrames(addr, load_addr, size);
}
void deregisterEHFrames(u8* addr, u64 load_addr, std::size_t size) override
virtual void deregisterEHFrames(u8* addr, u64 load_addr, std::size_t size) override
{
LOG_ERROR(GENERAL, "deregisterEHFrames() called"); // Not expected
return RTDyldMemoryManager::deregisterEHFrames(addr, load_addr, size);
}
~MemoryManager()
{
#ifdef _WIN32
for (auto&& unwind : s_unwind)
{
if (!RtlDeleteFunctionTable(unwind.data()))
{
LOG_FATAL(GENERAL, "RtlDeleteFunctionTable() failed! Error %u", GetLastError());
}
}
s_unwind.clear();
#else
// TODO: unregister EH frames if necessary
#endif
utils::memory_decommit(s_memory, s_memory_size);
}
private:
void* m_next;
};
// Helper class
struct EventListener : llvm::JITEventListener
struct EventListener final : llvm::JITEventListener
{
MemoryManager& m_mem;
std::string path;
EventListener(MemoryManager& mem)
: m_mem(mem)
virtual void NotifyObjectEmitted(const llvm::object::ObjectFile& obj, const llvm::RuntimeDyld::LoadedObjectInfo& inf) override
{
}
if (!path.empty())
{
const llvm::StringRef elf = obj.getData();
fs::file(path, fs::rewrite).write(elf.data(), elf.size());
}
void NotifyObjectEmitted(const llvm::object::ObjectFile& obj, const llvm::RuntimeDyld::LoadedObjectInfo& inf) override
{
#ifdef _WIN32
for (auto it = obj.section_begin(), end = obj.section_end(); it != end; ++it)
{
@@ -335,198 +282,99 @@ struct EventListener : llvm::JITEventListener
}
}
// Lock memory manager
writer_lock lock(s_mutex);
// Use s_memory as a BASE, compute the difference
const u64 code_diff = (u64)m_mem.m_code_addr - (u64)s_memory;
// Fix RUNTIME_FUNCTION records (.pdata section)
for (auto& rf : rfs)
{
rf.BeginAddress += static_cast<DWORD>(code_diff);
rf.EndAddress += static_cast<DWORD>(code_diff);
}
s_unwater.emplace_back(std::move(rfs));
s_unwind.emplace_back(std::move(rfs));
}
}
#endif
}
};
// Helper class
class ObjectCache final : public llvm::ObjectCache
{
const std::string& m_path;
static EventListener s_listener;
public:
ObjectCache(const std::string& path)
: m_path(path)
{
}
~ObjectCache() override = default;
void notifyObjectCompiled(const llvm::Module* module, llvm::MemoryBufferRef obj) override
{
std::string name = m_path;
name.append(module->getName());
fs::file(name, fs::rewrite).write(obj.getBufferStart(), obj.getBufferSize());
LOG_SUCCESS(GENERAL, "LLVM: Created module: %s", module->getName().data());
}
static std::unique_ptr<llvm::MemoryBuffer> load(const std::string& path)
{
if (fs::file cached{path, fs::read})
{
auto buf = llvm::MemoryBuffer::getNewUninitMemBuffer(cached.size());
cached.read(const_cast<char*>(buf->getBufferStart()), buf->getBufferSize());
return buf;
}
return nullptr;
}
std::unique_ptr<llvm::MemoryBuffer> getObject(const llvm::Module* module) override
{
std::string path = m_path;
path.append(module->getName());
if (auto buf = load(path))
{
LOG_SUCCESS(GENERAL, "LLVM: Loaded module: %s", module->getName().data());
return buf;
}
return nullptr;
}
};
jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, std::string _cpu)
: m_link(_link)
jit_compiler::jit_compiler(std::unordered_map<std::string, std::uintptr_t> init_linkage_info, std::string _cpu)
: m_link(std::move(init_linkage_info))
, m_cpu(std::move(_cpu))
{
// Initialization
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
LLVMLinkInMCJIT();
if (m_cpu.empty())
{
m_cpu = llvm::sys::getHostCPUName();
if (m_cpu == "sandybridge" ||
m_cpu == "ivybridge" ||
m_cpu == "haswell" ||
m_cpu == "broadwell" ||
m_cpu == "skylake" ||
m_cpu == "skylake-avx512" ||
m_cpu == "cannonlake")
{
if (!utils::has_avx())
{
m_cpu = "nehalem";
}
}
}
std::string result;
if (m_link.empty())
{
// Auxiliary JIT (does not use custom memory manager, only writes the objects)
m_engine.reset(llvm::EngineBuilder(std::make_unique<llvm::Module>("null_", m_context))
.setErrorStr(&result)
.setOptLevel(llvm::CodeGenOpt::Aggressive)
.setCodeModel(llvm::CodeModel::Small)
.setMCPU(m_cpu)
.create());
}
else
{
// Primary JIT
auto mem = std::make_unique<MemoryManager>(m_link);
m_jit_el = std::make_unique<EventListener>(*mem);
m_engine.reset(llvm::EngineBuilder(std::make_unique<llvm::Module>("null", m_context))
.setErrorStr(&result)
.setMCJITMemoryManager(std::move(mem))
.setOptLevel(llvm::CodeGenOpt::Aggressive)
.setCodeModel(llvm::CodeModel::Small)
.setMCPU(m_cpu)
.create());
if (m_engine)
{
m_engine->RegisterJITEventListener(m_jit_el.get());
}
}
m_engine.reset(llvm::EngineBuilder(std::make_unique<llvm::Module>("", g_llvm_ctx))
.setErrorStr(&result)
.setMCJITMemoryManager(std::make_unique<MemoryManager>(m_link))
.setOptLevel(llvm::CodeGenOpt::Aggressive)
.setCodeModel(llvm::CodeModel::Small)
.setMCPU(m_cpu)
.create());
if (!m_engine)
{
fmt::throw_exception("LLVM: Failed to create ExecutionEngine: %s", result);
}
m_engine->RegisterJITEventListener(&s_listener);
}
void jit_compiler::load(std::unique_ptr<llvm::Module> module, std::unique_ptr<llvm::object::ObjectFile> object)
{
s_listener.path.clear();
auto* module_ptr = module.get();
m_engine->addModule(std::move(module));
m_engine->addObjectFile(std::move(object));
m_engine->finalizeObject();
m_map.clear();
for (auto& func : module_ptr->functions())
{
const std::string& name = func.getName();
if (!m_link.count(name))
{
// Register compiled function
m_map[name] = m_engine->getFunctionAddress(name);
}
}
}
void jit_compiler::make(std::unique_ptr<llvm::Module> module, std::string path)
{
s_listener.path = std::move(path);
auto* module_ptr = module.get();
m_engine->addModule(std::move(module));
m_engine->finalizeObject();
m_map.clear();
for (auto& func : module_ptr->functions())
{
if (!func.empty())
{
const std::string& name = func.getName();
// Register compiled function
m_map[name] = m_engine->getFunctionAddress(name);
}
// Delete IR to lower memory consumption
func.deleteBody();
}
}
jit_compiler::~jit_compiler()
{
}
void jit_compiler::add(std::unique_ptr<llvm::Module> module, const std::string& path)
{
ObjectCache cache{path};
m_engine->setObjectCache(&cache);
const auto ptr = module.get();
m_engine->addModule(std::move(module));
m_engine->generateCodeForModule(ptr);
m_engine->setObjectCache(nullptr);
for (auto& func : ptr->functions())
{
// Delete IR to lower memory consumption
func.deleteBody();
}
}
void jit_compiler::add(const std::string& path)
{
m_engine->addObjectFile(std::move(llvm::object::ObjectFile::createObjectFile(*ObjectCache::load(path)).get()));
}
void jit_compiler::fin()
{
m_engine->finalizeObject();
}
u64 jit_compiler::get(const std::string& name)
{
return m_engine->getGlobalValueAddress(name);
}
std::unordered_map<std::string, u64> jit_compiler::add(std::unordered_map<std::string, std::string> data)
{
// Lock memory manager
writer_lock lock(s_mutex);
std::unordered_map<std::string, u64> result;
std::size_t size = 0;
for (auto&& pair : data)
{
size += ::align(pair.second.size(), 16);
}
utils::memory_commit(s_next, size, utils::protection::wx);
std::memset(s_next, 0xc3, ::align(size, 4096));
for (auto&& pair : data)
{
std::memcpy(s_next, pair.second.data(), pair.second.size());
result.emplace(pair.first, (u64)s_next);
s_next = (void*)::align((u64)s_next + pair.second.size(), 16);
}
s_next = (void*)::align((u64)s_next, 4096);
return result;
}
#endif
+22 -32
View File
@@ -7,7 +7,6 @@
#include <unordered_map>
#include "types.h"
#include "mutex.h"
#include "restore_new.h"
#ifdef _MSC_VER
@@ -21,60 +20,51 @@
#endif
#include "define_new_memleakdetect.h"
extern llvm::LLVMContext g_llvm_ctx;
// Temporary compiler interface
class jit_compiler final
{
// Local LLVM context
llvm::LLVMContext m_context;
// JIT Event Listener
std::unique_ptr<struct EventListener> m_jit_el;
// Execution instance
std::unique_ptr<llvm::ExecutionEngine> m_engine;
// Link table
std::unordered_map<std::string, u64> m_link;
// Compiled functions
std::unordered_map<std::string, std::uintptr_t> m_map;
// Linkage cache
std::unordered_map<std::string, std::uintptr_t> m_link;
// Arch
std::string m_cpu;
public:
jit_compiler(const std::unordered_map<std::string, u64>& _link, std::string _cpu);
jit_compiler(std::unordered_map<std::string, std::uintptr_t>, std::string _cpu);
~jit_compiler();
// Get LLVM context
auto& get_context()
{
return m_context;
}
// Compile module
void make(std::unique_ptr<llvm::Module>, std::string);
// Add module (path to obj cache dir)
void add(std::unique_ptr<llvm::Module> module, const std::string& path);
// Add object (path to obj file)
void add(const std::string& path);
// Finalize
void fin();
// Load object
void load(std::unique_ptr<llvm::Module>, std::unique_ptr<llvm::object::ObjectFile>);
// Get compiled function address
u64 get(const std::string& name);
std::uintptr_t get(const std::string& name) const
{
const auto found = m_map.find(name);
if (found != m_map.end())
{
return found->second;
}
// Add functions directly to the memory manager (name -> code)
static std::unordered_map<std::string, u64> add(std::unordered_map<std::string, std::string>);
return 0;
}
// Get CPU info
const std::string& cpu() const
{
return m_cpu;
}
// Check JIT purpose
bool is_primary() const
{
return !m_link.empty();
}
};
#endif
+23
View File
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-265
View File
@@ -1,265 +0,0 @@
/*
* Lightweight URL & URI parser (RFC 1738, RFC 3986)
* https://github.com/corporateshark/LUrlParser
*
* The MIT License (MIT)
*
* Copyright (C) 2015 Sergey Kosarevsky (sk@linderdaum.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "LUrlParser.h"
#include <algorithm>
#include <cstring>
#include <stdlib.h>
// check if the scheme name is valid
static bool IsSchemeValid( const std::string& SchemeName )
{
for ( auto c : SchemeName )
{
if ( !isalpha( c ) && c != '+' && c != '-' && c != '.' ) return false;
}
return true;
}
bool LUrlParser::clParseURL::GetPort( int* OutPort ) const
{
if ( !IsValid() ) { return false; }
int Port = atoi( m_Port.c_str() );
if ( Port <= 0 || Port > 65535 ) { return false; }
if ( OutPort ) { *OutPort = Port; }
return true;
}
// based on RFC 1738 and RFC 3986
LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL )
{
LUrlParser::clParseURL Result;
const char* CurrentString = URL.c_str();
/*
* <scheme>:<scheme-specific-part>
* <scheme> := [a-z\+\-\.]+
* For resiliency, programs interpreting URLs should treat upper case letters as equivalent to lower case in scheme names
*/
// try to read scheme
{
const char* LocalString = strchr( CurrentString, ':' );
if ( !LocalString )
{
return clParseURL( LUrlParserError_NoUrlCharacter );
}
// save the scheme name
Result.m_Scheme = std::string( CurrentString, LocalString - CurrentString );
if ( !IsSchemeValid( Result.m_Scheme ) )
{
return clParseURL( LUrlParserError_InvalidSchemeName );
}
// scheme should be lowercase
std::transform( Result.m_Scheme.begin(), Result.m_Scheme.end(), Result.m_Scheme.begin(), ::tolower );
// skip ':'
CurrentString = LocalString+1;
}
/*
* //<user>:<password>@<host>:<port>/<url-path>
* any ":", "@" and "/" must be normalized
*/
// skip "//"
if ( *CurrentString++ != '/' ) return clParseURL( LUrlParserError_NoDoubleSlash );
if ( *CurrentString++ != '/' ) return clParseURL( LUrlParserError_NoDoubleSlash );
// check if the user name and password are specified
bool bHasUserName = false;
const char* LocalString = CurrentString;
while ( *LocalString )
{
if ( *LocalString == '@' )
{
// user name and password are specified
bHasUserName = true;
break;
}
else if ( *LocalString == '/' )
{
// end of <host>:<port> specification
bHasUserName = false;
break;
}
LocalString++;
}
// user name and password
LocalString = CurrentString;
if ( bHasUserName )
{
// read user name
while ( *LocalString && *LocalString != ':' && *LocalString != '@' ) LocalString++;
Result.m_UserName = std::string( CurrentString, LocalString - CurrentString );
// proceed with the current pointer
CurrentString = LocalString;
if ( *CurrentString == ':' )
{
// skip ':'
CurrentString++;
// read password
LocalString = CurrentString;
while ( *LocalString && *LocalString != '@' ) LocalString++;
Result.m_Password = std::string( CurrentString, LocalString - CurrentString );
CurrentString = LocalString;
}
// skip '@'
if ( *CurrentString != '@' )
{
return clParseURL( LUrlParserError_NoAtSign );
}
CurrentString++;
}
bool bHasBracket = ( *CurrentString == '[' );
// go ahead, read the host name
LocalString = CurrentString;
while ( *LocalString )
{
if ( bHasBracket && *LocalString == ']' )
{
// end of IPv6 address
LocalString++;
break;
}
else if ( !bHasBracket && ( *LocalString == ':' || *LocalString == '/' ) )
{
// port number is specified
break;
}
LocalString++;
}
Result.m_Host = std::string( CurrentString, LocalString - CurrentString );
CurrentString = LocalString;
// is port number specified?
if ( *CurrentString == ':' )
{
CurrentString++;
// read port number
LocalString = CurrentString;
while ( *LocalString && *LocalString != '/' ) LocalString++;
Result.m_Port = std::string( CurrentString, LocalString - CurrentString );
CurrentString = LocalString;
}
// end of string
if ( !*CurrentString )
{
Result.m_ErrorCode = LUrlParserError_Ok;
return Result;
}
// skip '/'
if ( *CurrentString != '/' )
{
return clParseURL( LUrlParserError_NoSlash );
}
CurrentString++;
// parse the path
LocalString = CurrentString;
while ( *LocalString && *LocalString != '#' && *LocalString != '?' ) LocalString++;
Result.m_Path = std::string( CurrentString, LocalString - CurrentString );
CurrentString = LocalString;
// check for query
if ( *CurrentString == '?' )
{
// skip '?'
CurrentString++;
// read query
LocalString = CurrentString;
while ( *LocalString && *LocalString != '#' ) LocalString++;
Result.m_Query = std::string( CurrentString, LocalString - CurrentString );
CurrentString = LocalString;
}
// check for fragment
if ( *CurrentString == '#' )
{
// skip '#'
CurrentString++;
// read fragment
LocalString = CurrentString;
while ( *LocalString ) LocalString++;
Result.m_Fragment = std::string( CurrentString, LocalString - CurrentString );
CurrentString = LocalString;
}
Result.m_ErrorCode = LUrlParserError_Ok;
return Result;
}
-78
View File
@@ -1,78 +0,0 @@
/*
* Lightweight URL & URI parser (RFC 1738, RFC 3986)
* https://github.com/corporateshark/LUrlParser
*
* The MIT License (MIT)
*
* Copyright (C) 2015 Sergey Kosarevsky (sk@linderdaum.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#pragma once
#include <string>
namespace LUrlParser
{
enum LUrlParserError
{
LUrlParserError_Ok = 0,
LUrlParserError_Uninitialized = 1,
LUrlParserError_NoUrlCharacter = 2,
LUrlParserError_InvalidSchemeName = 3,
LUrlParserError_NoDoubleSlash = 4,
LUrlParserError_NoAtSign = 5,
LUrlParserError_UnexpectedEndOfLine = 6,
LUrlParserError_NoSlash = 7,
};
class clParseURL
{
public:
LUrlParserError m_ErrorCode;
std::string m_Scheme;
std::string m_Host;
std::string m_Port;
std::string m_Path;
std::string m_Query;
std::string m_Fragment;
std::string m_UserName;
std::string m_Password;
clParseURL()
: m_ErrorCode( LUrlParserError_Uninitialized )
{}
/// return 'true' if the parsing was successful
bool IsValid() const { return m_ErrorCode == LUrlParserError_Ok; }
/// helper to convert the port number to int, return 'true' if the port is valid (within the 0..65535 range)
bool GetPort( int* OutPort ) const;
/// parse the URL
static clParseURL ParseURL( const std::string& URL );
private:
explicit clParseURL( LUrlParserError ErrorCode )
: m_ErrorCode( ErrorCode )
{}
};
} // namespace LUrlParser
+33 -436
View File
@@ -1,34 +1,18 @@
#include "Log.h"
#include "File.h"
#include "StrFmt.h"
#include "sema.h"
#include "Utilities/sysinfo.h"
#include "Utilities/Thread.h"
#include "rpcs3_version.h"
#include <string>
#include <unordered_map>
#include <thread>
#include <chrono>
using namespace std::literals::chrono_literals;
#ifdef _WIN32
#define NOMINMAX
#include <Windows.h>
#else
#include <sys/mman.h>
#include <chrono>
#endif
#include <zlib.h>
static std::string empty_string()
{
return {};
}
// Thread-specific log prefix provider
thread_local std::string(*g_tls_log_prefix)() = &empty_string;
thread_local std::string(*g_tls_log_prefix)() = nullptr;
template<>
void fmt_class_string<logs::level>::format(std::string& out, u64 arg)
@@ -45,7 +29,6 @@ void fmt_class_string<logs::level>::format(std::string& out, u64 arg)
case logs::level::warning: return "Warning";
case logs::level::notice: return "Notice";
case logs::level::trace: return "Trace";
case logs::level::_uninit: return unknown;
}
return unknown;
@@ -54,86 +37,38 @@ void fmt_class_string<logs::level>::format(std::string& out, u64 arg)
namespace logs
{
// Memory-mapped buffer size
constexpr u64 s_log_size = 32 * 1024 * 1024;
class file_writer
{
// Could be memory-mapped file
fs::file m_file;
std::string m_name;
std::thread m_writer;
fs::file m_fout;
fs::file m_fout2;
u64 m_max_size;
#ifdef _WIN32
::HANDLE m_fmap;
#endif
uchar* m_fptr{};
z_stream m_zs{};
semaphore<> m_m;
alignas(128) atomic_t<u64> m_buf{0}; // MSB (40 bit): push begin, LSB (24 bis): push size
alignas(128) atomic_t<u64> m_out{0}; // Amount of bytes written to file
uchar m_zout[65536];
// Write buffered logs immediately
bool flush(u64 bufv);
public:
file_writer(const std::string& name);
virtual ~file_writer();
virtual ~file_writer() = default;
// Append raw data
void log(logs::level sev, const char* text, std::size_t size);
};
struct channel_info
{
channel* pointer = nullptr;
level enabled = level::notice;
void set_level(level value)
{
enabled = value;
if (pointer)
{
pointer->enabled = value;
}
}
};
struct stored_message
{
message m;
u64 stamp;
std::string prefix;
std::string text;
void log(const char* text, std::size_t size);
};
struct file_listener : public file_writer, public listener
{
file_listener(const std::string& name);
virtual ~file_listener() = default;
file_listener(const std::string& name)
: file_writer(name)
, listener()
{
const std::string& start = fmt::format("\xEF\xBB\xBF" "RPCS3 v%s\n", rpcs3::version.to_string());
file_writer::log(start.data(), start.size());
}
// Encode level, current thread name, channel name and write log message
virtual void log(u64 stamp, const message& msg, const std::string& prefix, const std::string& text) override;
// Channel registry
std::unordered_map<std::string, channel_info> channels;
// Messages for delayed listener initialization
std::vector<stored_message> messages;
};
static file_listener* get_logger()
{
// Use magic static
static file_listener logger("RPCS3");
static file_listener logger("RPCS3.log");
return &logger;
}
@@ -170,48 +105,14 @@ namespace logs
return timebase.get();
}
channel GENERAL("");
channel LOADER("LDR");
channel MEMORY("MEM");
channel RSX("RSX");
channel HLE("HLE");
channel PPU("PPU");
channel SPU("SPU");
channel GENERAL(nullptr, level::notice);
channel LOADER("LDR", level::notice);
channel MEMORY("MEM", level::notice);
channel RSX("RSX", level::notice);
channel HLE("HLE", level::notice);
channel PPU("PPU", level::notice);
channel SPU("SPU", level::notice);
channel ARMv7("ARMv7");
// Channel registry mutex
semaphore<> g_mutex;
// Must be set to true in main()
atomic_t<bool> g_init{false};
void reset()
{
semaphore_lock lock(g_mutex);
for (auto&& pair : get_logger()->channels)
{
pair.second.set_level(level::notice);
}
}
void set_level(const std::string& ch_name, level value)
{
semaphore_lock lock(g_mutex);
get_logger()->channels[ch_name].set_level(value);
}
// Must be called in main() to stop accumulating messages in g_messages
void set_init()
{
if (!g_init)
{
semaphore_lock lock(g_mutex);
get_logger()->messages.clear();
g_init = true;
}
}
}
logs::listener::~listener()
@@ -223,19 +124,11 @@ void logs::listener::add(logs::listener* _new)
// Get first (main) listener
listener* lis = get_logger();
semaphore_lock lock(g_mutex);
// Install new listener at the end of linked list
while (lis->m_next || !lis->m_next.compare_and_swap_test(nullptr, _new))
{
lis = lis->m_next;
}
// Send initial messages
for (const auto& msg : get_logger()->messages)
{
_new->log(msg.stamp, msg.m, msg.prefix, msg.text);
}
}
void logs::message::broadcast(const char* fmt, const fmt_type_info* sup, const u64* args)
@@ -243,55 +136,12 @@ void logs::message::broadcast(const char* fmt, const fmt_type_info* sup, const u
// Get timestamp
const u64 stamp = get_stamp();
// Register channel
if (ch->enabled == level::_uninit)
{
semaphore_lock lock(g_mutex);
auto& info = get_logger()->channels[ch->name];
if (info.pointer && info.pointer != ch)
{
fmt::throw_exception("logs::channel repetition: %s", ch->name);
}
else if (!info.pointer)
{
info.pointer = ch;
ch->enabled = info.enabled;
// Check level again
if (info.enabled < sev)
{
return;
}
}
}
// Get text
thread_local std::string text; text.clear();
fmt::raw_append(text, fmt, sup, args);
std::string prefix = g_tls_log_prefix();
std::string text; fmt::raw_append(text, fmt, sup, args);
std::string prefix(g_tls_log_prefix ? g_tls_log_prefix() : "");
// Get first (main) listener
listener* lis = get_logger();
if (!g_init)
{
semaphore_lock lock(g_mutex);
if (!g_init)
{
while (lis)
{
lis->log(stamp, *this, prefix, text);
lis = lis->m_next;
}
// Store message additionally
get_logger()->messages.emplace_back(stored_message{*this, stamp, std::move(prefix), text});
}
}
// Send message to all listeners
while (lis)
{
@@ -303,280 +153,28 @@ void logs::message::broadcast(const char* fmt, const fmt_type_info* sup, const u
[[noreturn]] extern void catch_all_exceptions();
logs::file_writer::file_writer(const std::string& name)
: m_name(name)
{
const std::string log_name = fs::get_config_dir() + name + ".log";
const std::string buf_name = fs::get_config_dir() + name + ".buf";
try
{
if (!m_file.open(buf_name, fs::read + fs::write + fs::create + fs::trunc + fs::unshare))
if (!m_file.open(fs::get_config_dir() + name, fs::rewrite + fs::append))
{
if (fs::g_tls_error == fs::error::acces)
{
if (fs::exists(buf_name))
{
fmt::throw_exception("Another instance of %s is running. Close it or kill its process, if necessary.", name);
}
else
{
fmt::throw_exception("Cannot create %s.log (access denied)."
#ifdef _WIN32
"\nNote that %s cannot be installed in Program Files or similar directory with limited permissions."
#else
"\nPlease, check %s permissions in '~/.config/'."
#endif
, name, name);
}
}
fmt::throw_exception("Cannot create %s.log (error %s)", name, fs::g_tls_error);
fmt::throw_exception("Can't create log file %s (error %s)", name, fs::g_tls_error);
}
// Check free space
fs::device_stat stats{};
if (!fs::statfs(fs::get_config_dir(), stats) || stats.avail_free < s_log_size * 8)
{
fmt::throw_exception("Not enough free space (%f KB)", stats.avail_free / 1000000.);
}
// Limit log size to ~25% of free space
m_max_size = stats.avail_free / 4;
// Initialize memory mapped file
#ifdef _WIN32
m_fmap = CreateFileMappingW(m_file.get_handle(), 0, PAGE_READWRITE, s_log_size >> 32, s_log_size & 0xffffffff, 0);
m_fptr = m_fmap ? (uchar*)MapViewOfFile(m_fmap, FILE_MAP_WRITE, 0, 0, 0) : nullptr;
#else
m_file.trunc(s_log_size);
m_fptr = (uchar*)::mmap(0, s_log_size, PROT_READ | PROT_WRITE, MAP_SHARED, m_file.get_handle(), 0);
#endif
verify(name.c_str()), m_fptr;
// Rotate backups (TODO)
fs::remove_file(fs::get_config_dir() + name + "1.log.gz");
fs::create_dir(fs::get_config_dir() + "old_logs");
fs::rename(fs::get_config_dir() + m_name + ".log.gz", fs::get_config_dir() + "old_logs/" + m_name + ".log.gz", true);
// Actual log file (allowed to fail)
m_fout.open(log_name, fs::rewrite);
// Compressed log
if (!m_fout2.open(log_name + ".gz", fs::rewrite) || deflateInit2(&m_zs, 9, Z_DEFLATED, 16 + 15, 9, Z_DEFAULT_STRATEGY) != Z_OK)
{
m_fout2.close();
}
}
catch (const std::exception& e)
{
std::thread([text = std::string{e.what()}]{ report_fatal_error(text); }).detach();
return;
}
catch (...)
{
std::thread([]{ report_fatal_error("Unknown error" HERE); }).detach();
return;
}
m_writer = std::thread([this]()
{
thread_ctrl::set_native_priority(-1);
while (true)
{
const u64 bufv = m_buf;
if (bufv & 0xffffff)
{
// Wait if threads are writing logs
std::this_thread::yield();
continue;
}
if (!flush(bufv))
{
if (m_out == -1)
{
break;
}
std::this_thread::sleep_for(10ms);
}
}
});
}
logs::file_writer::~file_writer()
{
if (!m_fptr)
{
return;
}
// Stop writer thread
while (m_out << 24 < m_buf)
{
std::this_thread::yield();
}
m_out = -1;
m_writer.join();
if (m_fout2)
{
m_zs.avail_in = 0;
m_zs.next_in = nullptr;
do
{
m_zs.avail_out = sizeof(m_zout);
m_zs.next_out = m_zout;
if (deflate(&m_zs, Z_FINISH) == Z_STREAM_ERROR || m_fout2.write(m_zout, sizeof(m_zout) - m_zs.avail_out) != sizeof(m_zout) - m_zs.avail_out)
{
break;
}
}
while (m_zs.avail_out == 0);
deflateEnd(&m_zs);
}
#ifdef _WIN32
UnmapViewOfFile(m_fptr);
CloseHandle(m_fmap);
#else
::munmap(m_fptr, s_log_size);
#endif
}
bool logs::file_writer::flush(u64 bufv)
{
semaphore_lock lock(m_m);
const u64 st = +m_out;
const u64 end = std::min<u64>((st + s_log_size) & ~(s_log_size - 1), bufv >> 24);
if (end > st)
{
// Avoid writing too big fragments
const u64 size = std::min<u64>(end - st, sizeof(m_zout) / 2);
// Write uncompressed
if (m_fout && st < m_max_size && m_fout.write(m_fptr + st % s_log_size, size) != size)
{
m_fout.close();
}
// Write compressed
if (m_fout2 && st < m_max_size)
{
m_zs.avail_in = size;
m_zs.next_in = m_fptr + st % s_log_size;
do
{
m_zs.avail_out = sizeof(m_zout);
m_zs.next_out = m_zout;
if (deflate(&m_zs, Z_NO_FLUSH) == Z_STREAM_ERROR || m_fout2.write(m_zout, sizeof(m_zout) - m_zs.avail_out) != sizeof(m_zout) - m_zs.avail_out)
{
deflateEnd(&m_zs);
m_fout2.close();
break;
}
}
while (m_zs.avail_out == 0);
}
m_out += size;
return true;
}
return false;
}
void logs::file_writer::log(logs::level sev, const char* text, std::size_t size)
{
if (!m_fptr)
{
return;
}
// TODO: write bigger fragment directly in blocking manner
while (size && size <= 0xffffff)
{
u64 bufv;
const auto pos = m_buf.atomic_op([&](u64& v) -> uchar*
{
const u64 v1 = v >> 24;
const u64 v2 = v & 0xffffff;
if (UNLIKELY(v2 + size > 0xffffff || v1 + v2 + size >= m_out + s_log_size))
{
bufv = v;
return nullptr;
}
v += size;
return m_fptr + (v1 + v2) % s_log_size;
});
if (UNLIKELY(!pos))
{
if ((bufv & 0xffffff) + size > 0xffffff || bufv & 0xffffff)
{
// Concurrency limit reached
std::this_thread::yield();
}
else
{
// Queue is full, need to write out
flush(bufv);
}
continue;
}
if (pos + size > m_fptr + s_log_size)
{
const auto frag = m_fptr + s_log_size - pos;
std::memcpy(pos, text, frag);
std::memcpy(m_fptr, text + frag, size - frag);
}
else
{
std::memcpy(pos, text, size);
}
m_buf += (u64{size} << 24) - size;
break;
catch_all_exceptions();
}
}
logs::file_listener::file_listener(const std::string& name)
: file_writer(name)
, listener()
void logs::file_writer::log(const char* text, std::size_t size)
{
// Write UTF-8 BOM
file_writer::log(logs::level::always, "\xEF\xBB\xBF", 3);
// Write initial message
stored_message ver;
ver.m.ch = nullptr;
ver.m.sev = level::always;
ver.stamp = 0;
ver.text = fmt::format("RPCS3 v%s | %s\n%s", rpcs3::version.to_string(), rpcs3::get_branch(), utils::get_system_info());
file_writer::log(logs::level::always, ver.text.data(), ver.text.size());
file_writer::log(logs::level::always, "\n", 1);
messages.emplace_back(std::move(ver));
m_file.write(text, size);
}
void logs::file_listener::log(u64 stamp, const logs::message& msg, const std::string& prefix, const std::string& _text)
{
thread_local std::string text;
std::string text; text.reserve(prefix.size() + _text.size() + 200);
// Used character: U+00B7 (Middle Dot)
switch (msg.sev)
@@ -589,7 +187,6 @@ void logs::file_listener::log(u64 stamp, const logs::message& msg, const std::st
case level::warning: text = u8"·W "; break;
case level::notice: text = u8"·! "; break;
case level::trace: text = u8"·T "; break;
case level::_uninit: text = u8"· "; break;
}
// Print miscosecond timestamp
@@ -605,8 +202,8 @@ void logs::file_listener::log(u64 stamp, const logs::message& msg, const std::st
text += prefix;
text += "} ";
}
if (msg.ch && '\0' != *msg.ch->name)
if (msg.ch->name)
{
text += msg.ch->name;
text += msg.sev == level::todo ? " TODO: " : ": ";
@@ -615,9 +212,9 @@ void logs::file_listener::log(u64 stamp, const logs::message& msg, const std::st
{
text += "TODO: ";
}
text += _text;
text += '\n';
file_writer::log(msg.sev, text.data(), text.size());
file_writer::log(text.data(), text.size());
}
+8 -17
View File
@@ -3,22 +3,19 @@
#include "types.h"
#include "Atomic.h"
#include "StrFmt.h"
#include <climits>
namespace logs
{
enum class level : uint
{
always, // Highest log severity (unused, cannot be disabled)
always, // highest level (unused, cannot be disabled)
fatal,
error,
todo,
success,
warning,
notice,
trace, // Lowest severity (usually disabled)
_uninit = UINT_MAX, // Special value for delayed initialization
trace, // lowest level (usually disabled)
};
struct channel;
@@ -26,7 +23,7 @@ namespace logs
// Message information (temporary data)
struct message
{
channel* ch;
const channel* ch;
level sev;
// Send log message to global logger instance
@@ -60,16 +57,16 @@ namespace logs
// The lowest logging level enabled for this channel (used for early filtering)
atomic_t<level> enabled;
// Constant initialization: channel name
constexpr channel(const char* name)
// Constant initialization: name and initial log level
constexpr channel(const char* name, level enabled = level::trace)
: name(name)
, enabled(level::_uninit)
, enabled(enabled)
{
}
// Formatting function
template<typename... Args>
SAFE_BUFFERS FORCE_INLINE void format(level sev, const char* fmt, const Args&... args)
SAFE_BUFFERS FORCE_INLINE void format(level sev, const char* fmt, const Args&... args) const
{
if (UNLIKELY(sev <= enabled))
{
@@ -79,7 +76,7 @@ namespace logs
#define GEN_LOG_METHOD(_sev)\
template<typename... Args>\
SAFE_BUFFERS void _sev(const char* fmt, const Args&... args)\
SAFE_BUFFERS void _sev(const char* fmt, const Args&... args) const\
{\
return format<Args...>(level::_sev, fmt, args...);\
}
@@ -105,12 +102,6 @@ namespace logs
extern channel PPU;
extern channel SPU;
extern channel ARMv7;
// Log level control: set all channels to level::notice
void reset();
// Log level control: register channel if necessary, set channel level
void set_level(const std::string&, level);
}
// Legacy:
+98
View File
@@ -0,0 +1,98 @@
#pragma once
class MTProgressDialog : public wxDialog
{
wxGauge** m_gauge;
wxStaticText** m_msg;
wxArrayLong m_maximum;
const u8 m_cores;
static const uint layout = 16;
static const uint maxdial = 65536;
wxArrayInt m_lastupdate;
public:
MTProgressDialog(wxWindow* parent, const wxSize& size, const wxString& title,
const wxString& msg, const wxArrayLong& maximum, const u8 cores)
: wxDialog(parent, wxID_ANY, title, wxDefaultPosition)
, m_maximum(maximum)
, m_cores(cores)
{
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
m_gauge = new wxGauge*[m_cores];
m_msg = new wxStaticText*[m_cores];
m_lastupdate.SetCount(cores);
for(uint i=0; i<m_cores; ++i)
{
m_lastupdate[i] = -1;
m_msg[i] = new wxStaticText(this, wxID_ANY, msg);
sizer->Add(m_msg[i], 0, wxLEFT | wxTOP, layout);
m_gauge[i] = new wxGauge(this, wxID_ANY, maxdial,
wxDefaultPosition, wxDefaultSize,
wxGA_HORIZONTAL );
sizer->Add(m_gauge[i], 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, layout);
m_gauge[i]->SetValue(0);
sizer->AddSpacer(5);
}
SetSizerAndFit(sizer);
if(size != wxDefaultSize)
{
SetSize(size);
}
else
{
wxSize ws;
ws.x = 400;
ws.y = GetSize().y + 8;
SetSize(ws);
}
m_maximum.SetCount(m_cores);
Show();
}
void Update(const u8 thread_id, const u64 value, const wxString& msg)
{
if(thread_id > m_cores) return;
const int curupdate = (int)(((double)value/(double)m_maximum[thread_id])*1000);
if(curupdate == m_lastupdate[thread_id]) return;
m_lastupdate[thread_id] = curupdate;
m_msg[thread_id]->SetLabel(msg);
if(value >= (u32)m_maximum[thread_id]) return;
m_gauge[thread_id]->SetValue(((double)value / (double)m_maximum[thread_id]) * maxdial);
}
const u32 GetMaxValue(const uint thread_id) const
{
if(thread_id > m_cores) return 0;
return m_maximum[thread_id];
}
void SetMaxFor(const uint thread_id, const u64 val)
{
if(thread_id > m_cores) return;
m_maximum[thread_id] = val;
m_lastupdate[thread_id] = 0;
}
virtual void Close(bool force = false)
{
m_lastupdate.Empty();
m_maximum.Empty();
wxDialog::Close(force);
}
};
+2 -11
View File
@@ -257,8 +257,8 @@ struct fmt::cfmt_src
void skip(std::size_t extra)
{
sup += extra + 1;
args += extra + 1;
++sup += extra;
++args += extra;
}
std::size_t fmt_string(std::string& out, std::size_t extra) const
@@ -286,15 +286,6 @@ struct fmt::cfmt_src
return 0;
}
static constexpr std::size_t size_char = 1;
static constexpr std::size_t size_short = 2;
static constexpr std::size_t size_int = 0;
static constexpr std::size_t size_long = sizeof(ulong);
static constexpr std::size_t size_llong = sizeof(ullong);
static constexpr std::size_t size_size = sizeof(std::size_t);
static constexpr std::size_t size_max = sizeof(std::uintmax_t);
static constexpr std::size_t size_diff = sizeof(std::ptrdiff_t);
};
void fmt::raw_append(std::string& out, const char* fmt, const fmt_type_info* sup, const u64* args) noexcept
+5 -31
View File
@@ -15,7 +15,7 @@ namespace fmt
template <typename T, typename>
struct fmt_unveil
{
static_assert(sizeof(T) > 0, "fmt_unveil<> error: incomplete type");
static_assert(sizeof(T) > 0, "fmt_unveil<>: cannot pass forward-declared object");
using type = T;
@@ -59,24 +59,13 @@ struct fmt_unveil<T, std::enable_if_t<std::is_floating_point<T>::value && sizeof
{
using type = T;
// Convert FP to f64 and reinterpret as u64
static inline u64 get(const f64& arg)
// Convert FP to f64 and reinterpret (TODO?)
static inline u64 get(const f64 arg)
{
return *reinterpret_cast<const u64*>(reinterpret_cast<const u8*>(&arg));
}
};
template <>
struct fmt_unveil<f16, void>
{
using type = f16;
static inline u64 get(const f16& arg)
{
return fmt_unveil<f64>::get(arg.operator float());
}
};
template <typename T>
struct fmt_unveil<T, std::enable_if_t<std::is_enum<T>::value>>
{
@@ -137,27 +126,15 @@ struct fmt_class_string
return *reinterpret_cast<const T*>(static_cast<std::uintptr_t>(arg));
}
// Enum -> string function type
using convert_t = const char*(*)(T value);
// Enum -> string function registered
static convert_t convert_enum;
// Helper function (safely converts arg to enum value)
static SAFE_BUFFERS FORCE_INLINE void format_enum(std::string& out, u64 arg, convert_t convert)
static SAFE_BUFFERS FORCE_INLINE void format_enum(std::string& out, u64 arg, const char* (*get)(T value))
{
// Save convert function
if (convert_enum == nullptr)
{
convert_enum = convert;
}
const auto value = static_cast<std::underlying_type_t<T>>(arg);
// Check narrowing
if (static_cast<u64>(value) == arg)
{
if (const char* str = convert(static_cast<T>(value)))
if (const char* str = get(static_cast<T>(value)))
{
out += str;
return;
@@ -203,9 +180,6 @@ struct fmt_class_string
static constexpr const char* unknown = nullptr;
};
template <typename T, typename V>
const char*(*fmt_class_string<T, V>::convert_enum)(T) = nullptr;
template <>
struct fmt_class_string<const void*, void>
{
-6
View File
@@ -24,12 +24,6 @@ inline void strcpy_trunc(char (&dst)[N], const char (&src)[N2])
dst[count] = '\0';
}
template <std::size_t N>
inline bool ends_with(const std::string& src, const char (&end)[N])
{
return src.size() >= N - 1 && src.compare(src.size() - (N - 1), N - 1, end, N - 1) == 0;
}
namespace fmt
{
std::string replace_first(const std::string& src, const std::string& from, const std::string& to);
+37 -336
View File
@@ -3,12 +3,7 @@
#include "Emu/System.h"
#include "Emu/IdManager.h"
#include "Emu/Cell/RawSPUThread.h"
#include "Emu/Cell/lv2/sys_mmapper.h"
#include "Emu/Cell/lv2/sys_event.h"
#include "Thread.h"
#include "sysinfo.h"
#include <typeinfo>
#include <thread>
#ifdef _WIN32
#include <Windows.h>
@@ -18,12 +13,6 @@
#ifdef __APPLE__
#define _XOPEN_SOURCE
#define __USE_GNU
#include <mach/thread_act.h>
#include <mach/thread_policy.h>
#endif
#if defined(__DragonFly__) || defined(__FreeBSD__)
#include <pthread_np.h>
#define cpu_set_t cpuset_t
#endif
#include <errno.h>
#include <signal.h>
@@ -39,6 +28,20 @@ thread_local u64 g_tls_fault_all = 0;
thread_local u64 g_tls_fault_rsx = 0;
thread_local u64 g_tls_fault_spu = 0;
static void report_fatal_error(const std::string& msg)
{
std::string _msg = msg + "\n"
"HOW TO REPORT ERRORS: Check the FAQ, README, other sources.\n"
"Please, don't send incorrect reports. Thanks for understanding.\n";
#ifdef _WIN32
_msg += "Press (Ctrl+C) to copy this message.";
MessageBoxA(0, _msg.c_str(), "Fatal error", MB_ICONERROR); // TODO: unicode message
#else
std::printf("Fatal error: \n%s", _msg.c_str());
#endif
}
[[noreturn]] void catch_all_exceptions()
{
try
@@ -53,6 +56,8 @@ thread_local u64 g_tls_fault_spu = 0;
{
report_fatal_error("Unhandled exception (unknown)");
}
std::abort();
}
enum x64_reg_t : u32
@@ -751,90 +756,6 @@ uint64_t* darwin_x64reg(x64_context *context, int reg)
}
}
#elif defined(__DragonFly__) || defined(__FreeBSD__)
#define X64REG(context, reg) (freebsd_x64reg(context, reg))
#ifdef __DragonFly__
# define XMMREG(context, reg) (reinterpret_cast<v128*>(((union savefpu*)(context)->uc_mcontext.mc_fpregs)->sv_xmm.sv_xmm[reg]))
#else
# define XMMREG(context, reg) (reinterpret_cast<v128*>(((struct savefpu*)(context)->uc_mcontext.mc_fpstate)->sv_xmm[reg]))
#endif
#define EFLAGS(context) ((context)->uc_mcontext.mc_rflags)
register_t* freebsd_x64reg(x64_context *context, int reg)
{
auto *state = &context->uc_mcontext;
switch(reg)
{
case 0: return &state->mc_rax;
case 1: return &state->mc_rcx;
case 2: return &state->mc_rdx;
case 3: return &state->mc_rbx;
case 4: return &state->mc_rsp;
case 5: return &state->mc_rbp;
case 6: return &state->mc_rsi;
case 7: return &state->mc_rdi;
case 8: return &state->mc_r8;
case 9: return &state->mc_r9;
case 10: return &state->mc_r10;
case 11: return &state->mc_r11;
case 12: return &state->mc_r12;
case 13: return &state->mc_r13;
case 14: return &state->mc_r14;
case 15: return &state->mc_r15;
case 16: return &state->mc_rip;
default:
LOG_ERROR(GENERAL, "Invalid register index: %d", reg);
return nullptr;
}
}
#elif defined(__OpenBSD__)
#define X64REG(context, reg) (openbsd_x64reg(context, reg))
#define XMMREG(context, reg) (reinterpret_cast<v128*>((context)->sc_fpstate->fx_xmm[reg]))
#define EFLAGS(context) ((context)->sc_rflags)
long* openbsd_x64reg(x64_context *context, int reg)
{
auto *state = &context->uc_mcontext;
switch(reg)
{
case 0: return &state->sc_rax;
case 1: return &state->sc_rcx;
case 2: return &state->sc_rdx;
case 3: return &state->sc_rbx;
case 4: return &state->sc_rsp;
case 5: return &state->sc_rbp;
case 6: return &state->sc_rsi;
case 7: return &state->sc_rdi;
case 8: return &state->sc_r8;
case 9: return &state->sc_r9;
case 10: return &state->sc_r10;
case 11: return &state->sc_r11;
case 12: return &state->sc_r12;
case 13: return &state->sc_r13;
case 14: return &state->sc_r14;
case 15: return &state->sc_r15;
case 16: return &state->sc_rip;
default:
LOG_ERROR(GENERAL, "Invalid register index: %d", reg);
return nullptr;
}
}
#elif defined(__NetBSD__)
static const decltype(_REG_RAX) reg_table[] =
{
_REG_RAX, _REG_RCX, _REG_RDX, _REG_RBX, _REG_RSP, _REG_RBP, _REG_RSI, _REG_RDI,
_REG_R8, _REG_R9, _REG_R10, _REG_R11, _REG_R12, _REG_R13, _REG_R14, _REG_R15, _REG_RIP
};
#define X64REG(context, reg) (&(context)->uc_mcontext.__gregs[reg_table[reg]])
#define XMM_sig(context, reg) (reinterpret_cast<v128*>(((struct fxsave64*)(context)->uc_mcontext.__fpregs)->fx_xmm[reg]))
#define EFLAGS(context) ((context)->uc_mcontext.__gregs[_REG_RFL])
#else
static const decltype(REG_RAX) reg_table[] =
@@ -844,11 +765,7 @@ static const decltype(REG_RAX) reg_table[] =
};
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
#ifdef __sun
#define XMMREG(context, reg) (reinterpret_cast<v128*>(&(context)->uc_mcontext.fpregs.fp_reg_set.fpchip_state.xmm[reg_table[reg]]))
#else
#define XMMREG(context, reg) (reinterpret_cast<v128*>(&(context)->uc_mcontext.fpregs->_xmm[reg]))
#endif // __sun
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
#endif // __APPLE__
@@ -965,8 +882,8 @@ bool put_x64_reg_value(x64_context* context, x64_reg_t reg, size_t d_size, u64 v
// save the value into x64 register
switch (d_size)
{
case 1: *X64REG(context, reg - X64R_RAX) = (value & 0xff) | (*X64REG(context, reg - X64R_RAX) & 0xffffff00); return true;
case 2: *X64REG(context, reg - X64R_RAX) = (value & 0xffff) | (*X64REG(context, reg - X64R_RAX) & 0xffff0000); return true;
case 1: *X64REG(context, reg - X64R_RAX) = value & 0xff | *X64REG(context, reg - X64R_RAX) & 0xffffff00; return true;
case 2: *X64REG(context, reg - X64R_RAX) = value & 0xffff | *X64REG(context, reg - X64R_RAX) & 0xffff0000; return true;
case 4: *X64REG(context, reg - X64R_RAX) = value & 0xffffffff; return true;
case 8: *X64REG(context, reg - X64R_RAX) = value; return true;
}
@@ -1231,7 +1148,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
return true;
}
if (vm::check_addr(addr, std::max<std::size_t>(1, d_size), vm::page_allocated | (is_writing ? vm::page_writable : vm::page_readable)))
if (vm::check_addr(addr, d_size))
{
if (cpu)
{
@@ -1241,60 +1158,9 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
return true;
}
// TODO: allow recovering from a page fault as a feature of PS3 virtual memory
if (cpu)
{
if (fxm::check<page_fault_notification_entries>())
{
for (const auto& entry : fxm::get<page_fault_notification_entries>()->entries)
{
auto mem = vm::get(vm::any, entry.start_addr);
if (!mem)
{
continue;
}
if (entry.start_addr <= addr && addr <= addr + mem->size - 1)
{
// Place the page fault event onto table so that other functions [sys_mmapper_free_address and ppu pagefault funcs]
// know that this thread is page faulted and where.
auto pf_entries = fxm::get_always<page_fault_event_entries>();
{
semaphore_lock pf_lock(pf_entries->pf_mutex);
page_fault_event pf_event{ cpu->id, addr };
pf_entries->events.emplace_back(pf_event);
}
// Now, we notify the game that a page fault occurred so it can rectify it.
// Note, for data3, were the memory readable AND we got a page fault, it must be due to a write violation since reads are allowed.
be_t<u64> data1 = addr;
be_t<u64> data2 = (SYS_MEMORY_PAGE_FAULT_TYPE_PPU_THREAD << 32) + cpu->id; // TODO: fix hack for now that assumes PPU thread always.
be_t<u64> data3 = vm::check_addr(addr, a_size, vm::page_readable) ? SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY : SYS_MEMORY_PAGE_FAULT_CAUSE_NON_MAPPED;
LOG_ERROR(MEMORY, "Page_fault %s location 0x%x because of %s memory", is_writing ? "writing" : "reading",
addr, data3 == SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY ? "writing read-only" : "using unmapped");
error_code sending_error = sys_event_port_send(entry.port_id, data1, data2, data3);
// If we fail due to being busy, wait a bit and try again.
while (sending_error == CELL_EBUSY)
{
lv2_obj::sleep(*cpu, 1000);
thread_ctrl::wait_for(1000);
sending_error = sys_event_port_send(entry.port_id, data1, data2, data3);
}
if (sending_error)
{
fmt::throw_exception("Unknown error %x while trying to pass page fault.", sending_error.value);
}
lv2_obj::sleep(*cpu);
thread_ctrl::wait();
return true;
}
}
}
LOG_FATAL(MEMORY, "Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr);
cpu->state += cpu_flag::dbg_pause;
cpu->check_state();
@@ -1363,8 +1229,7 @@ static bool is_leaf_function(u64 rip)
static LONG exception_handler(PEXCEPTION_POINTERS pExp)
{
const u64 addr64 = pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::g_base_addr;
const u64 exec64 = pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::g_exec_addr;
const u64 addr64 = pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::base(0);
const bool is_writing = pExp->ExceptionRecord->ExceptionInformation[0] != 0;
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && addr64 < 0x100000000ull)
@@ -1375,14 +1240,6 @@ static LONG exception_handler(PEXCEPTION_POINTERS pExp)
}
}
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && exec64 < 0x100000000ull)
{
if (thread_ctrl::get_current() && handle_access_violation((u32)exec64, is_writing, pExp->ContextRecord))
{
return EXCEPTION_CONTINUE_EXECUTION;
}
}
return EXCEPTION_CONTINUE_SEARCH;
}
@@ -1392,6 +1249,7 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp)
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
{
const u64 addr64 = pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::base(0);
const auto cause = pExp->ExceptionRecord->ExceptionInformation[0] != 0 ? "writing" : "reading";
msg += fmt::format("Segfault %s location %p at %p.\n", cause, pExp->ExceptionRecord->ExceptionInformation[1], pExp->ExceptionRecord->ExceptionAddress);
@@ -1459,6 +1317,13 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp)
msg += fmt::format("RPCS3 image base: %p.\n", GetModuleHandle(NULL));
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION)
{
msg += "\n"
"Illegal instruction exception occured.\n"
"Note that your CPU must support SSSE3 extension.\n";
}
// TODO: print registers and the callstack
// Report fatal error
@@ -1471,11 +1336,13 @@ const bool s_exception_handler_set = []() -> bool
if (!AddVectoredExceptionHandler(1, (PVECTORED_EXCEPTION_HANDLER)exception_handler))
{
report_fatal_error("AddVectoredExceptionHandler() failed.");
std::abort();
}
if (!SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)exception_filter))
{
report_fatal_error("SetUnhandledExceptionFilter() failed.");
std::abort();
}
return true;
@@ -1489,18 +1356,11 @@ static void signal_handler(int sig, siginfo_t* info, void* uct)
#ifdef __APPLE__
const bool is_writing = context->uc_mcontext->__es.__err & 0x2;
#elif defined(__DragonFly__) || defined(__FreeBSD__)
const bool is_writing = context->uc_mcontext.mc_err & 0x2;
#elif defined(__OpenBSD__)
const bool is_writing = context->sc_err & 0x2;
#elif defined(__NetBSD__)
const bool is_writing = context->uc_mcontext.__gregs[_REG_ERR] & 0x2;
#else
const bool is_writing = context->uc_mcontext.gregs[REG_ERR] & 0x2;
#endif
const u64 addr64 = (u64)info->si_addr - (u64)vm::g_base_addr;
const u64 exec64 = (u64)info->si_addr - (u64)vm::g_exec_addr;
const u64 addr64 = (u64)info->si_addr - (u64)vm::base(0);
const auto cause = is_writing ? "writing" : "reading";
if (addr64 < 0x100000000ull)
@@ -1512,16 +1372,9 @@ static void signal_handler(int sig, siginfo_t* info, void* uct)
}
}
if (exec64 < 0x100000000ull)
{
if (thread_ctrl::get_current() && handle_access_violation((u32)exec64, is_writing, context))
{
return;
}
}
// TODO (debugger interaction)
report_fatal_error(fmt::format("Segfault %s location %p at %p.", cause, info->si_addr, RIP(context)));
std::abort();
}
const bool s_exception_handler_set = []() -> bool
@@ -1549,8 +1402,6 @@ thread_local DECLARE(thread_ctrl::g_tls_this_thread) = nullptr;
extern thread_local std::string(*g_tls_log_prefix)();
DECLARE(thread_ctrl::g_native_core_layout) { native_core_arrangement::undefined };
void thread_ctrl::start(const std::shared_ptr<thread_ctrl>& ctrl, task_stack task)
{
#ifdef _WIN32
@@ -1596,7 +1447,7 @@ void thread_ctrl::start(const std::shared_ptr<thread_ctrl>& ctrl, task_stack tas
#endif
// TODO: this is unsafe and must be duplicated in thread_ctrl::initialize
ctrl->m_thread = (uintptr_t)thread;
ctrl->m_thread = thread;
}
void thread_ctrl::initialize()
@@ -1652,7 +1503,7 @@ void thread_ctrl::finalize(std::exception_ptr eptr) noexcept
FILETIME ctime, etime, ktime, utime;
GetThreadTimes(GetCurrentThread(), &ctime, &etime, &ktime, &utime);
const u64 time = ((ktime.dwLowDateTime | (u64)ktime.dwHighDateTime << 32) + (utime.dwLowDateTime | (u64)utime.dwHighDateTime << 32)) * 100ull;
#elif defined(RUSAGE_THREAD)
#elif __linux__
const u64 cycles = 0; // Not supported
struct ::rusage stats{};
::getrusage(RUSAGE_THREAD, &stats);
@@ -1747,7 +1598,7 @@ bool thread_ctrl::_wait_for(u64 usec)
}
}
}
while (_this->m_cond.wait(_lock, std::exchange(usec, usec > cond_variable::max_timeout ? -1 : 0)));
while (_this->m_cond.wait(_lock, std::exchange(usec, usec == -1 ? -1 : 0)));
// Timeout
return false;
@@ -1785,7 +1636,7 @@ thread_ctrl::~thread_ctrl()
#ifdef _WIN32
CloseHandle((HANDLE)m_thread.raw());
#else
pthread_detach((pthread_t)m_thread.raw());
pthread_detach(m_thread.raw());
#endif
}
}
@@ -1857,155 +1708,6 @@ void thread_ctrl::test()
}
}
void thread_ctrl::detect_cpu_layout()
{
if (!g_native_core_layout.compare_and_swap_test(native_core_arrangement::undefined, native_core_arrangement::generic))
return;
const auto system_id = utils::get_system_info();
if (system_id.find("Ryzen") != std::string::npos)
{
g_native_core_layout.store(native_core_arrangement::amd_ccx);
}
else if (system_id.find("i3") != std::string::npos || system_id.find("i7") != std::string::npos)
{
g_native_core_layout.store(native_core_arrangement::intel_ht);
}
}
u16 thread_ctrl::get_affinity_mask(thread_class group)
{
detect_cpu_layout();
if (const auto thread_count = std::thread::hardware_concurrency())
{
const u16 all_cores_mask = thread_count < 16 ? (u16)(~(UINT16_MAX << thread_count)): UINT16_MAX;
switch (g_native_core_layout)
{
default:
case native_core_arrangement::generic:
{
return all_cores_mask;
}
case native_core_arrangement::amd_ccx:
{
u16 spu_mask, ppu_mask, rsx_mask;
if (thread_count >= 16)
{
// Threadripper, R7
// Assign threads 8-16
// It appears some windows code is bound to lower core addresses, binding 8-16 is alot faster than 0-7
ppu_mask = spu_mask = 0b1111111100000000;
rsx_mask = all_cores_mask;
}
else if (thread_count == 12)
{
// 1600/2600 (x)
ppu_mask = spu_mask = 0b111111000000;
rsx_mask = all_cores_mask;
}
else
{
// R5 & R3 don't seem to improve performance no matter how these are shuffled
ppu_mask = spu_mask = rsx_mask = 0b11111111 & all_cores_mask;
}
switch (group)
{
default:
case thread_class::general:
return all_cores_mask;
case thread_class::rsx:
return rsx_mask;
case thread_class::ppu:
return ppu_mask;
case thread_class::spu:
return spu_mask;
}
}
case native_core_arrangement::intel_ht:
{
if (thread_count <= 4)
{
//i3 or worse
switch (group)
{
case thread_class::rsx:
case thread_class::ppu:
return (0b0101 & all_cores_mask);
case thread_class::spu:
return (0b1010 & all_cores_mask);
case thread_class::general:
return all_cores_mask;
}
}
return all_cores_mask;
}
}
}
return UINT16_MAX;
}
void thread_ctrl::set_native_priority(int priority)
{
#ifdef _WIN32
HANDLE _this_thread = GetCurrentThread();
INT native_priority = THREAD_PRIORITY_NORMAL;
if (priority > 0)
native_priority = THREAD_PRIORITY_ABOVE_NORMAL;
if (priority < 0)
native_priority = THREAD_PRIORITY_BELOW_NORMAL;
if (!SetThreadPriority(_this_thread, native_priority))
{
LOG_ERROR(GENERAL, "SetThreadPriority() failed: 0x%x", GetLastError());
}
#else
int policy;
struct sched_param param;
pthread_getschedparam(pthread_self(), &policy, &param);
if (priority > 0)
param.sched_priority = sched_get_priority_max(policy);
if (priority < 0)
param.sched_priority = sched_get_priority_min(policy);
if (int err = pthread_setschedparam(pthread_self(), policy, &param))
{
LOG_ERROR(GENERAL, "pthraed_setschedparam() failed: %d", err);
}
#endif
}
void thread_ctrl::set_thread_affinity_mask(u16 mask)
{
#ifdef _WIN32
HANDLE _this_thread = GetCurrentThread();
SetThreadAffinityMask(_this_thread, (DWORD_PTR)mask);
#elif __APPLE__
thread_affinity_policy_data_t policy = { static_cast<integer_t>(mask) };
thread_port_t mach_thread = pthread_mach_thread_np(pthread_self());
thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, (thread_policy_t)&policy, 1);
#elif defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__)
cpu_set_t cs;
CPU_ZERO(&cs);
for (u32 core = 0; core < 16u; ++core)
{
if ((u32)mask & (1u << core))
{
CPU_SET(core, &cs);
}
}
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cs);
#endif
}
named_thread::named_thread()
{
@@ -2031,7 +1733,6 @@ void named_thread::start_thread(const std::shared_ptr<void>& _this)
try
{
LOG_TRACE(GENERAL, "Thread started");
on_spawn();
on_task();
LOG_TRACE(GENERAL, "Thread ended");
}
-38
View File
@@ -10,29 +10,9 @@
#include "sema.h"
#include "cond.h"
// Report error and call std::abort(), defined in main.cpp
[[noreturn]] void report_fatal_error(const std::string&);
// Will report exception and call std::abort() if put in catch(...)
[[noreturn]] void catch_all_exceptions();
// Hardware core layout
enum class native_core_arrangement : u32
{
undefined,
generic,
intel_ht,
amd_ccx
};
enum class thread_class : u32
{
general,
rsx,
spu,
ppu
};
// Simple list of void() functors
class task_stack
{
@@ -108,9 +88,6 @@ class thread_ctrl final
// Current thread
static thread_local thread_ctrl* g_tls_this_thread;
// Target cpu core layout
static atomic_t<native_core_arrangement> g_native_core_layout;
// Self pointer
std::shared_ptr<thread_ctrl> m_self;
@@ -253,18 +230,6 @@ public:
thread_ctrl::start(out, std::forward<F>(func));
}
// Detect layout
static void detect_cpu_layout();
// Returns a core affinity mask. Set whether to generate the high priority set or not
static u16 get_affinity_mask(thread_class group);
// Sets the native thread priority
static void set_native_priority(int priority);
// Sets the preferred affinity mask for this thread
static void set_thread_affinity_mask(u16 mask);
};
class named_thread
@@ -293,9 +258,6 @@ protected:
// Thread finalization (called after on_task)
virtual void on_exit() {}
// Called once upon thread spawn within the thread's own context
virtual void on_spawn() {}
public:
// ID initialization
virtual void on_init(const std::shared_ptr<void>& _this)
+4 -12
View File
@@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "Utilities/Log.h"
#include "VirtualMemory.h"
#ifdef _WIN32
@@ -44,17 +44,9 @@ namespace utils
void* memory_reserve(std::size_t size, void* use_addr)
{
#ifdef _WIN32
return ::VirtualAlloc(use_addr, size, MEM_RESERVE, PAGE_NOACCESS);
return verify("reserve_memory" HERE, ::VirtualAlloc(use_addr, size, MEM_RESERVE, PAGE_NOACCESS));
#else
auto ptr = ::mmap(use_addr, size, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
if (use_addr && ptr != use_addr)
{
::munmap(ptr, size);
return nullptr;
}
return ptr;
return verify("reserve_memory" HERE, ::mmap(use_addr, size, PROT_NONE, MAP_ANON | MAP_PRIVATE | (use_addr ? MAP_FIXED : 0), -1, 0));
#endif
}
@@ -70,7 +62,7 @@ namespace utils
void memory_decommit(void* pointer, std::size_t size)
{
#ifdef _WIN32
verify(HERE), ::VirtualFree(pointer, size, MEM_DECOMMIT);
verify(HERE), ::VirtualFree(pointer, 0, MEM_DECOMMIT);
#else
verify(HERE), ::mmap(pointer, size, PROT_NONE, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);
#endif
-175
View File
@@ -1,175 +0,0 @@
#include "bin_patch.h"
#include "yaml-cpp/yaml.h"
#include "File.h"
#include "Config.h"
template <>
void fmt_class_string<patch_type>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](patch_type value)
{
switch (value)
{
case patch_type::load: return "load";
case patch_type::byte: return "byte";
case patch_type::le16: return "le16";
case patch_type::le32: return "le32";
case patch_type::le64: return "le64";
case patch_type::bef32: return "bef32";
case patch_type::bef64: return "bef64";
case patch_type::be16: return "be16";
case patch_type::be32: return "be32";
case patch_type::be64: return "be64";
case patch_type::lef32: return "lef32";
case patch_type::lef64: return "lef64";
}
return unknown;
});
}
void patch_engine::append(const std::string& patch)
{
if (fs::file f{patch})
{
YAML::Node root;
try
{
root = YAML::Load(f.to_string());
}
catch (const std::exception& e)
{
LOG_FATAL(GENERAL, "Failed to load patch file %s\n%s thrown: %s", patch, typeid(e).name(), e.what());
return;
}
for (auto pair : root)
{
auto& name = pair.first.Scalar();
auto& data = m_map[name];
for (auto patch : pair.second)
{
u64 type64 = 0;
cfg::try_to_enum_value(&type64, &fmt_class_string<patch_type>::format, patch[0].Scalar());
struct patch info{};
info.type = static_cast<patch_type>(type64);
info.offset = patch[1].as<u32>(0);
switch (info.type)
{
case patch_type::load:
{
// Special syntax: copy named sequence (must be loaded before)
const auto found = m_map.find(patch[1].Scalar());
if (found != m_map.end())
{
// Address modifier (optional)
const u32 mod = patch[2].as<u32>(0);
for (const auto& rd : found->second)
{
info = rd;
info.offset += mod;
data.emplace_back(info);
}
continue;
}
// TODO: error
break;
}
case patch_type::bef32:
case patch_type::lef32:
{
info.value_as<f32>() = patch[2].as<f32>();
break;
}
case patch_type::bef64:
case patch_type::lef64:
{
info.value_as<f64>() = patch[2].as<f64>();
break;
}
default:
{
info.value = patch[2].as<u64>();
break;
}
}
data.emplace_back(info);
}
}
}
}
std::size_t patch_engine::apply(const std::string& name, u8* dst) const
{
const auto found = m_map.find(name);
if (found == m_map.cend())
{
return 0;
}
// Apply modifications sequentially
for (const auto& p : found->second)
{
auto ptr = dst + p.offset;
switch (p.type)
{
case patch_type::load:
{
// Invalid in this context
break;
}
case patch_type::byte:
{
*ptr = static_cast<u8>(p.value);
break;
}
case patch_type::le16:
{
*reinterpret_cast<le_t<u16, 1>*>(ptr) = static_cast<u16>(p.value);
break;
}
case patch_type::le32:
case patch_type::lef32:
{
*reinterpret_cast<le_t<u32, 1>*>(ptr) = static_cast<u32>(p.value);
break;
}
case patch_type::le64:
case patch_type::lef64:
{
*reinterpret_cast<le_t<u64, 1>*>(ptr) = static_cast<u64>(p.value);
break;
}
case patch_type::be16:
{
*reinterpret_cast<be_t<u16, 1>*>(ptr) = static_cast<u16>(p.value);
break;
}
case patch_type::be32:
case patch_type::bef32:
{
*reinterpret_cast<be_t<u32, 1>*>(ptr) = static_cast<u32>(p.value);
break;
}
case patch_type::be64:
case patch_type::bef64:
{
*reinterpret_cast<be_t<u64, 1>*>(ptr) = static_cast<u64>(p.value);
break;
}
}
}
return found->second.size();
}
-48
View File
@@ -1,48 +0,0 @@
#pragma once
#include "BEType.h"
#include <vector>
#include <string>
#include <unordered_map>
enum class patch_type
{
load,
byte,
le16,
le32,
le64,
lef32,
lef64,
be16,
be32,
be64,
bef32,
bef64,
};
class patch_engine
{
struct patch
{
patch_type type;
u32 offset;
u64 value;
template <typename T>
T& value_as()
{
return *reinterpret_cast<T*>(reinterpret_cast<char*>(&value));
}
};
// Database
std::unordered_map<std::string, std::vector<patch>> m_map;
public:
// Load from file
void append(const std::string& path);
// Apply patch (returns the number of entries applied)
std::size_t apply(const std::string& name, u8* dst) const;
};
+7 -27
View File
@@ -204,11 +204,11 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
else if (fmt[0] == 'h')
{
fmt++, ctx.size++;
ctx.type = src.size_char;
ctx.type = sizeof(char);
}
else
{
ctx.type = src.size_short;
ctx.type = sizeof(short);
}
break;
@@ -223,11 +223,11 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
else if (fmt[0] == 'l')
{
fmt++, ctx.size++;
ctx.type = src.size_llong;
ctx.type = sizeof(llong);
}
else
{
ctx.type = src.size_long;
ctx.type = sizeof(long);
}
break;
@@ -241,7 +241,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
}
else
{
ctx.type = src.size_size;
ctx.type = sizeof(std::size_t);
}
break;
@@ -255,7 +255,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
}
else
{
ctx.type = src.size_max;
ctx.type = sizeof(std::intmax_t);
}
break;
@@ -269,7 +269,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
}
else
{
ctx.type = src.size_diff;
ctx.type = sizeof(std::ptrdiff_t);
}
break;
@@ -339,11 +339,6 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
if (!ctx.type)
{
ctx.type = (u8)src.type(ctx.args);
if (!ctx.type)
{
ctx.type = src.size_int;
}
}
// Sign-extended argument expected
@@ -401,11 +396,6 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
if (!ctx.type)
{
ctx.type = (u8)src.type(ctx.args);
if (!ctx.type)
{
ctx.type = src.size_int;
}
}
const u64 mask =
@@ -457,11 +447,6 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
if (!ctx.type)
{
ctx.type = (u8)src.type(ctx.args);
if (!ctx.type)
{
ctx.type = src.size_int;
}
}
const u64 mask =
@@ -520,11 +505,6 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
if (!ctx.type)
{
ctx.type = (u8)src.type(ctx.args);
if (!ctx.type)
{
ctx.type = src.size_int;
}
}
const u64 mask =
+3 -6
View File
@@ -1,8 +1,6 @@
#include "cond.h"
#include "sync.h"
#include <limits.h>
#ifndef _WIN32
#include <thread>
#endif
@@ -10,13 +8,12 @@
bool cond_variable::imp_wait(u32 _old, u64 _timeout) noexcept
{
verify(HERE), _old != -1; // Very unlikely: it requires 2^32 distinct threads to wait simultaneously
const bool is_inf = _timeout > max_timeout;
#ifdef _WIN32
LARGE_INTEGER timeout;
timeout.QuadPart = _timeout * -10;
if (HRESULT rc = NtWaitForKeyedEvent(nullptr, &m_value, false, is_inf ? nullptr : &timeout))
if (HRESULT rc = NtWaitForKeyedEvent(nullptr, &m_value, false, _timeout == -1 ? nullptr : &timeout))
{
verify(HERE), rc == WAIT_TIMEOUT;
@@ -38,12 +35,12 @@ bool cond_variable::imp_wait(u32 _old, u64 _timeout) noexcept
for (u32 value = _old + 1;; value = m_value)
{
const int err = futex((int*)&m_value.raw(), FUTEX_WAIT_PRIVATE, value, is_inf ? nullptr : &timeout, nullptr, 0) == 0
const int err = futex((int*)&m_value.raw(), FUTEX_WAIT_PRIVATE, value, _timeout == -1 ? nullptr : &timeout, nullptr, 0) == 0
? 0
: errno;
// Normal or timeout wakeup
if (!err || (!is_inf && err == ETIMEDOUT))
if (!err || (_timeout != -1 && err == ETIMEDOUT))
{
// Cleanup (remove waiter)
verify(HERE), m_value--;
-2
View File
@@ -47,6 +47,4 @@ public:
imp_wake(-1);
}
}
static constexpr u64 max_timeout = u64{UINT32_MAX} / 1000 * 1000000;
};
+10
View File
@@ -0,0 +1,10 @@
Copyright (C) 2011-2012 Andrzej Krzemienski
Distributed under the Boost Software License, Version 1.0
(see accompanying file LICENSE_1_0.txt or a copy at
http://www.boost.org/LICENSE_1_0.txt)
The idea and interface is based on Boost.Optional library
authored by Fernando Luis Cacciola Carballal
Home at https://github.com/akrzemi1/Optional
+2 -2
View File
@@ -731,9 +731,9 @@ struct area_base
{
return{ x1 * size.width, y1 * size.height, x2 * size.width, y2 * size.height };
}
constexpr area_base operator * (const f32& value) const
constexpr area_base operator * (const T& value) const
{
return{ (T)(x1 * value), (T)(y1 * value), (T)(x2 * value), (T)(y2 * value) };
return{ x1 * value, y1 * value, x2 * value, y2 * value };
}
template<typename NT>
+3 -31
View File
@@ -13,10 +13,9 @@ rem // A copy of the GPL 2.0 should have been included with the program.
rem // If not, see http://www.gnu.org/licenses/
rem // Official git repository and contact information can be found at
rem // https://github.com/RPCS3/rpcs3 and https://rpcs3.net/.
rem // https://github.com/RPCS3/rpcs3 and http://rpcs3.net/.
setlocal ENABLEDELAYEDEXPANSION
setlocal ENABLEEXTENSIONS
set GIT_VERSION_FILE=%~p0..\rpcs3\git-version.h
if not defined GIT (
@@ -48,40 +47,14 @@ if errorlevel 1 (
echo // This is a generated file. > "%GIT_VERSION_FILE%"
echo. >> "%GIT_VERSION_FILE%"
echo #define RPCS3_GIT_VERSION "unknown" >> "%GIT_VERSION_FILE%"
echo #define RPCS3_GIT_BRANCH "unknown" >> "%GIT_VERSION_FILE%"
echo. >> "%GIT_VERSION_FILE%"
echo // If you don't want this file to update/recompile, change to 1. >> "%GIT_VERSION_FILE%"
echo #define RPCS3_GIT_VERSION_NO_UPDATE 0 >> "%GIT_VERSION_FILE%"
goto done
)
rem // Get commit count from (unshallowed) HEAD
for /F %%I IN ('call %GIT% rev-list HEAD --count') do set COMMIT_COUNT=%%I
rem // If we're in AppVeyor, building a non-master, pull request artifact
if defined APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH (
if "%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%"=="master" (
rem // If pull request comes from a master branch, GIT_BRANCH = username/branch in order to distinguish from upstream/master
for /f "tokens=1* delims=/" %%a in ("%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%") do set user=%%a
set "GIT_BRANCH=!user!/%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%"
) else (
rem // Otherwise, GIT_BRANCH=branch
set GIT_BRANCH=%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%
)
rem // Make GIT_VERSION the last commit (shortened); Don't include commit count on non-master builds
for /F %%I IN ('call %GIT% rev-parse --short HEAD') do set GIT_VERSION=%%I
) else (
rem // Get last commit (shortened) and concat after commit count in GIT_VERSION
for /F %%I IN ('call %GIT% rev-parse --short HEAD') do set GIT_VERSION=%COMMIT_COUNT%-%%I
for /F %%I IN ('call %GIT% rev-parse --abbrev-ref HEAD') do set GIT_BRANCH=%%I
)
rem // Echo obtained GIT_VERSION for debug purposes if needed
echo %GIT_VERSION%
for /F %%I IN ('call %GIT% rev-list HEAD --count') do set GIT_VERSION=%%I
for /F %%I IN ('call %GIT% rev-parse --short HEAD') do set GIT_VERSION=%GIT_VERSION%-%%I
rem // Don't modify the file if it already has the current version.
if exist "%GIT_VERSION_FILE%" (
@@ -94,7 +67,6 @@ if exist "%GIT_VERSION_FILE%" (
echo // This is a generated file. > "%GIT_VERSION_FILE%"
echo. >> "%GIT_VERSION_FILE%"
echo #define RPCS3_GIT_VERSION "%GIT_VERSION%" >> "%GIT_VERSION_FILE%"
echo #define RPCS3_GIT_BRANCH ^"%GIT_BRANCH%^" >> "%GIT_VERSION_FILE%"
echo. >> "%GIT_VERSION_FILE%"
echo // If you don't want this file to update/recompile, change to 1. >> "%GIT_VERSION_FILE%"
echo #define RPCS3_GIT_VERSION_NO_UPDATE 0 >> "%GIT_VERSION_FILE%"
-27
View File
@@ -1,27 +0,0 @@
#pragma once
#include <stdint.h>
namespace rpcs3
{
template<typename T>
static size_t hash_base(T value)
{
return static_cast<size_t>(value);
}
template<typename T>
static size_t hash_struct(const T& value)
{
// FNV 64-bit
size_t result = 14695981039346656037ull;
const unsigned char *bytes = reinterpret_cast<const unsigned char*>(&value);
for (size_t n = 0; n < sizeof(T); ++n)
{
result ^= bytes[n];
result *= 1099511628211ull;
}
return result;
}
}
+10 -106
View File
@@ -1,13 +1,6 @@
#include "mutex.h"
#include "sync.h"
#include <climits>
#include <vector>
#include <algorithm>
// TLS variable for tracking owned mutexes
thread_local std::vector<shared_mutex*> g_tls_locks;
void shared_mutex::imp_lock_shared(s64 _old)
{
verify("shared_mutex overflow" HERE), _old <= c_max;
@@ -28,12 +21,9 @@ void shared_mutex::imp_lock_shared(s64 _old)
// Acquire writer lock
imp_wait(m_value.load());
// Convert to reader lock
// Convert value
s64 value = m_value.fetch_add(c_one - c_min);
// Proceed exclusively
return;
if (value != 0)
{
imp_unlock(value);
@@ -45,14 +35,7 @@ void shared_mutex::imp_lock_shared(s64 _old)
NtWaitForKeyedEvent(nullptr, (int*)&m_value + 1, false, nullptr);
}
#else
// Acquire writer lock
imp_wait(0);
// Convert to reader lock
m_value += c_one - c_min;
// Disabled code
while (false)
while (true)
{
const s64 value0 = m_value.fetch_op([](s64& value)
{
@@ -80,13 +63,13 @@ void shared_mutex::imp_lock_shared(s64 _old)
value1 += c_one - c_min;
if (value1 > 0)
if (value1 >= 0)
{
return;
}
// Wait as a reader if necessary
while (futex((int*)&m_value.raw() + IS_LE_MACHINE, FUTEX_WAIT_BITSET_PRIVATE, int(value1 >> 32), nullptr, nullptr, INT_MIN))
while (futex((int*)&m_value.raw() + IS_LE_MACHINE, FUTEX_WAIT_PRIVATE, int(value1 >> 32), nullptr, nullptr, 0))
{
value1 = m_value.load();
@@ -127,7 +110,7 @@ void shared_mutex::imp_unlock_shared(s64 _old)
#else
m_value -= c_sig;
futex((int*)&m_value.raw() + IS_LE_MACHINE, FUTEX_WAKE_BITSET_PRIVATE, 1, nullptr, nullptr, u32(c_sig >> 32));
futex((int*)&m_value.raw() + IS_BE_MACHINE, FUTEX_WAKE_PRIVATE, 1, nullptr, nullptr, 0);
#endif
}
}
@@ -162,7 +145,7 @@ void shared_mutex::imp_wait(s64)
return;
}
futex((int*)&m_value.raw() + IS_LE_MACHINE, FUTEX_WAIT_BITSET_PRIVATE, int(value >> 32), nullptr, nullptr, u32(c_sig >> 32));
futex((int*)&m_value.raw() + IS_BE_MACHINE, FUTEX_WAIT_PRIVATE, int(value), nullptr, nullptr, 0);
}
#endif
}
@@ -197,9 +180,8 @@ void shared_mutex::imp_unlock(s64 _old)
{
NtReleaseKeyedEvent(nullptr, &m_value, false, nullptr);
}
else if (s64 count = -_old / c_min * 0)
else if (s64 count = -_old / c_min)
{
// Disabled code
while (count--)
{
NtReleaseKeyedEvent(nullptr, (int*)&m_value + 1, false, nullptr);
@@ -210,26 +192,23 @@ void shared_mutex::imp_unlock(s64 _old)
{
m_value -= c_sig;
futex((int*)&m_value.raw() + IS_LE_MACHINE, FUTEX_WAKE_BITSET_PRIVATE, 1, nullptr, nullptr, u32(c_sig >> 32));
futex((int*)&m_value.raw() + IS_BE_MACHINE, FUTEX_WAKE_PRIVATE, 1, nullptr, nullptr, 0);
}
else if (false)
else if (s64 count = -_old / c_min)
{
// Disabled code
futex((int*)&m_value.raw() + IS_LE_MACHINE, FUTEX_WAKE_BITSET_PRIVATE, INT_MAX, nullptr, nullptr, INT_MIN);
futex((int*)&m_value.raw() + IS_LE_MACHINE, FUTEX_WAKE_PRIVATE, INT_MAX, nullptr, nullptr, 0);
}
#endif
}
void shared_mutex::imp_lock_upgrade()
{
// TODO
unlock_shared();
lock();
}
void shared_mutex::imp_lock_degrade()
{
// TODO
unlock();
lock_shared();
}
@@ -257,78 +236,3 @@ bool shared_mutex::try_lock_degrade()
// TODO
return m_value.compare_and_swap_test(0, c_one - c_min);
}
safe_reader_lock::safe_reader_lock(shared_mutex& mutex)
: m_mutex(mutex)
, m_is_owned(false)
{
if (std::count(g_tls_locks.cbegin(), g_tls_locks.cend(), &m_mutex) == 0)
{
m_is_owned = true;
if (m_is_owned)
{
m_mutex.lock_shared();
g_tls_locks.emplace_back(&m_mutex);
return;
}
// TODO: order locks
}
}
safe_reader_lock::~safe_reader_lock()
{
if (m_is_owned)
{
m_mutex.unlock_shared();
g_tls_locks.erase(std::remove(g_tls_locks.begin(), g_tls_locks.end(), &m_mutex), g_tls_locks.cend());
return;
}
// TODO: order locks
}
safe_writer_lock::safe_writer_lock(shared_mutex& mutex)
: m_mutex(mutex)
, m_is_owned(false)
, m_is_upgraded(false)
{
if (std::count(g_tls_locks.cbegin(), g_tls_locks.cend(), &m_mutex) == 0)
{
m_is_owned = true;
if (m_is_owned)
{
m_mutex.lock_shared();
g_tls_locks.emplace_back(&m_mutex);
return;
}
// TODO: order locks
}
if (m_mutex.is_reading())
{
m_is_upgraded = true;
m_mutex.lock_upgrade();
}
}
safe_writer_lock::~safe_writer_lock()
{
if (m_is_upgraded)
{
m_mutex.lock_degrade();
return;
}
if (m_is_owned)
{
m_mutex.unlock();
g_tls_locks.erase(std::remove(g_tls_locks.begin(), g_tls_locks.end(), &m_mutex), g_tls_locks.cend());
return;
}
// TODO: order locks
}
-58
View File
@@ -95,11 +95,6 @@ public:
imp_lock_degrade();
}
}
bool is_reading() const
{
return (m_value.load() % c_one) != 0;
}
};
// Simplified shared (reader) lock implementation.
@@ -176,56 +171,3 @@ public:
unlock();
}
};
// Safe reader lock. Can be recursive above other safe locks (reader or writer).
class safe_reader_lock final
{
shared_mutex& m_mutex;
bool m_is_owned;
void lock()
{
m_mutex.lock_shared();
}
void unlock()
{
m_mutex.unlock_shared();
}
friend class cond_variable;
public:
safe_reader_lock(const safe_reader_lock&) = delete;
explicit safe_reader_lock(shared_mutex& mutex);
~safe_reader_lock();
};
// Safe writer lock. Can be recursive above other safe locks. Performs upgrade and degrade operations above existing reader lock if necessary.
class safe_writer_lock final
{
shared_mutex& m_mutex;
bool m_is_owned;
bool m_is_upgraded;
void lock()
{
m_mutex.lock();
}
void unlock()
{
m_mutex.unlock();
}
friend class cond_variable;
public:
safe_writer_lock(const safe_writer_lock&) = delete;
explicit safe_writer_lock(shared_mutex& mutex);
~safe_writer_lock();
};
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -61,9 +61,10 @@ rXmlDocument::rXmlDocument() : handle()
{
}
void rXmlDocument::Read(const std::string& data)
void rXmlDocument::Load(const std::string & path)
{
handle.load_buffer(data.data(), data.size());
// TODO: Unsure of use of c_str.
handle.load_file(path.c_str());
}
std::shared_ptr<rXmlNode> rXmlDocument::GetRoot()
+1 -1
View File
@@ -24,7 +24,7 @@ struct rXmlDocument
rXmlDocument();
rXmlDocument(const rXmlDocument& other) = delete;
rXmlDocument &operator=(const rXmlDocument& other) = delete;
void Read(const std::string& data);
void Load(const std::string & path);
std::shared_ptr<rXmlNode> GetRoot();
pugi::xml_document handle;
-114
View File
@@ -1,114 +0,0 @@
#include "sysinfo.h"
#include "StrFmt.h"
#ifdef _WIN32
#include "windows.h"
#else
#include <unistd.h>
#endif
bool utils::has_ssse3()
{
static const bool g_value = get_cpuid(0, 0)[0] >= 0x1 && get_cpuid(1, 0)[2] & 0x200;
return g_value;
}
bool utils::has_avx()
{
static const bool g_value = get_cpuid(0, 0)[0] >= 0x1 && get_cpuid(1, 0)[2] & 0x10000000;
return g_value;
}
bool utils::has_avx2()
{
static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && get_cpuid(7, 0)[1] & 0x20;
return g_value;
}
bool utils::has_rtm()
{
// Check RTM and MPX extensions in order to filter out TSX on Haswell CPUs
static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(7, 0)[1] & 0x4800) == 0x4800;
return g_value;
}
bool utils::has_512()
{
// Check AVX512F, AVX512CD, AVX512DQ, AVX512BW, AVX512VL extensions (Skylake-X level support)
static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(7, 0)[1] & 0xd0030000) == 0xd0030000;
return g_value;
}
bool utils::has_xop()
{
static const bool g_value = has_avx() && get_cpuid(0x80000001, 0)[2] & 0x800;
return g_value;
}
std::string utils::get_system_info()
{
std::string result;
std::string brand;
if (get_cpuid(0x80000000, 0)[0] >= 0x80000004)
{
for (u32 i = 0; i < 3; i++)
{
brand.append(reinterpret_cast<const char*>(get_cpuid(0x80000002 + i, 0).data()), 16);
}
}
else
{
brand = "Unknown CPU";
}
brand.erase(0, brand.find_first_not_of(' '));
brand.erase(brand.find_last_not_of(' ') + 1);
while (auto found = brand.find(" ") + 1)
{
brand.erase(brand.begin() + found);
}
#ifdef _WIN32
::SYSTEM_INFO sysInfo;
::GetNativeSystemInfo(&sysInfo);
::MEMORYSTATUSEX memInfo;
memInfo.dwLength = sizeof(memInfo);
::GlobalMemoryStatusEx(&memInfo);
const u32 num_proc = sysInfo.dwNumberOfProcessors;
const u64 mem_total = memInfo.ullTotalPhys;
#else
const u32 num_proc = ::sysconf(_SC_NPROCESSORS_ONLN);
const u64 mem_total = ::sysconf(_SC_PHYS_PAGES) * ::sysconf(_SC_PAGE_SIZE);
#endif
fmt::append(result, "%s | %d Threads | %.2f GiB RAM", brand, num_proc, mem_total / (1024.0f * 1024 * 1024));
if (has_avx())
{
result += " | AVX";
if (has_avx2())
{
result += '+';
}
if (has_512())
{
result += '+';
}
if (has_xop())
{
result += 'x';
}
}
if (has_rtm())
{
result += " | TSX";
}
return result;
}
-50
View File
@@ -1,50 +0,0 @@
#pragma once
#include "types.h"
#include <string>
namespace utils
{
inline std::array<u32, 4> get_cpuid(u32 func, u32 subfunc)
{
int regs[4];
#ifdef _MSC_VER
__cpuidex(regs, func, subfunc);
#else
__asm__ volatile("cpuid" : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3]) : "a" (func), "c" (subfunc));
#endif
return {0u+regs[0], 0u+regs[1], 0u+regs[2], 0u+regs[3]};
}
bool has_ssse3();
bool has_avx();
bool has_avx2();
bool has_rtm();
bool has_512();
bool has_xop();
inline bool transaction_enter()
{
while (true)
{
const auto status = _xbegin();
if (status == _XBEGIN_STARTED)
{
return true;
}
if (!(status & _XABORT_RETRY))
{
return false;
}
}
}
std::string get_system_info();
}
+18 -149
View File
@@ -12,7 +12,6 @@
#include <type_traits>
#include <utility>
#include <chrono>
#include <array>
// Assume little-endian
#define IS_LE_MACHINE 1
@@ -32,6 +31,7 @@
#define SAFE_BUFFERS
#define NEVER_INLINE __attribute__((noinline))
#define FORCE_INLINE __attribute__((always_inline)) inline
#define thread_local __thread
#endif
#define CHECK_SIZE(type, size) static_assert(sizeof(type) == size, "Invalid " #type " type size")
@@ -45,10 +45,13 @@
// Return 32 bit alignof() to avoid widening/narrowing conversions with size_t
#define ALIGN_32(...) static_cast<u32>(alignof(__VA_ARGS__))
// Return 32 bit offsetof()
#define OFFSET_32(type, x) static_cast<u32>(reinterpret_cast<std::uintptr_t>(&reinterpret_cast<const volatile char&>(reinterpret_cast<type*>(0ull)->x)))
#define CONCATENATE_DETAIL(x, y) x ## y
#define CONCATENATE(x, y) CONCATENATE_DETAIL(x, y)
#define STRINGIZE_DETAIL(x) #x ""
#define STRINGIZE_DETAIL(x) #x
#define STRINGIZE(x) STRINGIZE_DETAIL(x)
#define HERE "\n(in file " __FILE__ ":" STRINGIZE(__LINE__) ")"
@@ -69,8 +72,6 @@ using ulong = unsigned long;
using ullong = unsigned long long;
using llong = long long;
using uptr = std::uintptr_t;
using u8 = std::uint8_t;
using u16 = std::uint16_t;
using u32 = std::uint32_t;
@@ -449,71 +450,6 @@ constexpr T align(const T& value, ullong align)
return static_cast<T>((value + (align - 1)) & ~(align - 1));
}
template <typename T, typename T2>
inline u32 offset32(T T2::*const mptr)
{
#ifdef _MSC_VER
static_assert(sizeof(mptr) == sizeof(u32), "Invalid pointer-to-member size");
return reinterpret_cast<const u32&>(mptr);
#elif __GNUG__
static_assert(sizeof(mptr) == sizeof(std::size_t), "Invalid pointer-to-member size");
return static_cast<u32>(reinterpret_cast<const std::size_t&>(mptr));
#else
static_assert(sizeof(mptr) == 0, "Invalid pointer-to-member size");
#endif
}
template <typename T>
struct offset32_array
{
static_assert(std::is_array<T>::value, "Invalid pointer-to-member type (array expected)");
template <typename Arg>
static inline u32 index32(const Arg& arg)
{
return SIZE_32(std::remove_extent_t<T>) * static_cast<u32>(arg);
}
};
template <typename T, std::size_t N>
struct offset32_array<std::array<T, N>>
{
template <typename Arg>
static inline u32 index32(const Arg& arg)
{
return SIZE_32(T) * static_cast<u32>(arg);
}
};
template <typename Arg>
struct offset32_detail;
template <typename T, typename T2, typename Arg, typename... Args>
inline u32 offset32(T T2::*const mptr, const Arg& arg, const Args&... args)
{
return offset32_detail<Arg>::offset32(mptr, arg, args...);
}
template <typename Arg>
struct offset32_detail
{
template <typename T, typename T2, typename... Args>
static inline u32 offset32(T T2::*const mptr, const Arg& arg, const Args&... args)
{
return ::offset32(mptr, args...) + offset32_array<T>::index32(arg);
}
};
template <typename T3, typename T4>
struct offset32_detail<T3 T4::*>
{
template <typename T, typename T2, typename... Args>
static inline u32 offset32(T T2::*const mptr, T3 T4::*const mptr2, const Args&... args)
{
return ::offset32(mptr) + ::offset32(mptr2, args...);
}
};
inline u32 cntlz32(u32 arg, bool nonzero = false)
{
#ifdef _MSC_VER
@@ -534,26 +470,6 @@ inline u64 cntlz64(u64 arg, bool nonzero = false)
#endif
}
inline u32 cnttz32(u32 arg, bool nonzero = false)
{
#ifdef _MSC_VER
ulong res;
return _BitScanForward(&res, arg) || nonzero ? res : 32;
#else
return arg || nonzero ? __builtin_ctzll(arg) : 32;
#endif
}
inline u64 cnttz64(u64 arg, bool nonzero = false)
{
#ifdef _MSC_VER
ulong res;
return _BitScanForward64(&res, arg) || nonzero ? res : 64;
#else
return arg || nonzero ? __builtin_ctzll(arg) : 64;
#endif
}
// Helper function, used by ""_u16, ""_u32, ""_u64
constexpr u8 to_u8(char c)
{
@@ -938,7 +854,7 @@ struct error_code
error_code() = default;
// Implementation must be provided specially
static s32 error_report(const fmt_type_info* sup, u64 arg, const fmt_type_info* sup2, u64 arg2);
static s32 error_report(const fmt_type_info* sup, u64 arg);
// Helper type
enum class not_an_error : s32
@@ -959,7 +875,7 @@ struct error_code
// Not an error constructor
template<typename ET, typename = decltype(ET::__not_an_error)>
error_code(const ET& value, std::nullptr_t = nullptr)
error_code(const ET& value, int = 0)
: value(static_cast<s32>(value))
{
}
@@ -967,14 +883,7 @@ struct error_code
// Error constructor
template<typename ET, typename = std::enable_if_t<is_error<ET>::value>>
error_code(const ET& value)
: value(error_report(fmt::get_type_info<fmt_unveil_t<ET>>(), fmt_unveil<ET>::get(value), nullptr, 0))
{
}
// Error constructor (2 args)
template<typename ET, typename T2, typename = std::enable_if_t<is_error<ET>::value>>
error_code(const ET& value, const T2& value2)
: value(error_report(fmt::get_type_info<fmt_unveil_t<ET>>(), fmt_unveil<ET>::get(value), fmt::get_type_info<fmt_unveil_t<T2>>(), fmt_unveil<T2>::get(value2)))
: value(error_report(fmt::get_type_info<fmt_unveil_t<ET>>(), fmt_unveil<ET>::get(value)))
{
}
@@ -1000,85 +909,45 @@ inline void busy_wait(std::size_t count = 100)
// Rotate helpers
#if defined(__GNUG__)
inline u8 rol8(u8 x, u8 n)
inline u8 rol8(const u8 x, const u8 n)
{
u8 result = x;
__asm__("rolb %[n], %[result]" : [result] "+g" (result) : [n] "c" (n));
return result;
}
inline u8 ror8(u8 x, u8 n)
{
u8 result = x;
__asm__("rorb %[n], %[result]" : [result] "+g" (result) : [n] "c" (n));
return result;
}
inline u16 rol16(u16 x, u16 n)
inline u16 rol16(const u16 x, const u16 n)
{
u16 result = x;
__asm__("rolw %b[n], %[result]" : [result] "+g" (result) : [n] "c" (n));
return result;
}
inline u16 ror16(u16 x, u16 n)
{
u16 result = x;
__asm__("rorw %b[n], %[result]" : [result] "+g" (result) : [n] "c" (n));
return result;
}
inline u32 rol32(u32 x, u32 n)
inline u32 rol32(const u32 x, const u32 n)
{
u32 result = x;
__asm__("roll %b[n], %[result]" : [result] "+g" (result) : [n] "c" (n));
return result;
}
inline u32 ror32(u32 x, u32 n)
{
u32 result = x;
__asm__("rorl %b[n], %[result]" : [result] "+g" (result) : [n] "c" (n));
return result;
}
inline u64 rol64(u64 x, u64 n)
inline u64 rol64(const u64 x, const u64 n)
{
u64 result = x;
__asm__("rolq %b[n], %[result]" : [result] "+g" (result) : [n] "c" (n));
return result;
}
inline u64 ror64(u64 x, u64 n)
inline u64 ror64(const u64 x, const u64 n)
{
u64 result = x;
__asm__("rorq %b[n], %[result]" : [result] "+g" (result) : [n] "c" (n));
return result;
}
inline u64 umulh64(u64 a, u64 b)
{
u64 result;
__asm__("mulq %[b]" : "=d" (result) : [a] "a" (a), [b] "rm" (b));
return result;
}
inline s64 mulh64(s64 a, s64 b)
{
s64 result;
__asm__("imulq %[b]" : "=d" (result) : [a] "a" (a), [b] "rm" (b));
return result;
}
#elif defined(_MSC_VER)
inline u8 rol8(u8 x, u8 n) { return _rotl8(x, n); }
inline u8 ror8(u8 x, u8 n) { return _rotr8(x, n); }
inline u16 rol16(u16 x, u16 n) { return _rotl16(x, (u8)n); }
inline u16 ror16(u16 x, u16 n) { return _rotr16(x, (u8)n); }
inline u32 rol32(u32 x, u32 n) { return _rotl(x, (int)n); }
inline u32 ror32(u32 x, u32 n) { return _rotr(x, (int)n); }
inline u64 rol64(u64 x, u64 n) { return _rotl64(x, (int)n); }
inline u64 ror64(u64 x, u64 n) { return _rotr64(x, (int)n); }
inline u64 umulh64(u64 x, u64 y) { return __umulh(x, y); }
inline s64 mulh64(s64 x, s64 y) { return __mulh(x, y); }
inline u8 rol8(const u8 x, const u8 n) { return _rotl8(x, n); }
inline u16 rol16(const u16 x, const u16 n) { return _rotl16(x, (u8)n); }
inline u32 rol32(const u32 x, const u32 n) { return _rotl(x, (int)n); }
inline u64 rol64(const u64 x, const u64 n) { return _rotl64(x, (int)n); }
inline u64 ror64(const u64 x, const u64 n) { return _rotr64(x, (int)n); }
#endif
-17
View File
@@ -12,7 +12,6 @@
#include <utility>
#include "recursive_wrapper.hpp"
#include "variant_visitor.hpp"
// clang-format off
// [[deprecated]] is only available in C++14, use this for the time being
@@ -850,22 +849,6 @@ namespace std {
return detail::binary_dispatcher<F, V, R, Types...>::apply(v0, v1, std::forward<F>(f));
}
// match
// unary
template <typename... Fs>
auto VARIANT_INLINE match(Fs&&... fs) const
-> decltype(variant::visit(*this, ::std::make_visitor(std::forward<Fs>(fs)...)))
{
return variant::visit(*this, ::std::make_visitor(std::forward<Fs>(fs)...));
}
// non-const
template <typename... Fs>
auto VARIANT_INLINE match(Fs&&... fs)
-> decltype(variant::visit(*this, ::std::make_visitor(std::forward<Fs>(fs)...)))
{
return variant::visit(*this, ::std::make_visitor(std::forward<Fs>(fs)...));
}
~variant() noexcept // no-throw destructor
{
helper_type::destroy(type_index, &data);
-45
View File
@@ -1,45 +0,0 @@
#ifndef MAPBOX_UTIL_VARIANT_VISITOR_HPP
#define MAPBOX_UTIL_VARIANT_VISITOR_HPP
#include <utility>
//namespace mapbox {
//namespace util {
namespace std {
template <typename... Fns>
struct visitor;
template <typename Fn>
struct visitor<Fn> : Fn
{
using Fn::operator();
template<typename T>
visitor(T&& fn) : Fn(std::forward<T>(fn)) {}
};
template <typename Fn, typename... Fns>
struct visitor<Fn, Fns...> : Fn, visitor<Fns...>
{
using Fn::operator();
using visitor<Fns...>::operator();
template<typename T, typename... Ts>
visitor(T&& fn, Ts&&... fns)
: Fn(std::forward<T>(fn))
, visitor<Fns...>(std::forward<Ts>(fns)...) {}
};
template <typename... Fns>
visitor<typename std::decay<Fns>::type...> make_visitor(Fns&&... fns)
{
return visitor<typename std::decay<Fns>::type...>
(std::forward<Fns>(fns)...);
}
}
//} // namespace util
//} // namespace mapbox
#endif // MAPBOX_UTIL_VARIANT_VISITOR_HPP
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -19,7 +19,7 @@
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@@ -54,7 +54,6 @@
</ClCompile>
<ClCompile Include="yaml-cpp\src\emitterutils.cpp">
</ClCompile>
<ClCompile Include="yaml-cpp\src\exceptions.cpp" />
<ClCompile Include="yaml-cpp\src\exp.cpp">
</ClCompile>
<ClCompile Include="yaml-cpp\src\memory.cpp">
-3
View File
@@ -88,8 +88,5 @@
<ClCompile Include="yaml-cpp\src\tag.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="yaml-cpp\src\exceptions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

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